Browse Source

Adopts kick to new focus.

master
paweldomas 11 years ago
parent
commit
cd6264d0df
3 changed files with 19 additions and 13 deletions
  1. 11
    10
      app.js
  2. 3
    2
      moderatemuc.js
  3. 5
    1
      muc.js

+ 11
- 10
app.js View File

603
     }
603
     }
604
 });
604
 });
605
 
605
 
606
-$(document).bind('callterminated.jingle', function (event, sid, jid, reason) {
607
-    // Leave the room if my call has been remotely terminated.
608
-    if (connection.emuc.joined && reason === 'kick') {
609
-        sessionTerminated = true;
610
-        connection.emuc.doLeave();
611
-        messageHandler.openMessageDialog("Session Terminated",
612
-                            "Ouch! You have been kicked out of the meet!");
613
-    }
614
-});
615
-
616
 $(document).bind('setLocalDescription.jingle', function (event, sid) {
606
 $(document).bind('setLocalDescription.jingle', function (event, sid) {
617
     // put our ssrcs into presence so other clients can identify our stream
607
     // put our ssrcs into presence so other clients can identify our stream
618
     var sess = connection.jingle.sessions[sid];
608
     var sess = connection.jingle.sessions[sid];
852
 
842
 
853
 });
843
 });
854
 
844
 
845
+$(document).bind('kicked.muc', function (event, jid) {
846
+    console.info(jid + " has been kicked from MUC!");
847
+    if (connection.emuc.myroomjid === jid) {
848
+        sessionTerminated = true;
849
+        disposeConference(false);
850
+        connection.emuc.doLeave();
851
+        messageHandler.openMessageDialog("Session Terminated",
852
+            "Ouch! You have been kicked out of the meet!");
853
+    }
854
+});
855
+
855
 $(document).bind('passwordrequired.muc', function (event, jid) {
856
 $(document).bind('passwordrequired.muc', function (event, jid) {
856
     console.log('on password required', jid);
857
     console.log('on password required', jid);
857
 
858
 

+ 3
- 2
moderatemuc.js View File

1
-/* global $, $iq, config, connection, Strophe, toggleAudio */
1
+/* global $, $iq, config, connection, messageHandler, Strophe, toggleAudio */
2
 /**
2
 /**
3
  * Moderate connection plugin.
3
  * Moderate connection plugin.
4
  */
4
  */
40
         return true;
40
         return true;
41
     },
41
     },
42
     eject: function (jid) {
42
     eject: function (jid) {
43
-        connection.jingle.terminateRemoteByJid(jid, 'kick');
43
+        // We're not the focus, so can't terminate
44
+        //connection.jingle.terminateRemoteByJid(jid, 'kick');
44
         connection.emuc.kick(jid);
45
         connection.emuc.kick(jid);
45
     }
46
     }
46
 });
47
 });

+ 5
- 1
muc.js View File

167
         if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
167
         if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
168
             delete this.members[from];
168
             delete this.members[from];
169
             this.list_members.splice(this.list_members.indexOf(from), 1);
169
             this.list_members.splice(this.list_members.indexOf(from), 1);
170
-            $(document).trigger('left.muc', [from]);
170
+            if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="307"]').length) {
171
+                $(document).trigger('kicked.muc', [from]);
172
+            } else {
173
+                $(document).trigger('left.muc', [from]);
174
+            }
171
         }
175
         }
172
         // If the status code is 110 this means we're leaving and we would like
176
         // If the status code is 110 this means we're leaving and we would like
173
         // to remove everyone else from our view, so we trigger the event.
177
         // to remove everyone else from our view, so we trigger the event.

Loading…
Cancel
Save