Browse Source

fix(xmpp.js): User id format

dev1
hristoterezov 9 years ago
parent
commit
66bdeb6bf2
1 changed files with 3 additions and 4 deletions
  1. 3
    4
      modules/xmpp/xmpp.js

+ 3
- 4
modules/xmpp/xmpp.js View File

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

Loading…
Cancel
Save