瀏覽代碼

Removes toggle lock icon, just lock or unlock it, depending the status returned by the server.

j8
Damian Minkov 11 年之前
父節點
當前提交
5ce2ce8db6
共有 3 個文件被更改,包括 18 次插入6 次删除
  1. 0
    2
      app.js
  2. 14
    1
      muc.js
  3. 4
    3
      toolbar.js

+ 0
- 2
app.js 查看文件

1413
         connection.emuc.lockRoom(sharedKey);
1413
         connection.emuc.lockRoom(sharedKey);
1414
     else
1414
     else
1415
         connection.emuc.lockRoom('');
1415
         connection.emuc.lockRoom('');
1416
-
1417
-    Toolbar.updateLockButton();
1418
 }
1416
 }
1419
 
1417
 
1420
 /**
1418
 /**

+ 14
- 1
muc.js 查看文件

263
                     // FIXME: is muc#roomconfig_passwordprotectedroom required?
263
                     // FIXME: is muc#roomconfig_passwordprotectedroom required?
264
                     this.connection.sendIQ(formsubmit,
264
                     this.connection.sendIQ(formsubmit,
265
                         function (res) {
265
                         function (res) {
266
-                            console.log('set room password');
266
+                            // password is required
267
+                            if (sharedKey)
268
+                            {
269
+                                console.log('set room password');
270
+                                Toolbar.lockLockButton();
271
+                            }
272
+                            else
273
+                            {
274
+                                console.log('removed room password');
275
+                                Toolbar.unlockLockButton();
276
+                            }
267
                         },
277
                         },
268
                         function (err) {
278
                         function (err) {
269
                             console.warn('setting password failed', err);
279
                             console.warn('setting password failed', err);
270
                             messageHandler.showError('Lock failed',
280
                             messageHandler.showError('Lock failed',
271
                                 'Failed to lock conference.',
281
                                 'Failed to lock conference.',
272
                                 err);
282
                                 err);
283
+                            setSharedKey('');
273
                         }
284
                         }
274
                     );
285
                     );
275
                 } else {
286
                 } else {
276
                     console.warn('room passwords not supported');
287
                     console.warn('room passwords not supported');
277
                     messageHandler.showError('Warning',
288
                     messageHandler.showError('Warning',
278
                         'Room passwords are currently not supported.');
289
                         'Room passwords are currently not supported.');
290
+                    setSharedKey('');
279
 
291
 
280
                 }
292
                 }
281
             },
293
             },
284
                 messageHandler.showError('Lock failed',
296
                 messageHandler.showError('Lock failed',
285
                     'Failed to lock conference.',
297
                     'Failed to lock conference.',
286
                     err);
298
                     err);
299
+                setSharedKey('');
287
             }
300
             }
288
         );
301
         );
289
     },
302
     },

+ 4
- 3
toolbar.js 查看文件

204
         }
204
         }
205
     };
205
     };
206
     /**
206
     /**
207
-     * Updates the lock button state.
207
+     * Unlocks the lock button state.
208
      */
208
      */
209
-    my.updateLockButton = function() {
210
-        buttonClick("#lockIcon", "icon-security icon-security-locked");
209
+    my.unlockLockButton = function() {
210
+        if($("#lockIcon").hasClass("icon-security-locked"))
211
+            buttonClick("#lockIcon", "icon-security icon-security-locked");
211
     };
212
     };
212
     /**
213
     /**
213
      * Updates the lock button state to locked.
214
      * Updates the lock button state to locked.

Loading…
取消
儲存