Software /
code /
prosody
Changeset
1740:b37ccf9bec89
MUC: Send appropriate error to banned users on join.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 07 Sep 2009 20:27:52 +0500 |
parents | 1739:393abf245322 |
children | 1741:2919f3b985fc |
files | plugins/muc/muc.lib.lua |
diffstat | 1 files changed, 11 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua Mon Sep 07 20:26:26 2009 +0500 +++ b/plugins/muc/muc.lib.lua Mon Sep 07 20:27:52 2009 +0500 @@ -257,24 +257,21 @@ origin.send(st.error_reply(stanza, "cancel", "conflict"):tag("x", {xmlns = "http://jabber.org/protocol/muc"})); else log("debug", "%s joining as %s", from, to); - local data; --- if not rooms:get(room) and not rooms_info:get(room) then -- new room --- rooms_info:set(room, 'name', (jid_split(room))); --- data = {affiliation='owner', role='moderator', jid=from, sessions={[from]=get_filtered_presence(stanza)}}; --- end if not next(self._affiliations) then -- new room, no owners self._affiliations[jid_bare(from)] = "owner"; end - if not data then -- new occupant - local affiliation = self:get_affiliation(from); - data = {affiliation=affiliation, role=self:get_default_role(affiliation), jid=from, sessions={[from]=get_filtered_presence(stanza)}}; + local affiliation = self:get_affiliation(from); + local role = self:get_default_role(affiliation) + if role then -- new occupant + self._occupants[to] = {affiliation=affiliation, role=role, jid=from, sessions={[from]=get_filtered_presence(stanza)}}; + self._jid_nick[from] = to; + self:send_occupant_list(from); + pr.attr.from = to; + self:broadcast_presence(pr); + self:send_history(from); + else -- banned + origin.send(st.error_reply(stanza, "auth", "forbidden"):tag("x", {xmlns = "http://jabber.org/protocol/muc"})); end - self._occupants[to] = data; - self._jid_nick[from] = to; - self:send_occupant_list(from); - pr.attr.from = to; - self:broadcast_presence(pr); - self:send_history(from); end end elseif type ~= 'result' then -- bad type