Software /
code /
prosody
Comparison
plugins/muc/muc.lib.lua @ 2173:f9af31dbfeb8
MUC: Prevent visitors from broadcasting messages.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 25 Nov 2009 21:42:05 +0500 |
parent | 2172:84dd0fada45b |
child | 2174:13375e6c4ecb |
comparison
equal
deleted
inserted
replaced
2172:84dd0fada45b | 2173: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 |