Mercurial > prosody-modules
comparison mod_muc_bot/mod_muc_bot.lua @ 4567:bcf4518d18d4
mod_muc_bot: Add option to ignore error bounces from bots
Useful when they don't handle messages correctly, returning an error.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 24 May 2021 16:18:56 +0200 |
| parents | 174c7a3c819b |
| children | 205b9d06fe6b |
comparison
equal
deleted
inserted
replaced
| 4566:174c7a3c819b | 4567:bcf4518d18d4 |
|---|---|
| 66 end); | 66 end); |
| 67 return true; | 67 return true; |
| 68 end, -100); | 68 end, -100); |
| 69 end | 69 end |
| 70 | 70 |
| 71 if module:get_option_boolean("ignore_bot_errors", true) then | |
| 72 module:hook("message/full", function (event) | |
| 73 local stanza = event.stanza; | |
| 74 if stanza.attr.type == "error" then | |
| 75 if bots:contains(jid.bare(stanza.attr.from)) or bots:contains(jid.host(stanza.attr.from)) then | |
| 76 module:log("debug", "Ignoring error from known bot"); | |
| 77 return true; | |
| 78 end | |
| 79 end | |
| 80 end, 1); | |
| 81 end | |
| 82 | |
| 71 assert(string.sub("foo[bot]", -5, -1) == "[bot]", "substring indicies, how do they work?"); | 83 assert(string.sub("foo[bot]", -5, -1) == "[bot]", "substring indicies, how do they work?"); |
