Auto-reconnect when the connection drops.

This commit is contained in:
JC Brand 2013-05-31 21:53:49 +02:00
parent b350efa646
commit ba82f7bbce
2 changed files with 28 additions and 42 deletions

View File

@ -4,46 +4,28 @@ Changelog
0.4 (Unreleased) 0.4 (Unreleased)
---------------- ----------------
- CSS tweaks: fixed overflowing text in status message and chatrooms list. - CSS tweaks: fixed overflowing text in status message and chatrooms list. [jcbrand]
[jcbrand] - Bugfix: Couldn't join chatroom when clicking from a list of rooms. [jcbrand]
- Bugfix: Couldn't join chatroom when clicking from a list of rooms. - Add better support for kicking or banning users from chatrooms. [jcbrand]
[jcbrand] - Fixed alignment of chat messages in Firefox. [jcbrand]
- Add better support for kicking or banning users from chatrooms. - More intelligent fetching of vCards. [jcbrand]
[jcbrand] - Fixed a race condition bug. Make sure that the roster is populated before sending initial presence. [jcbrand]
- Fixed alignment of chat messages in Firefox. - Reconnect automatically when the connection drops. [jcbrand]
[jcbrand]
- More intelligent fetching of vCards.
[jcbrand]
- Fixed a race condition bug. Make sure that the roster is populated before
sending initial presence.
[jcbrand]
0.3 (2013-05-21) 0.3 (2013-05-21)
---------------- ----------------
- Add vCard support - Add vCard support [jcbrand]
[jcbrand] - Remember custom status messages upon reload. [jcbrand]
- Remember custom status messages upon reload. - Remove jquery-ui dependency. [jcbrand]
[jcbrand] - Use backbone.localStorage to store the contacts roster, open chatboxes and chat messages. [jcbrand]
- Remove jquery-ui dependency. - Fixed user status handling, which wasn't 100% according to the spec. [jcbrand]
[jcbrand] - Separate messages according to day in chats. [jcbrand]
- Use backbone.localStorage to store the contacts roster, open chatboxes and - Add support for specifying the BOSH bind URL as configuration setting. [jcbrand]
chat messages. - Improve the message counter to only increment when the window is not focused [witekdev]
[jcbrand] - Make fetching of list of chatrooms on a server a configuration option. [jcbrand]
- Fixed user status handling, which wasn't 100% according to the spec. - Use service discovery to show all available features on a room. [jcbrand]
[jcbrand] - Multi-user chatrooms are now configurable. [jcbrand]
- Separate messages according to day in chats.
[jcbrand]
- Add support for specifying the BOSH bind URL as configuration setting.
[jcbrand]
- Improve the message counter to only increment when the window is not focused
[witekdev]
- Make fetching of list of chatrooms on a server a configuration option.
[jcbrand]
- Use service discovery to show all available features on a room.
[jcbrand]
- Multi-user chatrooms are now configurable.
[jcbrand]
0.2 (2013-03-28) 0.2 (2013-03-28)

View File

@ -2464,28 +2464,32 @@
'<input type="text" id="bosh_service_url">'), '<input type="text" id="bosh_service_url">'),
connect: function ($form, jid, password) { connect: function ($form, jid, password) {
var $button = $form.find('input[type=submit]'), var button = null,
connection = new Strophe.Connection(converse.bosh_service_url); connection = new Strophe.Connection(converse.bosh_service_url);
$button.hide().after('<img class="spinner login-submit" src="images/spinner.gif"/>'); if ($form) {
$button = $form.find('input[type=submit]');
$button.hide().after('<img class="spinner login-submit" src="images/spinner.gif"/>');
}
connection.connect(jid, password, $.proxy(function (status, message) { connection.connect(jid, password, $.proxy(function (status, message) {
if (status === Strophe.Status.CONNECTED) { if (status === Strophe.Status.CONNECTED) {
console.log('Connected'); console.log('Connected');
converse.onConnected(connection); converse.onConnected(connection);
} else if (status === Strophe.Status.DISCONNECTED) { } else if (status === Strophe.Status.DISCONNECTED) {
$button.show().siblings('img').remove(); if ($button) { $button.show().siblings('img').remove(); }
converse.giveFeedback('Disconnected', 'error'); converse.giveFeedback('Disconnected', 'error');
this.connect(null, connection.jid, connection.pass);
} else if (status === Strophe.Status.Error) { } else if (status === Strophe.Status.Error) {
$button.show().siblings('img').remove(); if ($button) { $button.show().siblings('img').remove(); }
converse.giveFeedback('Error', 'error'); converse.giveFeedback('Error', 'error');
} else if (status === Strophe.Status.CONNECTING) { } else if (status === Strophe.Status.CONNECTING) {
converse.giveFeedback('Connecting'); converse.giveFeedback('Connecting');
} else if (status === Strophe.Status.CONNFAIL) { } else if (status === Strophe.Status.CONNFAIL) {
$button.show().siblings('img').remove(); if ($button) { $button.show().siblings('img').remove(); }
converse.giveFeedback('Connection Failed', 'error'); converse.giveFeedback('Connection Failed', 'error');
} else if (status === Strophe.Status.AUTHENTICATING) { } else if (status === Strophe.Status.AUTHENTICATING) {
converse.giveFeedback('Authenticating'); converse.giveFeedback('Authenticating');
} else if (status === Strophe.Status.AUTHFAIL) { } else if (status === Strophe.Status.AUTHFAIL) {
$button.show().siblings('img').remove(); if ($button) { $button.show().siblings('img').remove(); }
converse.giveFeedback('Authentication Failed', 'error'); converse.giveFeedback('Authentication Failed', 'error');
} else if (status === Strophe.Status.DISCONNECTING) { } else if (status === Strophe.Status.DISCONNECTING) {
converse.giveFeedback('Disconnecting', 'error'); converse.giveFeedback('Disconnecting', 'error');