Преглед изворни кода

Lobby required displayname (#1231)

* ref: Fix imports order.

* feat: Adds display name required connection event.
master
Дамян Минков пре 4 година
родитељ
комит
8f9bd254bb
No account linked to committer's email address
3 измењених фајлова са 28 додато и 10 уклоњено
  1. 7
    0
      JitsiConnectionEvents.js
  2. 2
    2
      modules/xmpp/Caps.js
  3. 19
    8
      modules/xmpp/xmpp.js

+ 7
- 0
JitsiConnectionEvents.js Прегледај датотеку

@@ -38,3 +38,10 @@ export const CONNECTION_FAILED = 'connection.connectionFailed';
38 38
  * connection is not in the correct state(connected, disconnected, etc.)
39 39
  */
40 40
 export const WRONG_STATE = 'connection.wrongState';
41
+
42
+/**
43
+ * Indicates that the display name is required over this connection and need to be supplied when
44
+ * joining the room.
45
+ * There are cases like lobby room where display name is required.
46
+ */
47
+export const DISPLAY_NAME_REQUIRED = 'connection.display_name_required';

+ 2
- 2
modules/xmpp/Caps.js Прегледај датотеку

@@ -183,8 +183,8 @@ export default class Caps extends Listenable {
183 183
      * @param {int} timeout the timeout in ms for reply from the host.
184 184
      * @returns {Promise<Set<String>, Error>}
185 185
      */
186
-    getFeaturesAndIdentities(jid, timeout = 5000) {
187
-        return this._getDiscoInfo(jid, null, timeout);
186
+    getFeaturesAndIdentities(jid, node, timeout = 5000) {
187
+        return this._getDiscoInfo(jid, node, timeout);
188 188
     }
189 189
 
190 190
     /**

+ 19
- 8
modules/xmpp/xmpp.js Прегледај датотеку

@@ -4,21 +4,22 @@ import { getLogger } from 'jitsi-meet-logger';
4 4
 import { $msg, Strophe } from 'strophe.js';
5 5
 import 'strophejs-plugin-disco';
6 6
 
7
-import RandomUtil from '../util/RandomUtil';
8 7
 import * as JitsiConnectionErrors from '../../JitsiConnectionErrors';
9 8
 import * as JitsiConnectionEvents from '../../JitsiConnectionEvents';
9
+import XMPPEvents from '../../service/xmpp/XMPPEvents';
10 10
 import browser from '../browser';
11
+import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
12
+import Listenable from '../util/Listenable';
13
+import RandomUtil from '../util/RandomUtil';
14
+
15
+import Caps from './Caps';
16
+import XmppConnection from './XmppConnection';
11 17
 import MucConnectionPlugin from './strophe.emuc';
12 18
 import JingleConnectionPlugin from './strophe.jingle';
13
-import initStropheUtil from './strophe.util';
19
+import initStropheLogger from './strophe.logger';
14 20
 import PingConnectionPlugin from './strophe.ping';
15 21
 import RayoConnectionPlugin from './strophe.rayo';
16
-import initStropheLogger from './strophe.logger';
17
-import Listenable from '../util/Listenable';
18
-import Caps from './Caps';
19
-import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
20
-import XMPPEvents from '../../service/xmpp/XMPPEvents';
21
-import XmppConnection from './XmppConnection';
22
+import initStropheUtil from './strophe.util';
22 23
 
23 24
 const logger = getLogger(__filename);
24 25
 
@@ -251,6 +252,16 @@ export default class XMPP extends Listenable {
251 252
 
252 253
                         if (identity.type === 'lobbyrooms') {
253 254
                             this.lobbySupported = true;
255
+                            identity.name && this.caps.getFeaturesAndIdentities(identity.name, identity.type)
256
+                                .then(({ features: f }) => {
257
+                                    f.forEach(fr => {
258
+                                        if (fr.endsWith('#displayname_required')) {
259
+                                            this.eventEmitter.emit(
260
+                                                JitsiConnectionEvents.DISPLAY_NAME_REQUIRED);
261
+                                        }
262
+                                    });
263
+                                })
264
+                                .catch(logger.warn('Error getting features from lobby.'));
254 265
                         }
255 266
                     });
256 267
 

Loading…
Откажи
Сачувај