Mercurial > prosody-modules
comparison mod_e2e_policy/mod_e2e_policy.lua @ 3219:58d61459cdb1
mod_e2e_policy: Always add the 'to' in warning stanzas
author | Michel Le Bihan <michel@lebihan.pl> |
---|---|
date | Wed, 08 Aug 2018 15:20:52 +0200 |
parents | 611a787e6d08 |
children | 762c7e7ee64b |
comparison
equal
deleted
inserted
replaced
3218:67f1d1f22625 | 3219:58d61459cdb1 |
---|---|
35 if event.stanza:get_child("openpgp", "urn:xmpp:openpgp:0") then | 35 if event.stanza:get_child("openpgp", "urn:xmpp:openpgp:0") then |
36 return nil; | 36 return nil; |
37 end | 37 end |
38 -- no valid encryption found | 38 -- no valid encryption found |
39 if e2e_policy_chat == "optional" and event.stanza.attr.type ~= "groupchat" then | 39 if e2e_policy_chat == "optional" and event.stanza.attr.type ~= "groupchat" then |
40 event.origin.send(st.message({ from = host, type = "headline" }, e2e_policy_message_optional_chat)); | 40 event.origin.send(st.message({ from = host, to = event.stanza.attr.from, type = "headline" }, e2e_policy_message_optional_chat)); |
41 end | 41 end |
42 if e2e_policy_chat == "required" and event.stanza.attr.type ~= "groupchat" then | 42 if e2e_policy_chat == "required" and event.stanza.attr.type ~= "groupchat" then |
43 return event.origin.send(st.error_reply(event.stanza, "modify", "policy-violation", e2e_policy_message_required_chat)); | 43 return event.origin.send(st.error_reply(event.stanza, "modify", "policy-violation", e2e_policy_message_required_chat)); |
44 end | 44 end |
45 if e2e_policy_muc == "optional" and event.stanza.attr.type == "groupchat" then | 45 if e2e_policy_muc == "optional" and event.stanza.attr.type == "groupchat" then |
46 event.origin.send(st.message({ from = host, type = "headline" }, e2e_policy_message_optional_muc)); | 46 event.origin.send(st.message({ from = host, to = event.stanza.attr.from, type = "headline" }, e2e_policy_message_optional_muc)); |
47 end | 47 end |
48 if e2e_policy_muc == "required" and event.stanza.attr.type == "groupchat" then | 48 if e2e_policy_muc == "required" and event.stanza.attr.type == "groupchat" then |
49 return event.origin.send(st.error_reply(event.stanza, "modify", "policy-violation", e2e_policy_message_required_muc)); | 49 return event.origin.send(st.error_reply(event.stanza, "modify", "policy-violation", e2e_policy_message_required_muc)); |
50 end | 50 end |
51 end | 51 end |