plugins/groupchat.lua

changeset 46
1f0fa4af29b8
parent 45
aa797b0a98e7
child 56
cb7656ee4dd8
equal deleted inserted replaced
45:aa797b0a98e7 46:1f0fa4af29b8
78 occupants[nick] = { 78 occupants[nick] = {
79 nick = nick; 79 nick = nick;
80 jid = presence.stanza.attr.from; 80 jid = presence.stanza.attr.from;
81 presence = presence.stanza; 81 presence = presence.stanza;
82 }; 82 };
83 local x = presence.stanza:get_child("x", xmlns_muc .. "#user");
84 if x then
85 local x_item = x:get_child("item");
86 if x_item and x_item.attr then
87 occupants[nick].real_jid = x_item.attr.jid;
88 occupants[nick].affiliation = x_item.attr.affiliation;
89 occupants[nick].role = x_item.attr.role;
90 end
91 end
83 if nick == room.nick then 92 if nick == room.nick then
84 room.bot:event("groupchat/joined", room); 93 room.bot:event("groupchat/joined", room);
85 else 94 else
86 room:event("occupant-joined", occupants[nick]); 95 room:event("occupant-joined", occupants[nick]);
87 end 96 end

mercurial