浏览代码

fix(xmpp.js): User id format

dev1
hristoterezov 9 年前
父节点
当前提交
66bdeb6bf2
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3
    4
      modules/xmpp/xmpp.js

+ 3
- 4
modules/xmpp/xmpp.js 查看文件

@@ -17,8 +17,6 @@ import initPing from "./strophe.ping";
17 17
 import initRayo from "./strophe.rayo";
18 18
 import initStropheLogger from "./strophe.logger";
19 19
 
20
-let authenticatedUser = true;
21
-
22 20
 function createConnection(token, bosh = '/http-bind') {
23 21
     // Append token as URL param
24 22
     if (token) {
@@ -38,6 +36,7 @@ export default class XMPP {
38 36
         this.options = options;
39 37
         this.connectParams = {};
40 38
         this.token = token;
39
+        this.authenticatedUser = false;
41 40
         this._initStrophePlugins(this);
42 41
 
43 42
         this.connection = createConnection(token, options.bosh);
@@ -130,7 +129,7 @@ export default class XMPP {
130 129
                 }.bind(this));
131 130
 
132 131
             if (password)
133
-                authenticatedUser = true;
132
+                this.authenticatedUser = true;
134 133
             if (this.connection && this.connection.connected &&
135 134
                 Strophe.getResourceFromJid(this.connection.jid)) {
136 135
                 // .connected is true while connecting?
@@ -247,7 +246,7 @@ export default class XMPP {
247 246
         let roomjid = roomName  + "@" + this.options.hosts.muc + "/";
248 247
 
249 248
         roomjid += (options.useNicks)? options.nick || tmpJid :
250
-            (authenticatedUser? "-" + RandomUtil.randomHexString(6):
249
+            (this.authenticatedUser? "-" + RandomUtil.randomHexString(6):
251 250
                 tmpJid.substr(0, 8));
252 251
         return this.connection.emuc.createRoom(roomjid, null, options,
253 252
             settings);

正在加载...
取消
保存