소스 검색

If another resource changes it's status, change this one as well.

This is necessary because each open tab in the browser is its own resource.

TODO: Ideally we should differentiate between resources in the browser (using
converse.js) and other resources (i.e from a desktop client).
JC Brand 12 년 전
부모
커밋
36491699ee
1개의 변경된 파일11개의 추가작업 그리고 5개의 파일을 삭제
  1. 11 5
      converse.js

+ 11 - 5
converse.js

@@ -1329,18 +1329,24 @@
                 status_message = $(presence).find('status'),
                 item, model;
 
-            if ((($(presence).find('x').attr('xmlns') || '').indexOf(Strophe.NS.MUC) === 0) || (this.isSelf(bare_jid))) {
-                // Ignore MUC or self-addressed stanzas
+            if (this.isSelf(bare_jid)) {
+                if (xmppchat.connection.jid != jid) {
+                    // Another resource has changed it's status, we'll update ours as well.
+                    // FIXME: We should ideally differentiate between converse.js using 
+                    // resources and other resources (i.e Pidgin etc.)
+                    xmppchat.xmppstatus.set({'status': presence_type});
+                } 
                 return true;
+            } else if (($(presence).find('x').attr('xmlns') || '').indexOf(Strophe.NS.MUC) === 0) {
+                return true; // Ignore MUC 
             }
+
             if ((status_message.length > 0) && (status_message.text() && (presence_type !== 'unavailable'))) {
                 model = this.getItem(bare_jid);
                 model.set({'status': status_message.text()});
             }
 
-            if ((presence_type === 'error') || 
-                    (presence_type === 'subscribed') || 
-                    (presence_type === 'unsubscribe')) {
+            if ((presence_type === 'error') || (presence_type === 'subscribed') || (presence_type === 'unsubscribe')) {
                 return true;
 
             } else if (presence_type === 'subscribe') {