浏览代码

Split showChat into two methods to allow easier overriding.

JC Brand 9 年之前
父节点
当前提交
eb3252542e
共有 1 个文件被更改,包括 9 次插入4 次删除
  1. 9 4
      src/converse-core.js

+ 9 - 4
src/converse-core.js

@@ -1398,10 +1398,7 @@
                 return this.model.chatBoxMayBeShown(chatbox);
             },
 
-            showChat: function (attrs) {
-                /* Find the chat box and show it (if it may be shown).
-                 * If it doesn't exist, create it.
-                 */
+            getChatBox: function (attrs) {
                 var chatbox  = this.model.get(attrs.jid);
                 if (!chatbox) {
                     chatbox = this.model.create(attrs, {
@@ -1410,6 +1407,14 @@
                         }
                     });
                 }
+                return chatbox;
+            },
+
+            showChat: function (attrs) {
+                /* Find the chat box and show it (if it may be shown).
+                 * If it doesn't exist, create it.
+                 */
+                var chatbox = this.getChatBox(attrs);
                 if (this.chatBoxMayBeShown(chatbox)) {
                     chatbox.trigger('show', true);
                 }