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
2f60c439
Commit
2f60c439
authored
May 12, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: Simplify`onDisconnected`
parent
2e6bfb67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
20 deletions
+22
-20
src/headless/converse-core.js
src/headless/converse-core.js
+22
-20
No files found.
src/headless/converse-core.js
View file @
2f60c439
...
...
@@ -1642,30 +1642,32 @@ function unregisterGlobalEventHandlers () {
* @memberOf _converse
*/
_converse
.
onDisconnected
=
function
()
{
const
reason
=
_converse
.
disconnection_reason
;
if
(
_converse
.
disconnection_cause
===
Strophe
.
Status
.
AUTHFAIL
)
{
if
(
api
.
settings
.
get
(
"
auto_reconnect
"
)
&&
(
api
.
settings
.
get
(
"
credentials_url
"
)
||
api
.
settings
.
get
(
"
authentication
"
)
===
_converse
.
ANONYMOUS
))
{
/**
* If `credentials_url` is set, we reconnect, because we might
* be receiving expirable tokens from the credentials_url.
*
* If `authentication` is anonymous, we reconnect because we
* might have tried to attach with stale BOSH session tokens
* or with a cached JID and password
*/
return
api
.
connection
.
reconnect
();
}
else
{
if
(
api
.
settings
.
get
(
"
auto_reconnect
"
))
{
const
reason
=
_converse
.
disconnection_reason
;
if
(
_converse
.
disconnection_cause
===
Strophe
.
Status
.
AUTHFAIL
)
{
if
(
api
.
settings
.
get
(
"
credentials_url
"
)
||
api
.
settings
.
get
(
"
authentication
"
)
===
_converse
.
ANONYMOUS
)
{
// If `credentials_url` is set, we reconnect, because we might
// be receiving expirable tokens from the credentials_url.
//
// If `authentication` is anonymous, we reconnect because we
// might have tried to attach with stale BOSH session tokens
// or with a cached JID and password
return
api
.
connection
.
reconnect
();
}
else
{
return
finishDisconnection
();
}
}
else
if
(
_converse
.
disconnection_cause
===
_converse
.
LOGOUT
||
reason
===
Strophe
.
ErrorCondition
.
NO_AUTH_MECH
||
reason
===
"
host-unknown
"
||
reason
===
"
remote-connection-failed
"
)
{
return
finishDisconnection
();
}
}
else
if
(
_converse
.
disconnection_cause
===
_converse
.
LOGOUT
||
(
reason
!==
undefined
&&
reason
===
Strophe
?.
ErrorCondition
.
NO_AUTH_MECH
)
||
reason
===
"
host-unknown
"
||
reason
===
"
remote-connection-failed
"
||
!
api
.
settings
.
get
(
"
auto_reconnect
"
))
{
api
.
connection
.
reconnect
();
}
else
{
return
finishDisconnection
();
}
api
.
connection
.
reconnect
();
};
...
...
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