Only set contact status offline if there aren't any other resources available.

This commit is contained in:
JC Brand 2015-04-13 17:02:14 +02:00
parent f399c5f681
commit 3451fcf01e

View File

@ -4040,7 +4040,11 @@
} else if (presence_type === 'subscribe') {
this.handleIncomingSubscription(jid);
} else if (presence_type === 'unavailable' && contact) {
contact.save({'chat_status': (contact.removeResource(resource) === 0) ? "offline" : chat_status});
// Only set the user to offline if there aren't any
// other resources still available.
if (contact.removeResource(resource) === 0) {
contact.save({'chat_status': "offline"});
}
} else if (contact) { // presence_type is undefined
this.addResource(bare_jid, resource);
contact.save({'chat_status': chat_status});