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

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
         'connected',
710
         'connected',
711
         'connected');
711
         'connected');
712
 
712
 
713
-    if (Strophe.getResourceFromJid(jid).indexOf('focus') != -1)
713
+    if (info.isFocus)
714
     {
714
     {
715
         focusJid = jid;
715
         focusJid = jid;
716
-        console.info("Ignore focus " + jid);
716
+        console.info("Ignore focus: " + jid +", real JID: " + info.jid);
717
         return;
717
         return;
718
     }
718
     }
719
 
719
 
828
 
828
 
829
     if (displayName && displayName.length > 0)
829
     if (displayName && displayName.length > 0)
830
         $(document).trigger('displaynamechanged',
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
         return;
834
         return;
836
     }
835
     }
837
 
836
 

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

13
     useNicks: false,
13
     useNicks: false,
14
     bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that
14
     bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that
15
     clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
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
     //defaultSipNumber: '', // Default SIP number
17
     //defaultSipNumber: '', // Default SIP number
17
     desktopSharing: 'ext', // Desktop sharing method. Can be set to 'ext', 'webrtc' or false to disable.
18
     desktopSharing: 'ext', // Desktop sharing method. Can be set to 'ext', 'webrtc' or false to disable.
18
     chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk', // Id of desktop streamer Chrome extension
19
     chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk', // Id of desktop streamer Chrome extension

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

123
         member.affiliation = tmp.attr('affiliation');
123
         member.affiliation = tmp.attr('affiliation');
124
         member.role = tmp.attr('role');
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
         var nicktag = $(pres).find('>nick[xmlns="http://jabber.org/protocol/nick"]');
133
         var nicktag = $(pres).find('>nick[xmlns="http://jabber.org/protocol/nick"]');
127
         member.displayName = (nicktag.length > 0 ? nicktag.text() : null);
134
         member.displayName = (nicktag.length > 0 ? nicktag.text() : null);
128
 
135
 
167
         if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
174
         if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
168
             delete this.members[from];
175
             delete this.members[from];
169
             this.list_members.splice(this.list_members.indexOf(from), 1);
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
         // If the status code is 110 this means we're leaving and we would like
179
         // If the status code is 110 this means we're leaving and we would like
177
         // to remove everyone else from our view, so we trigger the event.
180
         // to remove everyone else from our view, so we trigger the event.
183
                 $(document).trigger('left.muc', member);
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
         return true;
192
         return true;
187
     },
193
     },
188
     onPresenceError: function (pres) {
194
     onPresenceError: function (pres) {

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