xmpp_muc.js: Prepare occupant object with nick, status, role and affiliation

Mon, 05 Apr 2010 13:18:24 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 05 Apr 2010 13:18:24 +0100
changeset 42
815816ceb1ad
parent 41
d22dee1f3dba
child 43
a3febc43e4e9

xmpp_muc.js: Prepare occupant object with nick, status, role and affiliation

src/js/xmpp_muc.js file | annotate | diff | comparison | revisions
--- a/src/js/xmpp_muc.js	Mon Apr 05 13:18:00 2010 +0100
+++ b/src/js/xmpp_muc.js	Mon Apr 05 13:18:24 2010 +0100
@@ -90,9 +90,16 @@
 			{
 				var text = stanza.getElementsByTagName("status")[0];
 				if(text) text = Strophe.getText(text);
-				this.occupants[nick] = {};
+				this.occupants[nick] = { nick: nick, status: text };
+				var item = get_child(stanza, "x", "http://jabber.org/protocol/muc#user");
+				if(item)
+				{
+					item = item.getElementsByTagName("item")[0];
+					this.occupants[nick].affiliation = item.getAttribute("affiliation");
+					this.occupants[nick].role = item.getAttribute("role");
+				}
 				if(this.callbacks.joined)
-					this.callbacks.joined(stanza, this, nick, text);
+					this.callbacks.joined(stanza, this, this.occupants[nick]);
 				if(this.status_handler)
 				{
 					this.status_handler(stanza);

mercurial