소스 검색

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,8 +1413,6 @@ function lockRoom(lock) {
1413 1413
         connection.emuc.lockRoom(sharedKey);
1414 1414
     else
1415 1415
         connection.emuc.lockRoom('');
1416
-
1417
-    Toolbar.updateLockButton();
1418 1416
 }
1419 1417
 
1420 1418
 /**

+ 14
- 1
muc.js 파일 보기

@@ -263,19 +263,31 @@ Strophe.addConnectionPlugin('emuc', {
263 263
                     // FIXME: is muc#roomconfig_passwordprotectedroom required?
264 264
                     this.connection.sendIQ(formsubmit,
265 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 278
                         function (err) {
269 279
                             console.warn('setting password failed', err);
270 280
                             messageHandler.showError('Lock failed',
271 281
                                 'Failed to lock conference.',
272 282
                                 err);
283
+                            setSharedKey('');
273 284
                         }
274 285
                     );
275 286
                 } else {
276 287
                     console.warn('room passwords not supported');
277 288
                     messageHandler.showError('Warning',
278 289
                         'Room passwords are currently not supported.');
290
+                    setSharedKey('');
279 291
 
280 292
                 }
281 293
             },
@@ -284,6 +296,7 @@ Strophe.addConnectionPlugin('emuc', {
284 296
                 messageHandler.showError('Lock failed',
285 297
                     'Failed to lock conference.',
286 298
                     err);
299
+                setSharedKey('');
287 300
             }
288 301
         );
289 302
     },

+ 4
- 3
toolbar.js 파일 보기

@@ -204,10 +204,11 @@ var Toolbar = (function (my) {
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 214
      * Updates the lock button state to locked.

Loading…
취소
저장