Comparison

plugins/muc/muc.lib.lua @ 9820:87a1742f928d

Merge 0.11->trunk
author Matthew Wild <mwild1@gmail.com>
date Mon, 04 Feb 2019 09:28:02 +0000
parent 9766:f40b9649e929
parent 9819:11671a2e07a9
child 9830:d935a0f0de24
comparison
equal deleted inserted replaced
9818:eb4724f20b1e 9820:87a1742f928d
719 stanza.attr.from, stanza.attr.to, stanza.attr.id = from, to, id; 719 stanza.attr.from, stanza.attr.to, stanza.attr.id = from, to, id;
720 return true; 720 return true;
721 else -- Type is "get" or "set" 721 else -- Type is "get" or "set"
722 local current_nick = self:get_occupant_jid(from); 722 local current_nick = self:get_occupant_jid(from);
723 if not current_nick then 723 if not current_nick then
724 origin.send(st.error_reply(stanza, "cancel", "not-acceptable")); 724 origin.send(st.error_reply(stanza, "cancel", "not-acceptable", "You are not currently connected to this chat"));
725 return true; 725 return true;
726 end 726 end
727 if not occupant then -- recipient not in room 727 if not occupant then -- recipient not in room
728 origin.send(st.error_reply(stanza, "cancel", "item-not-found", "Recipient not in room")); 728 origin.send(st.error_reply(stanza, "cancel", "item-not-found", "Recipient not in room"));
729 return true; 729 return true;
752 local from, to = stanza.attr.from, stanza.attr.to; 752 local from, to = stanza.attr.from, stanza.attr.to;
753 local current_nick = self:get_occupant_jid(from); 753 local current_nick = self:get_occupant_jid(from);
754 local type = stanza.attr.type; 754 local type = stanza.attr.type;
755 if not current_nick then -- not in room 755 if not current_nick then -- not in room
756 if type ~= "error" then 756 if type ~= "error" then
757 origin.send(st.error_reply(stanza, "cancel", "not-acceptable")); 757 origin.send(st.error_reply(stanza, "cancel", "not-acceptable", "You are not currently connected to this chat"));
758 end 758 end
759 return true; 759 return true;
760 end 760 end
761 if type == "groupchat" then -- groupchat messages not allowed in PM 761 if type == "groupchat" then -- groupchat messages not allowed in PM
762 origin.send(st.error_reply(stanza, "modify", "bad-request")); 762 origin.send(st.error_reply(stanza, "modify", "bad-request"));
1052 1052
1053 -- Role check 1053 -- Role check
1054 module:hook("muc-occupant-groupchat", function(event) 1054 module:hook("muc-occupant-groupchat", function(event)
1055 local role_rank = valid_roles[event.occupant and event.occupant.role or "none"]; 1055 local role_rank = valid_roles[event.occupant and event.occupant.role or "none"];
1056 if role_rank <= valid_roles.none then 1056 if role_rank <= valid_roles.none then
1057 event.origin.send(st.error_reply(event.stanza, "cancel", "not-acceptable")); 1057 event.origin.send(st.error_reply(event.stanza, "cancel", "not-acceptable", "You are not currently connected to this chat"));
1058 return true; 1058 return true;
1059 elseif role_rank <= valid_roles.visitor then 1059 elseif role_rank <= valid_roles.visitor then
1060 event.origin.send(st.error_reply(event.stanza, "auth", "forbidden")); 1060 event.origin.send(st.error_reply(event.stanza, "auth", "forbidden"));
1061 return true; 1061 return true;
1062 end 1062 end