Ver código fonte

Move VCard stuff from converse-rosterview to converse-vcard

JC Brand 9 anos atrás
pai
commit
302c8d42d8
2 arquivos alterados com 12 adições e 5 exclusões
  1. 0 5
      src/converse-rosterview.js
  2. 12 0
      src/converse-vcard.js

+ 0 - 5
src/converse-rosterview.js

@@ -286,11 +286,6 @@
 
                 onContactAdd: function (contact) {
                     this.addRosterContact(contact).update();
-                    if (!contact.get('vcard_updated')) {
-                        // This will update the vcard, which triggers a change
-                        // request which will rerender the roster contact.
-                        converse.getVCard(contact.get('jid'));
-                    }
                 },
 
                 onContactChange: function (contact) {

+ 12 - 0
src/converse-vcard.js

@@ -158,6 +158,18 @@
             };
             converse.on('chatBoxInitialized', updateVCardForChatBox);
 
+
+            var onContactAdd = function (contact) {
+                if (!contact.get('vcard_updated')) {
+                    // This will update the vcard, which triggers a change
+                    // request which will rerender the roster contact.
+                    converse.getVCard(contact.get('jid'));
+                }
+            };
+            converse.on('initialized', function () {
+                converse.roster.on("add", onContactAdd);
+            });
+
             var fetchOwnVCard = function () {
                 if (converse.xmppstatus.get('fullname') === undefined) {
                     converse.getVCard(