Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
Main service: re-enabled restoration of last online state.
Browse files Browse the repository at this point in the history
  • Loading branch information
bard committed Apr 20, 2009
1 parent 278614a commit 32b84d6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions modules/main.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down

0 comments on commit 32b84d6

Please sign in to comment.