Fixes #177 Setting status to 'offline' does nothing in other clients.

This commit is contained in:
JC Brand 2014-11-15 16:09:36 +01:00
parent efa56ffb33
commit 3f01e94b9b
2 changed files with 12 additions and 5 deletions

View File

@ -3509,7 +3509,7 @@
idx = _.indexOf(resources, resource); idx = _.indexOf(resources, resource);
if (idx !== -1) { if (idx !== -1) {
resources.splice(idx, 1); resources.splice(idx, 1);
item.set({'resources': resources}); item.save({'resources': resources});
return resources.length; return resources.length;
} }
} }
@ -3721,9 +3721,10 @@
this.unsubscribe(bare_jid); this.unsubscribe(bare_jid);
} else if (presence_type === 'unavailable') { } else if (presence_type === 'unavailable') {
if (this.removeResource(bare_jid, resource) === 0) { if (this.removeResource(bare_jid, resource) === 0) {
if (contact) { chat_status = "offline";
contact.save({'chat_status': 'offline'}); }
} if (contact && chat_status) {
contact.save({'chat_status': chat_status});
} }
} else if (contact) { } else if (contact) {
// presence_type is undefined // presence_type is undefined
@ -4322,7 +4323,12 @@
(type === 'unsubscribed') || (type === 'unsubscribed') ||
(type === 'subscribe') || (type === 'subscribe') ||
(type === 'subscribed')) { (type === 'subscribed')) {
presence = $pres({'type':type}); presence = $pres({'type': type});
} else if (type === 'offline') {
presence = $pres({'type': 'unavailable'});
if (status_message) {
presence.c('show').t(type);
}
} else { } else {
if (type === 'online') { if (type === 'online') {
presence = $pres(); presence = $pres();

View File

@ -14,6 +14,7 @@ Changelog
any prebind session tokens. [jcbrand] any prebind session tokens. [jcbrand]
* #46 Refactor the API and add new methods. [jcbrand] * #46 Refactor the API and add new methods. [jcbrand]
* #151 Browser locks/freezes with many roster users. [jcbrand] * #151 Browser locks/freezes with many roster users. [jcbrand]
* #177 Setting status to offline does nothing. [jcbrand]
* #232 Always get full name from model. [jcbrand] * #232 Always get full name from model. [jcbrand]
* #237 Unable to create room when ``hide_muc_server`` is ``true``. [jcbrand] * #237 Unable to create room when ``hide_muc_server`` is ``true``. [jcbrand]
* #238 Rooms are not shown when ``hide_offline_users`` is ``true``. [jcbrand] * #238 Rooms are not shown when ``hide_offline_users`` is ``true``. [jcbrand]