# HG changeset patch # User Kim Alvefur # Date 1621865936 -7200 # Node ID bcf4518d18d453628da358a317b44e259e6470ae # Parent 174c7a3c819b16dca1ef18b3f9c1653d67ef0cb2 mod_muc_bot: Add option to ignore error bounces from bots Useful when they don't handle messages correctly, returning an error. diff -r 174c7a3c819b -r bcf4518d18d4 mod_muc_bot/mod_muc_bot.lua --- a/mod_muc_bot/mod_muc_bot.lua Mon May 24 16:18:29 2021 +0200 +++ b/mod_muc_bot/mod_muc_bot.lua Mon May 24 16:18:56 2021 +0200 @@ -68,4 +68,16 @@ end, -100); end +if module:get_option_boolean("ignore_bot_errors", true) then + module:hook("message/full", function (event) + local stanza = event.stanza; + if stanza.attr.type == "error" then + if bots:contains(jid.bare(stanza.attr.from)) or bots:contains(jid.host(stanza.attr.from)) then + module:log("debug", "Ignoring error from known bot"); + return true; + end + end + end, 1); +end + assert(string.sub("foo[bot]", -5, -1) == "[bot]", "substring indicies, how do they work?");