Explorar o código

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

JC Brand %!s(int64=10) %!d(string=hai) anos
pai
achega
3f01e94b9b
Modificáronse 2 ficheiros con 12 adicións e 5 borrados
  1. 11 5
      converse.js
  2. 1 0
      docs/CHANGES.rst

+ 11 - 5
converse.js

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

+ 1 - 0
docs/CHANGES.rst

@@ -14,6 +14,7 @@ Changelog
   any prebind session tokens. [jcbrand]
 * #46 Refactor the API and add new methods. [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]
 * #237 Unable to create room when ``hide_muc_server`` is ``true``. [jcbrand]
 * #238 Rooms are not shown when ``hide_offline_users`` is ``true``. [jcbrand]