# HG changeset patch # User Waqas Hussain # Date 1252337272 -18000 # Node ID b37ccf9bec896dc21537a7caa894ff83b7c72929 # Parent 393abf245322a0f7aefa9f88bc20a7760439b100 MUC: Send appropriate error to banned users on join. diff -r 393abf245322 -r b37ccf9bec89 plugins/muc/muc.lib.lua --- 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