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
c1662c63
Commit
c1662c63
authored
Jan 31, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly disconnect upon "host-unknown" error.
parent
25e570c7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
docs/CHANGES.md
docs/CHANGES.md
+1
-0
src/converse-core.js
src/converse-core.js
+12
-9
No files found.
docs/CHANGES.md
View file @
c1662c63
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
-
Bugfix. Cancel button shown while registration form is being fetched wasn't working
-
Bugfix. Cancel button shown while registration form is being fetched wasn't working
properly. [jcbrand]
properly. [jcbrand]
-
Bugfix. Login form wasn't rendered after logging out (when
`auto_reconnect`
is
`true`
). [jcbrand]
-
Bugfix. Login form wasn't rendered after logging out (when
`auto_reconnect`
is
`true`
). [jcbrand]
-
Properly disconnect upon "host-unknown" error. [jcbrand]
## 2.0.4 (2016-12-13)
## 2.0.4 (2016-12-13)
-
#737: Bugfix. Translations weren't being applied. [jcbrand]
-
#737: Bugfix. Translations weren't being applied. [jcbrand]
...
...
src/converse-core.js
View file @
c1662c63
...
@@ -420,6 +420,7 @@
...
@@ -420,6 +420,7 @@
this
.
onDisconnected
=
function
(
condition
)
{
this
.
onDisconnected
=
function
(
condition
)
{
if
(
_
.
includes
([
converse
.
LOGOUT
,
Strophe
.
Status
.
AUTHFAIL
],
converse
.
disconnection_cause
)
||
if
(
_
.
includes
([
converse
.
LOGOUT
,
Strophe
.
Status
.
AUTHFAIL
],
converse
.
disconnection_cause
)
||
converse
.
disconnection_reason
===
"
host-unknown
"
||
!
converse
.
auto_reconnect
)
{
!
converse
.
auto_reconnect
)
{
return
this
.
disconnect
();
return
this
.
disconnect
();
}
}
...
@@ -435,9 +436,10 @@
...
@@ -435,9 +436,10 @@
return
'
reconnecting
'
;
return
'
reconnecting
'
;
};
};
this
.
setDisconnectionCause
=
function
(
connection_status
)
{
this
.
setDisconnectionCause
=
function
(
cause
,
reason
,
override
)
{
if
(
typeof
converse
.
disconnection_cause
===
"
undefined
"
)
{
if
(
_
.
isUndefined
(
converse
.
disconnection_cause
)
||
override
)
{
converse
.
disconnection_cause
=
connection_status
;
converse
.
disconnection_cause
=
cause
;
converse
.
disconnection_reason
=
reason
;
}
}
};
};
...
@@ -447,6 +449,7 @@
...
@@ -447,6 +449,7 @@
// By default we always want to send out an initial presence stanza.
// By default we always want to send out an initial presence stanza.
converse
.
send_initial_presence
=
true
;
converse
.
send_initial_presence
=
true
;
delete
converse
.
disconnection_cause
;
delete
converse
.
disconnection_cause
;
delete
converse
.
disconnection_reason
;
if
(
converse
.
connection
.
reconnecting
)
{
if
(
converse
.
connection
.
reconnecting
)
{
converse
.
log
(
status
===
Strophe
.
Status
.
CONNECTED
?
'
Reconnected
'
:
'
Reattached
'
);
converse
.
log
(
status
===
Strophe
.
Status
.
CONNECTED
?
'
Reconnected
'
:
'
Reattached
'
);
converse
.
onConnected
(
true
);
converse
.
onConnected
(
true
);
...
@@ -460,7 +463,7 @@
...
@@ -460,7 +463,7 @@
converse
.
onConnected
();
converse
.
onConnected
();
}
}
}
else
if
(
status
===
Strophe
.
Status
.
DISCONNECTED
)
{
}
else
if
(
status
===
Strophe
.
Status
.
DISCONNECTED
)
{
converse
.
setDisconnectionCause
(
status
);
converse
.
setDisconnectionCause
(
status
,
condition
);
converse
.
onDisconnected
(
condition
);
converse
.
onDisconnected
(
condition
);
}
else
if
(
status
===
Strophe
.
Status
.
ERROR
)
{
}
else
if
(
status
===
Strophe
.
Status
.
ERROR
)
{
converse
.
giveFeedback
(
converse
.
giveFeedback
(
...
@@ -474,11 +477,11 @@
...
@@ -474,11 +477,11 @@
}
else
if
(
status
===
Strophe
.
Status
.
AUTHFAIL
)
{
}
else
if
(
status
===
Strophe
.
Status
.
AUTHFAIL
)
{
converse
.
giveFeedback
(
__
(
'
Authentication failed.
'
),
'
error
'
);
converse
.
giveFeedback
(
__
(
'
Authentication failed.
'
),
'
error
'
);
converse
.
connection
.
disconnect
(
__
(
'
Authentication Failed
'
));
converse
.
connection
.
disconnect
(
__
(
'
Authentication Failed
'
));
converse
.
disconnection_cause
=
Strophe
.
Status
.
AUTHFAIL
;
converse
.
setDisconnectionCause
(
status
,
condition
,
true
)
;
}
else
if
(
status
===
Strophe
.
Status
.
CONNFAIL
)
{
}
else
if
(
status
===
Strophe
.
Status
.
CONNFAIL
)
{
converse
.
setDisconnectionCause
(
status
);
converse
.
setDisconnectionCause
(
status
,
condition
);
}
else
if
(
status
===
Strophe
.
Status
.
DISCONNECTING
)
{
}
else
if
(
status
===
Strophe
.
Status
.
DISCONNECTING
)
{
converse
.
setDisconnectionCause
(
status
);
converse
.
setDisconnectionCause
(
status
,
condition
);
if
(
condition
)
{
if
(
condition
)
{
converse
.
giveFeedback
(
converse
.
giveFeedback
(
__
(
"
Disconnected
"
),
'
warn
'
,
__
(
"
Disconnected
"
),
'
warn
'
,
...
@@ -541,7 +544,7 @@
...
@@ -541,7 +544,7 @@
this
.
logOut
=
function
()
{
this
.
logOut
=
function
()
{
converse
.
chatboxviews
.
closeAllChatBoxes
();
converse
.
chatboxviews
.
closeAllChatBoxes
();
converse
.
disconnection_cause
=
converse
.
LOGOUT
;
converse
.
setDisconnectionCause
(
converse
.
LOGOUT
,
undefined
,
true
)
;
if
(
typeof
converse
.
connection
!==
'
undefined
'
)
{
if
(
typeof
converse
.
connection
!==
'
undefined
'
)
{
converse
.
connection
.
disconnect
();
converse
.
connection
.
disconnect
();
}
}
...
@@ -1831,7 +1834,7 @@
...
@@ -1831,7 +1834,7 @@
throw
new
Error
(
"
initConnection: If you use auto_login and
"
+
throw
new
Error
(
"
initConnection: If you use auto_login and
"
+
"
authentication='login' then you also need to provide a password.
"
);
"
authentication='login' then you also need to provide a password.
"
);
}
}
converse
.
disconnection_cause
=
Strophe
.
Status
.
AUTHFAIL
;
converse
.
setDisconnectionCause
(
Strophe
.
Status
.
AUTHFAIL
,
undefined
,
true
)
;
converse
.
disconnect
();
converse
.
disconnect
();
return
;
return
;
}
}
...
...
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