Comparison

plugins/muc/muc.lib.lua @ 3247:ee8aaca3226c

MUC: Include a <password/> element in invites from password protected rooms.
author Waqas Hussain <waqas20@gmail.com>
date Sun, 13 Jun 2010 19:03:03 +0500
parent 3246:3371419eb0e1
child 3248:f8d14ea3ad0e
comparison
equal deleted inserted replaced
3246:3371419eb0e1 3247:ee8aaca3226c
704 local _reason = payload.tags[1] and payload.tags[1].name == 'reason' and #payload.tags[1].tags == 0 and payload.tags[1][1]; 704 local _reason = payload.tags[1] and payload.tags[1].name == 'reason' and #payload.tags[1].tags == 0 and payload.tags[1][1];
705 local invite = st.message({from = _to, to = _invitee, id = stanza.attr.id}) 705 local invite = st.message({from = _to, to = _invitee, id = stanza.attr.id})
706 :tag('x', {xmlns='http://jabber.org/protocol/muc#user'}) 706 :tag('x', {xmlns='http://jabber.org/protocol/muc#user'})
707 :tag('invite', {from=_from}) 707 :tag('invite', {from=_from})
708 :tag('reason'):text(_reason or ""):up() 708 :tag('reason'):text(_reason or ""):up()
709 :up() 709 :up();
710 :up() 710 if self:get_password() then
711 invite:tag("password"):text(self:get_password()):up();
712 end
713 invite:up()
711 :tag('x', {xmlns="jabber:x:conference", jid=_to}) -- COMPAT: Some older clients expect this 714 :tag('x', {xmlns="jabber:x:conference", jid=_to}) -- COMPAT: Some older clients expect this
712 :text(_reason or "") 715 :text(_reason or "")
713 :up() 716 :up()
714 :tag('body') -- Add a plain message for clients which don't support invites 717 :tag('body') -- Add a plain message for clients which don't support invites
715 :text(_from..' invited you to the room '.._to..(_reason and (' ('.._reason..')') or "")) 718 :text(_from..' invited you to the room '.._to..(_reason and (' ('.._reason..')') or ""))