Bläddra i källkod

Lobby required displayname (#1231)

* ref: Fix imports order.

* feat: Adds display name required connection event.
master
Дамян Минков 4 år sedan
förälder
incheckning
8f9bd254bb
Inget konto är kopplat till bidragsgivarens mejladress
3 ändrade filer med 28 tillägg och 10 borttagningar
  1. 7
    0
      JitsiConnectionEvents.js
  2. 2
    2
      modules/xmpp/Caps.js
  3. 19
    8
      modules/xmpp/xmpp.js

+ 7
- 0
JitsiConnectionEvents.js Visa fil

38
  * connection is not in the correct state(connected, disconnected, etc.)
38
  * connection is not in the correct state(connected, disconnected, etc.)
39
  */
39
  */
40
 export const WRONG_STATE = 'connection.wrongState';
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 Visa fil

183
      * @param {int} timeout the timeout in ms for reply from the host.
183
      * @param {int} timeout the timeout in ms for reply from the host.
184
      * @returns {Promise<Set<String>, Error>}
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 Visa fil

4
 import { $msg, Strophe } from 'strophe.js';
4
 import { $msg, Strophe } from 'strophe.js';
5
 import 'strophejs-plugin-disco';
5
 import 'strophejs-plugin-disco';
6
 
6
 
7
-import RandomUtil from '../util/RandomUtil';
8
 import * as JitsiConnectionErrors from '../../JitsiConnectionErrors';
7
 import * as JitsiConnectionErrors from '../../JitsiConnectionErrors';
9
 import * as JitsiConnectionEvents from '../../JitsiConnectionEvents';
8
 import * as JitsiConnectionEvents from '../../JitsiConnectionEvents';
9
+import XMPPEvents from '../../service/xmpp/XMPPEvents';
10
 import browser from '../browser';
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
 import MucConnectionPlugin from './strophe.emuc';
17
 import MucConnectionPlugin from './strophe.emuc';
12
 import JingleConnectionPlugin from './strophe.jingle';
18
 import JingleConnectionPlugin from './strophe.jingle';
13
-import initStropheUtil from './strophe.util';
19
+import initStropheLogger from './strophe.logger';
14
 import PingConnectionPlugin from './strophe.ping';
20
 import PingConnectionPlugin from './strophe.ping';
15
 import RayoConnectionPlugin from './strophe.rayo';
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
 const logger = getLogger(__filename);
24
 const logger = getLogger(__filename);
24
 
25
 
251
 
252
 
252
                         if (identity.type === 'lobbyrooms') {
253
                         if (identity.type === 'lobbyrooms') {
253
                             this.lobbySupported = true;
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
 

Laddar…
Avbryt
Spara