Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 32b84d6ef7e890f379cb50edf946a9db063e0260 1 parent 278614a
Massimiliano Mirra authored

Showing 1 changed file with 10 additions and 4 deletions. Show diff stats Hide diff stats

  1. +10 4 modules/main.jsm
14 modules/main.jsm
@@ -91,14 +91,20 @@ function loadServices() {
91 91 // time the application was closed.
92 92
93 93 function restoreOnlineState() {
94   - XMPP.accounts
95   - .forEach(function(account) {
  94 + var previouslyOnlineAccounts = XMPP.accounts
  95 + .filter(function(account) {
96 96 var history = JSON.parse(account.presenceHistory || '[]');
  97 + if(history.length === 0)
  98 + return false;
97 99
98 100 var lastPresenceStanza = new XML(history[history.length-1]);
99   - if(lastPresenceStanza.@type != 'unavailable')
100   - XMPP.up(account);
  101 + if(lastPresenceStanza.@type == 'unavailable')
  102 + return false;
  103 +
  104 + return true;
101 105 });
  106 +
  107 + previouslyOnlineAccounts.forEach(XMPP.up);
102 108 }
103 109
104 110

0 comments on commit 32b84d6

Please sign in to comment.
Something went wrong with that request. Please try again.