소스 검색

Immediately hide chat room on close.

Also, use sendPresence from latest strophe so that we have a timeout in case a
responding presence never comes.
JC Brand 8 년 전
부모
커밋
088eb03b54
2개의 변경된 파일6개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 1
      package.json
  2. 5 6
      src/converse-muc.js

+ 1 - 1
package.json

@@ -57,7 +57,7 @@
     "po2json": "^0.4.4",
     "requirejs": "2.3.2",
     "requirejs-undertemplate": "~0.0.4",
-    "strophe.js": "1.2.10",
+    "strophe.js": "https://github.com/strophe/strophejs#4eeee581da8789d7c5ae0096496f2a6533ec7d74",
     "snyk": "^1.21.2",
     "strophejs-plugins": "0.0.7",
     "text": "requirejs/text#2.0.15",

+ 5 - 6
src/converse-muc.js

@@ -876,30 +876,29 @@
                      *  (String) exit_msg: Optional message to indicate your
                      *      reason for leaving.
                      */
+                    this.hide();
                     this.occupantsview.model.reset();
                     this.occupantsview.model.browserStorage._clear();
-
                     if (!converse.connection.connected ||
                             this.model.get('connection_status') === Strophe.Status.DISCONNECTED) {
                         // Don't send out a stanza if we're not connected.
                         this.cleanup();
                         return;
                     }
-                    var presenceid = converse.connection.getUniqueId();
                     var presence = $pres({
                         type: "unavailable",
-                        id: presenceid,
                         from: converse.connection.jid,
                         to: this.getRoomJIDAndNick()
                     });
                     if (exit_msg !== null) {
                         presence.c("status", exit_msg);
                     }
-                    converse.connection.addHandler(
+                    converse.connection.sendPresence(
+                        presence,
+                        this.cleanup.bind(this),
                         this.cleanup.bind(this),
-                        null, "presence", null, presenceid
+                        2000
                     );
-                    converse.connection.send(presence);
                 },
 
                 renderConfigurationForm: function (stanza) {