瀏覽代碼

Adopts kick to new focus.

master
paweldomas 11 年之前
父節點
當前提交
cd6264d0df
共有 3 個文件被更改,包括 19 次插入13 次删除
  1. 11
    10
      app.js
  2. 3
    2
      moderatemuc.js
  3. 5
    1
      muc.js

+ 11
- 10
app.js 查看文件

@@ -603,16 +603,6 @@ $(document).bind('conferenceCreated.jingle', function (event, focus)
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 606
 $(document).bind('setLocalDescription.jingle', function (event, sid) {
617 607
     // put our ssrcs into presence so other clients can identify our stream
618 608
     var sess = connection.jingle.sessions[sid];
@@ -852,6 +842,17 @@ $(document).bind('presence.status.muc', function (event, jid, info, pres) {
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 856
 $(document).bind('passwordrequired.muc', function (event, jid) {
856 857
     console.log('on password required', jid);
857 858
 

+ 3
- 2
moderatemuc.js 查看文件

@@ -1,4 +1,4 @@
1
-/* global $, $iq, config, connection, Strophe, toggleAudio */
1
+/* global $, $iq, config, connection, messageHandler, Strophe, toggleAudio */
2 2
 /**
3 3
  * Moderate connection plugin.
4 4
  */
@@ -40,7 +40,8 @@ Strophe.addConnectionPlugin('moderate', {
40 40
         return true;
41 41
     },
42 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 45
         connection.emuc.kick(jid);
45 46
     }
46 47
 });

+ 5
- 1
muc.js 查看文件

@@ -167,7 +167,11 @@ Strophe.addConnectionPlugin('emuc', {
167 167
         if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
168 168
             delete this.members[from];
169 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 176
         // If the status code is 110 this means we're leaving and we would like
173 177
         // to remove everyone else from our view, so we trigger the event.

Loading…
取消
儲存