Mercurial > prosody-hg
comparison plugins/mod_privacy.lua @ 5393:57c4964eff0b
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 |
| parents | 7838acadb0fa |
| children | eeea0eb2602a |
comparison
equal
deleted
inserted
replaced
| 5392:613959dbd0b2 | 5393:57c4964eff0b |
|---|---|
| 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")); |
