浏览代码

Always set JID on the connection

So that the resource is passed along when we manually bind.

Related to bd81b897240aa83bd36ed0a6dc898c0c8cf5d97f
JC Brand 6 年之前
父节点
当前提交
ec68dc1cf0
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      src/headless/converse-core.js

+ 5 - 5
src/headless/converse-core.js

@@ -528,14 +528,14 @@ async function initUserSession (jid) {
 async function setUserJID (jid) {
 async function setUserJID (jid) {
     await initUserSession(jid);
     await initUserSession(jid);
     jid = _converse.session.get('jid') || jid;
     jid = _converse.session.get('jid') || jid;
-
     if (!Strophe.getResourceFromJid(jid)) {
     if (!Strophe.getResourceFromJid(jid)) {
         jid = jid.toLowerCase() + _converse.generateResource();
         jid = jid.toLowerCase() + _converse.generateResource();
-        // Set JID on the connection object so that when we call
-        // `connection.bind` the new resource is found by Strophe.js
-        // and sent to the XMPP server.
-        _converse.connection.jid = jid;
     }
     }
+    // Set JID on the connection object so that when we call
+    // `connection.bind` the new resource is found by Strophe.js
+    // and sent to the XMPP server.
+    _converse.connection.jid = jid;
+
     _converse.jid = jid;
     _converse.jid = jid;
     _converse.bare_jid = Strophe.getBareJidFromJid(jid);
     _converse.bare_jid = Strophe.getBareJidFromJid(jid);
     _converse.resource = Strophe.getResourceFromJid(jid);
     _converse.resource = Strophe.getResourceFromJid(jid);