support-chat/js/supportchat.js

changeset 53
5cb47f4087a8
parent 51
7f893f429760
child 54
e5e70a46ace8
equal deleted inserted replaced
52:221c4db8ab40 53:5cb47f4087a8
19 /*** Query information */ 19 /*** Query information */
20 var question_type; // E.g. "Sales", "Technical" 20 var question_type; // E.g. "Sales", "Technical"
21 var question_name; // Name of the submitter 21 var question_name; // Name of the submitter
22 var question_text; // The query itself 22 var question_text; // The query itself
23 23
24 /*** XMPP rooms */
25 var team_muc; // MUC of the assistant team
26 var question_muc; // Temporary room for query discussion
27
24 /* Called by Strophe when status of connection changes 28 /* Called by Strophe when status of connection changes
25 (from disconnected to connected, vice-versa, etc.) 29 (from disconnected to connected, vice-versa, etc.)
26 */ 30 */
27 function handle_connection_status(status, err) 31 function handle_connection_status(status, err)
28 { 32 {
71 var our_nick = question_name; 75 var our_nick = question_name;
72 76
73 set_ui_state("wait"); 77 set_ui_state("wait");
74 78
75 // Create our question room 79 // Create our question room
76 var question_muc = new MUC(conn, { 80 question_muc = new MUC(conn, {
77 // Handle room joins 81 // Handle room joins
78 joined: function (stanza, muc, occupant) 82 joined: function (stanza, muc, occupant)
79 { 83 {
80 if(occupant.nick == our_nick) 84 if(occupant.nick == our_nick)
81 // We joined the question room, now join the team room and tell them 85 // We joined the question room, now join the team room and tell them
115 var unique = "support-"+Math.floor(Math.random()*512); 119 var unique = "support-"+Math.floor(Math.random()*512);
116 question_muc.join(unique + "@" + support_config.muc_server, our_nick); 120 question_muc.join(unique + "@" + support_config.muc_server, our_nick);
117 }); 121 });
118 122
119 // Create the team MUC object (it will be joined after we join the question MUC) 123 // Create the team MUC object (it will be joined after we join the question MUC)
120 var team_muc = new MUC(conn, { 124 team_muc = new MUC(conn, {
121 // Someone joined the team MUC 125 // Someone joined the team MUC
122 joined: function (stanza, muc, occupant) 126 joined: function (stanza, muc, occupant)
123 { 127 {
124 if(occupant.nick != our_nick) 128 if(occupant.nick != our_nick)
125 return; 129 return;

mercurial