Comparison

plugins/muc/muc.lib.lua @ 3445:2fde9cb97f76

MUC: Return correct error to non-members attempting to enter a members-only room.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 03 Aug 2010 21:07:00 +0500
parent 3393:5b8de0731c4d
child 3446:9c0b3cd890e9
comparison
equal deleted inserted replaced
3444:e6a78e15fed2 3445:2fde9cb97f76
430 self:_route_stanza(pr:tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) 430 self:_route_stanza(pr:tag("x", {xmlns='http://jabber.org/protocol/muc#user'})
431 :tag("item", {affiliation=affiliation or "none", role=role or "none"}):up() 431 :tag("item", {affiliation=affiliation or "none", role=role or "none"}):up()
432 :tag("status", {code='110'})); 432 :tag("status", {code='110'}));
433 end 433 end
434 self:send_history(from, stanza); 434 self:send_history(from, stanza);
435 elseif not affiliation then -- registration required for entering members-only room
436 local reply = st.error_reply(stanza, "auth", "registration-required"):up();
437 reply.tags[1].attr.code = "407";
438 origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
435 else -- banned 439 else -- banned
436 local reply = st.error_reply(stanza, "auth", "forbidden"):up(); 440 local reply = st.error_reply(stanza, "auth", "forbidden"):up();
437 reply.tags[1].attr.code = "403"; 441 reply.tags[1].attr.code = "403";
438 origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); 442 origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
439 end 443 end