Преглед на файлове

Detects focus user in reliable way(through user real JID). Fixes kicked event when both 307 and 110 status codes are received in MUC presence.

master
paweldomas преди 10 години
родител
ревизия
8f94ac8b09
променени са 3 файла, в които са добавени 16 реда и са изтрити 10 реда
  1. 4
    5
      app.js
  2. 1
    0
      config.js
  3. 11
    5
      muc.js

+ 4
- 5
app.js Целия файл

@@ -710,10 +710,10 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {
710 710
         'connected',
711 711
         'connected');
712 712
 
713
-    if (Strophe.getResourceFromJid(jid).indexOf('focus') != -1)
713
+    if (info.isFocus)
714 714
     {
715 715
         focusJid = jid;
716
-        console.info("Ignore focus " + jid);
716
+        console.info("Ignore focus: " + jid +", real JID: " + info.jid);
717 717
         return;
718 718
     }
719 719
 
@@ -828,10 +828,9 @@ $(document).bind('presence.muc', function (event, jid, info, pres) {
828 828
 
829 829
     if (displayName && displayName.length > 0)
830 830
         $(document).trigger('displaynamechanged',
831
-                            [jid, displayName]);
832
-    if (Strophe.getResourceFromJid(jid).indexOf('focus') != -1)
831
+                            [jid, info.displayName]);
832
+    if (info.isFocus)
833 833
     {
834
-        console.info("Ignore focus");
835 834
         return;
836 835
     }
837 836
 

+ 1
- 0
config.js Целия файл

@@ -13,6 +13,7 @@ var config = {
13 13
     useNicks: false,
14 14
     bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that
15 15
     clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
16
+    focusUserJid: 'focus@auth.pawel.jitsi.net', // The real JID of focus participant
16 17
     //defaultSipNumber: '', // Default SIP number
17 18
     desktopSharing: 'ext', // Desktop sharing method. Can be set to 'ext', 'webrtc' or false to disable.
18 19
     chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk', // Id of desktop streamer Chrome extension

+ 11
- 5
muc.js Целия файл

@@ -123,6 +123,13 @@ Strophe.addConnectionPlugin('emuc', {
123 123
         member.affiliation = tmp.attr('affiliation');
124 124
         member.role = tmp.attr('role');
125 125
 
126
+        // Focus recognition
127
+        member.jid = tmp.attr('jid');
128
+        member.isFocus = false;
129
+        if (member.jid && member.jid.indexOf(config.focusUserJid + "/") == 0) {
130
+            member.isFocus = true;
131
+        }
132
+
126 133
         var nicktag = $(pres).find('>nick[xmlns="http://jabber.org/protocol/nick"]');
127 134
         member.displayName = (nicktag.length > 0 ? nicktag.text() : null);
128 135
 
@@ -167,11 +174,7 @@ Strophe.addConnectionPlugin('emuc', {
167 174
         if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
168 175
             delete this.members[from];
169 176
             this.list_members.splice(this.list_members.indexOf(from), 1);
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
-            }
177
+            $(document).trigger('left.muc', [from]);
175 178
         }
176 179
         // If the status code is 110 this means we're leaving and we would like
177 180
         // to remove everyone else from our view, so we trigger the event.
@@ -183,6 +186,9 @@ Strophe.addConnectionPlugin('emuc', {
183 186
                 $(document).trigger('left.muc', member);
184 187
             }
185 188
         }
189
+        if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="307"]').length) {
190
+            $(document).trigger('kicked.muc', [from]);
191
+        }
186 192
         return true;
187 193
     },
188 194
     onPresenceError: function (pres) {

Loading…
Отказ
Запис