فهرست منبع

Move code into removeRoom method for reuse

JC Brand 12 سال پیش
والد
کامیت
2893657576
1فایلهای تغییر یافته به همراه9 افزوده شده و 5 حذف شده
  1. 9 5
      Libraries/strophe.muc.js

+ 9 - 5
Libraries/strophe.muc.js

@@ -117,6 +117,14 @@
             return this._connection.send(msg);
             return this._connection.send(msg);
         },
         },
 
 
+        removeRoom: function (room) {
+            delete this.rooms[room];
+            if (this.rooms.length === 0) {
+                this._connection.deleteHandler(this._muc_handler);
+                this._muc_handler = null;
+            }
+        },
+
         leave: function(room, nick, handler_cb, exit_msg) {
         leave: function(room, nick, handler_cb, exit_msg) {
             /*  Leave a multi-user chat room
             /*  Leave a multi-user chat room
              *
              *
@@ -129,11 +137,7 @@
              *  iqid - The unique id for the room leave.
              *  iqid - The unique id for the room leave.
              */
              */
             var presence, presenceid, room_nick;
             var presence, presenceid, room_nick;
-            delete this.rooms[room];
-            if (this.rooms.length === 0) {
-                this._connection.deleteHandler(this._muc_handler);
-                this._muc_handler = null;
-            }
+            this.removeRoom(room);
             room_nick = this.test_append_nick(room, nick);
             room_nick = this.test_append_nick(room, nick);
             presenceid = this._connection.getUniqueId();
             presenceid = this._connection.getUniqueId();
             presence = $pres({
             presence = $pres({