Переглянути джерело

Throw error if more than one chatroom is given

JC Brand 8 роки тому
батько
коміт
30febd17d4
1 змінених файлів з 15 додано та 0 видалено
  1. 15 0
      src/converse-muc-embedded.js

+ 15 - 0
src/converse-muc-embedded.js

@@ -49,5 +49,20 @@
             }
         },
 
+        initialize: function () {
+            /* The initialize function gets called as soon as the plugin is
+             * loaded by converse.js's plugin machinery.
+             */
+            var _converse = this._converse;
+            if (!_.isArray(_converse.auto_join_rooms)) {
+                throw new Error("converse-muc-embedded: auto_join_rooms must be an Array");
+            }
+            if (_converse.auto_join_rooms.length !== 1) {
+                throw new Error("converse-muc-embedded: It doesn't make "+
+                    "sense to have the auto_join_rooms setting to zero or "+
+                    "more then one, since only one chat room can be open "+
+                    "at any time.")
+            }
+        }
     });
 }));