浏览代码

handle DTMF_SUPPORT_CHANGED event

master
isymchych 9 年前
父节点
当前提交
eeb390cd9d
共有 3 个文件被更改,包括 15 次插入21 次删除
  1. 8
    10
      app.js
  2. 2
    2
      modules/RoomLocker.js
  3. 5
    9
      modules/UI/UI.js

+ 8
- 10
app.js 查看文件

@@ -343,9 +343,6 @@ function initConference(localTracks, connection) {
343 343
         room.setDisplayName(nickname);
344 344
     });
345 345
 
346
-    room.on(ConferenceErrors.PASSWORD_REQUIRED, function () {
347
-        // FIXME handle
348
-    });
349 346
     room.on(ConferenceErrors.CONNECTION_ERROR, function () {
350 347
         // FIXME handle
351 348
     });
@@ -366,25 +363,26 @@ function initConference(localTracks, connection) {
366 363
         );
367 364
     });
368 365
 
366
+    room.on(ConferenceEvents.DTMF_SUPPORT_CHANGED, function (isDTMFSupported) {
367
+        APP.UI.updateDTMFSupport(isDTMFSupported);
368
+    });
369
+
369 370
     return new Promise(function (resolve, reject) {
370 371
         room.on(ConferenceEvents.CONFERENCE_JOINED, resolve);
371 372
 
372
-        room.on(ConferenceErrors.ROOM_PASSWORD_REQUIRED, function () {
373
+        room.on(ConferenceErrors.PASSWORD_REQUIRED, function () {
373 374
             APP.UI.markRoomLocked(true);
374 375
             roomLocker.requirePassword().then(function () {
375 376
                 room.join(roomLocker.password);
376 377
             });
377 378
         });
378 379
 
380
+        // FIXME handle errors here
381
+
379 382
         APP.UI.closeAuthenticationDialog();
380 383
         room.join();
381 384
     }).catch(function (err) {
382
-        if (err[0] === ConferenceErrors.PASSWORD_REQUIRED) {
383
-            // FIXME ask for password and try again
384
-            return initConference(localTracks, connection);
385
-        }
386
-
387
-        // FIXME else notify that we cannot conenct to the room
385
+        // FIXME notify that we cannot conenct to the room
388 386
 
389 387
         throw new Error(err[0]);
390 388
     });

+ 2
- 2
modules/RoomLocker.js 查看文件

@@ -83,7 +83,7 @@ function notifyPasswordFailed() {
83 83
     messageHandler.showError("dialog.lockTitle", "dialog.lockMessage");
84 84
 }
85 85
 
86
-const JitsiConferenceErrors = JitsiMeetJS.errors.conference;
86
+const ConferenceErrors = JitsiMeetJS.errors.conference;
87 87
 
88 88
 export default function createRoomLocker (room) {
89 89
     let password;
@@ -92,7 +92,7 @@ export default function createRoomLocker (room) {
92 92
         return room.lock(newPass).then(function () {
93 93
             password = newPass;
94 94
         }).catch(function (err) {
95
-            if (err === JitsiConferenceErrors.PASSWORD_NOT_SUPPORTED) {
95
+            if (err === ConferenceErrors.PASSWORD_NOT_SUPPORTED) {
96 96
                 notifyPasswordNotSupported();
97 97
             } else {
98 98
                 notifyPasswordFailed(err);

+ 5
- 9
modules/UI/UI.js 查看文件

@@ -316,15 +316,6 @@ function initEtherpad(name) {
316 316
     Etherpad.init(name);
317 317
 }
318 318
 
319
-/**
320
- * The dialpad button is shown iff there is at least one member that supports
321
- * DTMF (e.g. jigasi).
322
- */
323
-function onDtmfSupportChanged(dtmfSupport) {
324
-    //TODO: enable when the UI is ready
325
-    //Toolbar.showDialPadButton(dtmfSupport);
326
-}
327
-
328 319
 UI.addUser = function (jid, id, displayName) {
329 320
     messageHandler.notify(
330 321
         displayName,'notify.somebody', 'connected', 'notify.connected'
@@ -621,4 +612,9 @@ UI.addMessage = function (from, displayName, message, stamp) {
621 612
     Chat.updateChatConversation(from, displayName, message, stamp);
622 613
 };
623 614
 
615
+UI.updateDTMFSupport = function (isDTMFSupported) {
616
+    //TODO: enable when the UI is ready
617
+    //Toolbar.showDialPadButton(dtmfSupport);
618
+};
619
+
624 620
 module.exports = UI;

正在加载...
取消
保存