Software /
code /
prosody
Comparison
plugins/mod_privacy.lua @ 5382:214c32e10734
mod_privacy: Drop stanzas of type groupchat, so users aren't kicked from their chatrooms when blocking specific MUC occupants.
author | Tobias Markmann <tm@ayena.de> |
---|---|
date | Thu, 28 Mar 2013 12:49:19 +0100 |
parent | 5370:7838acadb0fa |
child | 5500:eeea0eb2602a |
comparison
equal
deleted
inserted
replaced
5381:30484214d49b | 5382:214c32e10734 |
---|---|
364 block = (item.action == "deny"); | 364 block = (item.action == "deny"); |
365 end | 365 end |
366 end | 366 end |
367 if apply then | 367 if apply then |
368 if block then | 368 if block then |
369 -- drop and not bounce groupchat messages, otherwise users will get kicked | |
370 if stanza.attr.type == "groupchat" then | |
371 return true; | |
372 end | |
369 module:log("debug", "stanza blocked: %s, to: %s, from: %s", tostring(stanza.name), tostring(to), tostring(from)); | 373 module:log("debug", "stanza blocked: %s, to: %s, from: %s", tostring(stanza.name), tostring(to), tostring(from)); |
370 if stanza.name == "message" then | 374 if stanza.name == "message" then |
371 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 375 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
372 elseif stanza.name == "iq" and (stanza.attr.type == "get" or stanza.attr.type == "set") then | 376 elseif stanza.name == "iq" and (stanza.attr.type == "get" or stanza.attr.type == "set") then |
373 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 377 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |