Permalink
Browse files

Main service: re-enabled restoration of last online state.

  • Loading branch information...
1 parent 278614a commit 32b84d6ef7e890f379cb50edf946a9db063e0260 @bard committed Apr 20, 2009
Showing with 10 additions and 4 deletions.
  1. +10 −4 modules/main.jsm
View
@@ -91,14 +91,20 @@ function loadServices() {
// time the application was closed.
function restoreOnlineState() {
- XMPP.accounts
- .forEach(function(account) {
+ var previouslyOnlineAccounts = XMPP.accounts
+ .filter(function(account) {
var history = JSON.parse(account.presenceHistory || '[]');
+ if(history.length === 0)
+ return false;
var lastPresenceStanza = new XML(history[history.length-1]);
- if(lastPresenceStanza.@type != 'unavailable')
- XMPP.up(account);
+ if(lastPresenceStanza.@type == 'unavailable')
+ return false;
+
+ return true;
});
+
+ previouslyOnlineAccounts.forEach(XMPP.up);
}

0 comments on commit 32b84d6

Please sign in to comment.