Changes to work with new callback syntax

Mon, 05 Apr 2010 13:23:45 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 05 Apr 2010 13:23:45 +0100
changeset 43
a3febc43e4e9
parent 42
815816ceb1ad
child 44
094640b971b4

Changes to work with new callback syntax

src/js/supportchat.js file | annotate | diff | comparison | revisions
--- a/src/js/supportchat.js	Mon Apr 05 13:18:24 2010 +0100
+++ b/src/js/supportchat.js	Mon Apr 05 13:23:45 2010 +0100
@@ -76,15 +76,15 @@
 	// Create our question room
 	var question_muc = new MUC(conn, {
 		// Handle room joins
-		joined: function (stanza, muc, nick)
+		joined: function (stanza, muc, occupant)
 		{
-			if(nick == our_nick)
+			if(occupant.nick == our_nick)
 				// We joined the question room, now join the team room and tell them
 				team_muc.join(support_config.team_rooms[question_type], our_nick);
 			else if(ui_state == "wait")
 			{
 				// We were waiting for an assistant, and one just joined
-				var html = "<span class='muc-message'><span class='muc-nick'>" + htmlescape(nick) + "</span>" + " is answering your query</span><br/>\n";
+				var html = "<span class='muc-message'><span class='muc-nick'>" + htmlescape(occupant.nick) + "</span>" + " is answering your query</span><br/>\n";
 				$("#support-log").append(html).scrollTop($("#support-log")[0].scrollHeight);
 				$("#support-send-button").click(function ()
 					{
@@ -120,18 +120,15 @@
 	// Create the team MUC object (it will be joined after we join the question MUC)
 	var team_muc = new MUC(conn, {
 		// Someone joined the team MUC
-		joined: function (stanza, muc, nick)
+		joined: function (stanza, muc, occupant)
 		{
-			if(nick != our_nick)
+			if(occupant.nick != our_nick)
 				return;
 			
 			var sent = false;
 			for(var nick in team_muc.occupants)
 			{
-				var affiliation = $(stanza)
-				            .find("x[xmlns='http://jabber.org/protocol/muc#user']>item")
-				            .attr("affiliation");
-				if(affiliation == "none" || nick == our_nick)
+				if(team_muc.occupants[nick].affiliation == "none" || nick == our_nick)
 					continue;
 				sent = true;
 				if(support_config.send_invites)

mercurial