diff options
author | daurnimator <quae@daurnimator.com> | 2014-06-06 14:34:01 -0400 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2014-06-06 14:34:01 -0400 |
commit | 2399b7c676168a3dad3555f8c3be2e0e1c9d58cc (patch) | |
tree | 7e3f6afe3ac8756a168f11219c10449f142cf968 /plugins | |
parent | 010963c10efbbe5c9f0cdbfc9f96fe722d211f8f (diff) | |
download | prosody-2399b7c676168a3dad3555f8c3be2e0e1c9d58cc.tar.gz prosody-2399b7c676168a3dad3555f8c3be2e0e1c9d58cc.zip |
plugins/muc/muc.lib: Don't add invite/decline bodies if they already have one
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/muc/muc.lib.lua | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index a7b6ef9c..57cc3721 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -868,11 +868,13 @@ end); -- Add a plain message for clients which don't support invites module:hook("muc-invite", function(event) local room, stanza = event.room, event.stanza; - local invite = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("invite"); - local reason = invite:get_child_text("reason") or ""; - stanza:tag("body") - :text(invite.attr.from.." invited you to the room "..room.jid..(reason == "" and (" ("..reason..")") or "")) - :up(); + if not stanza:get_child("body") then + local invite = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("invite"); + local reason = invite:get_child_text("reason") or ""; + stanza:tag("body") + :text(invite.attr.from.." invited you to the room "..room.jid..(reason == "" and (" ("..reason..")") or "")) + :up(); + end end); function room_mt:handle_mediated_decline(origin, stanza) @@ -906,11 +908,13 @@ end -- Add a plain message for clients which don't support declines module:hook("muc-decline", function(event) local room, stanza = event.room, event.stanza; - local decline = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("decline"); - local reason = decline:get_child_text("reason") or ""; - stanza:tag("body") - :text(decline.attr.from.." declined your invite to the room "..room.jid..(reason == "" and (" ("..reason..")") or "")) - :up(); + if not stanza:get_child("body") then + local decline = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("decline"); + local reason = decline:get_child_text("reason") or ""; + stanza:tag("body") + :text(decline.attr.from.." declined your invite to the room "..room.jid..(reason == "" and (" ("..reason..")") or "")) + :up(); + end end); function room_mt:handle_message_to_room(origin, stanza) |