# HG changeset patch # User Kim Alvefur # Date 1459328087 -7200 # Node ID d6fbb57a216cb8517f4a093cfb0dfd3efaaa07fd # Parent 218a3d3f7f97a41531d6aed6fa091023bc53f261 mod_throttle_unsolicited: Skip checking messages to self diff -r 218a3d3f7f97 -r d6fbb57a216c mod_throttle_unsolicited/mod_throttle_unsolicited.lua --- a/mod_throttle_unsolicited/mod_throttle_unsolicited.lua Tue Mar 29 19:47:08 2016 +0200 +++ b/mod_throttle_unsolicited/mod_throttle_unsolicited.lua Wed Mar 30 10:54:47 2016 +0200 @@ -16,8 +16,14 @@ log("debug", "check_subscribed(%s)", stanza:top_tag()); if stanza.attr.type == "error" then return end + local to_orig = stanza.attr.to; + if to_orig == nil or to_orig == origin.full_jid then return end -- to self + + local to_bare = jid_bare(to_orig); + local from_jid = jid_bare(stanza.attr.from); + if to_bare == from_jid then return end -- to own resource + -- Check if it's a message to a joined room - local to_bare = jid_bare(stanza.attr.to); local rooms = origin.rooms_joined; if rooms and rooms[to_bare] then log("debug", "Message to joined room, no limit"); @@ -32,8 +38,7 @@ origin.throttle_unsolicited = lim; end - local to_user, to_host = jid_split(stanza.attr.to); - local from_jid = jid_bare(stanza.attr.from); + local to_user, to_host = jid_split(to_orig); if to_user and not is_contact_subscribed(to_user, to_host, from_jid) then log("debug", "%s is not subscribed to %s@%s", from_jid, to_user, to_host); if not lim:poll(1) then