plugins.groupchat: Keep track of real jid, affiliation and role.

Sat, 13 Nov 2010 21:27:01 +0100

author
Kim Alvefur <zash@zash.se>
date
Sat, 13 Nov 2010 21:27:01 +0100
changeset 46
1f0fa4af29b8
parent 45
aa797b0a98e7
child 47
b84572a2e6cb

plugins.groupchat: Keep track of real jid, affiliation and role.

plugins/groupchat.lua file | annotate | diff | comparison | revisions
--- a/plugins/groupchat.lua	Sat Nov 13 20:24:45 2010 +0100
+++ b/plugins/groupchat.lua	Sat Nov 13 21:27:01 2010 +0100
@@ -80,6 +80,15 @@
 					jid = presence.stanza.attr.from;
 					presence = presence.stanza;
 				};
+				local x = presence.stanza:get_child("x", xmlns_muc .. "#user");
+				if x then
+					local x_item = x:get_child("item");
+					if x_item and x_item.attr then
+						occupants[nick].real_jid    = x_item.attr.jid;
+						occupants[nick].affiliation = x_item.attr.affiliation;
+						occupants[nick].role        = x_item.attr.role;
+					end
+				end
 				if nick == room.nick then
 					room.bot:event("groupchat/joined", room);
 				else

mercurial