plugins/muc/muc.lib.lua

changeset 2212
f9af31dbfeb8
parent 2211
84dd0fada45b
child 2213
13375e6c4ecb
equal deleted inserted replaced
2211:84dd0fada45b 2212:f9af31dbfeb8
517 end 517 end
518 elseif stanza.name == "message" and type == "groupchat" then 518 elseif stanza.name == "message" and type == "groupchat" then
519 local from, to = stanza.attr.from, stanza.attr.to; 519 local from, to = stanza.attr.from, stanza.attr.to;
520 local room = jid_bare(to); 520 local room = jid_bare(to);
521 local current_nick = self._jid_nick[from]; 521 local current_nick = self._jid_nick[from];
522 if not current_nick then -- not in room 522 local occupant = self._occupants[current_nick];
523 if not occupant then -- not in room
523 origin.send(st.error_reply(stanza, "cancel", "not-acceptable")); 524 origin.send(st.error_reply(stanza, "cancel", "not-acceptable"));
525 elseif occupant.role == "visitor" then
526 origin.send(st.error_reply(stanza, "cancel", "forbidden"));
524 else 527 else
525 local from = stanza.attr.from; 528 local from = stanza.attr.from;
526 stanza.attr.from = current_nick; 529 stanza.attr.from = current_nick;
527 local subject = getText(stanza, {"subject"}); 530 local subject = getText(stanza, {"subject"});
528 if subject then 531 if subject then

mercurial