Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
bd81b897
Commit
bd81b897
authored
Jun 26, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure current resource is bound when manually calling `connection.bind`
parent
94306271
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
src/headless/converse-core.js
src/headless/converse-core.js
+11
-12
No files found.
src/headless/converse-core.js
View file @
bd81b897
...
...
@@ -525,10 +525,14 @@ async function initUserSession (jid) {
}
async
function
setUserJID
(
jid
)
{
jid
=
jid
.
toLowerCase
();
if
(
!
Strophe
.
getResourceFromJid
(
jid
))
{
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
;
}
jid
=
jid
.
toLowerCase
();
await
initUserSession
(
jid
);
_converse
.
jid
=
jid
;
_converse
.
bare_jid
=
Strophe
.
getBareJidFromJid
(
jid
);
...
...
@@ -545,6 +549,7 @@ async function setUserJID (jid) {
* @event _converse#setUserJID
*/
_converse
.
api
.
trigger
(
'
setUserJID
'
);
return
jid
;
}
...
...
@@ -1461,18 +1466,12 @@ _converse.api = {
return
;
}
}
let
credentials
;
if
(
jid
&&
password
)
{
credentials
=
{
jid
,
password
};
}
else
if
(
u
.
isValidJID
(
_converse
.
jid
)
&&
_converse
.
password
)
{
credentials
=
{
jid
:
_converse
.
jid
,
password
:
_converse
.
password
};
}
if
(
credentials
&&
credentials
.
jid
)
{
await
setUserJID
(
jid
||
_converse
.
jid
);
if
(
jid
||
_converse
.
jid
)
{
// Reassign because we might have gained a resource
jid
=
await
setUserJID
(
jid
||
_converse
.
jid
);
}
password
=
password
||
_converse
.
password
;
const
credentials
=
(
jid
&&
password
)
?
{
jid
,
password
}
:
null
;
_converse
.
attemptNonPreboundSession
(
credentials
,
reconnecting
);
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment