Mercurial > prosody-modules
comparison mod_block_strangers/mod_block_strangers.lua @ 1928:252b634b065d
mod_block_strangers: Bounce IQ stanzas (they MUST be replied to)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 23 Oct 2015 16:55:01 +0200 |
| parents | b21236b6b8d8 |
| children | 82834df1dea6 |
comparison
equal
deleted
inserted
replaced
| 1927:439711709d29 | 1928:252b634b065d |
|---|---|
| 9 local from_jid = jid_bare(stanza.attr.from); | 9 local from_jid = jid_bare(stanza.attr.from); |
| 10 if to_user and not is_contact_subscribed(to_user, to_host, from_jid) then | 10 if to_user and not is_contact_subscribed(to_user, to_host, from_jid) then |
| 11 if to_resource and stanza.attr.type == "groupchat" then | 11 if to_resource and stanza.attr.type == "groupchat" then |
| 12 return nil; -- Pass through | 12 return nil; -- Pass through |
| 13 end | 13 end |
| 14 if stanza.name == "iq" and ( stanza.attr.type == "get" or stanza.attr.type == "set" ) then | |
| 15 event.origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | |
| 16 end | |
| 14 return true; -- Drop stanza | 17 return true; -- Drop stanza |
| 15 end | 18 end |
| 16 end | 19 end |
| 17 | 20 |
| 18 module:hook("message/bare", check_subscribed, 200); | 21 module:hook("message/bare", check_subscribed, 200); |
