Explorar el Código

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

master
Damian Minkov hace 11 años
padre
commit
5ce2ce8db6
Se han modificado 3 ficheros con 18 adiciones y 6 borrados
  1. 0
    2
      app.js
  2. 14
    1
      muc.js
  3. 4
    3
      toolbar.js

+ 0
- 2
app.js Ver fichero

@@ -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 Ver fichero

@@ -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 Ver fichero

@@ -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…
Cancelar
Guardar