Mercurial > prosody-hg
comparison plugins/muc/muc.lib.lua @ 6131:8dd0c6145603
plugins/muc/muc.lib: Add decline event for parity with invite
| author | daurnimator <quae@daurnimator.com> |
|---|---|
| date | Thu, 20 Mar 2014 15:50:29 -0400 |
| parents | c95d9132592a |
| children | 96a1aa23ae0d |
comparison
equal
deleted
inserted
replaced
| 6130:c95d9132592a | 6131:8dd0c6145603 |
|---|---|
| 1062 :up() | 1062 :up() |
| 1063 :up() | 1063 :up() |
| 1064 :tag('body') -- Add a plain message for clients which don't support declines | 1064 :tag('body') -- Add a plain message for clients which don't support declines |
| 1065 :text(from..' declined your invite to the room '..to..(reason and (' ('..reason..')') or "")) | 1065 :text(from..' declined your invite to the room '..to..(reason and (' ('..reason..')') or "")) |
| 1066 :up(); | 1066 :up(); |
| 1067 self:_route_stanza(decline); | 1067 module:fire_event("muc-decline", { room = self, stanza = decline, origin = origin, incoming = stanza }); |
| 1068 return true; | 1068 return true; |
| 1069 else | 1069 else |
| 1070 origin.send(st.error_reply(stanza, "cancel", "jid-malformed")); | 1070 origin.send(st.error_reply(stanza, "cancel", "jid-malformed")); |
| 1071 return true; | 1071 return true; |
| 1072 end | 1072 end |
| 1073 end | 1073 end |
| 1074 | |
| 1075 module:hook("muc-decline", function(event) | |
| 1076 event.room:_route_stanza(event.stanza); | |
| 1077 return true; | |
| 1078 end, -1) | |
| 1074 | 1079 |
| 1075 function room_mt:handle_message_to_room(origin, stanza) | 1080 function room_mt:handle_message_to_room(origin, stanza) |
| 1076 local type = stanza.attr.type; | 1081 local type = stanza.attr.type; |
| 1077 if type == "groupchat" then | 1082 if type == "groupchat" then |
| 1078 return self:handle_groupchat_to_room(origin, stanza) | 1083 return self:handle_groupchat_to_room(origin, stanza) |
