Explorar el Código

Disable vcard plugin is `use_vcard` is false

JC Brand hace 7 años
padre
commit
c8f72b350b
Se han modificado 2 ficheros con 6 adiciones y 5 borrados
  1. 0 1
      src/converse-rosterview.js
  2. 6 4
      src/converse-vcard.js

+ 0 - 1
src/converse-rosterview.js

@@ -730,7 +730,6 @@
 
                 events: {
                     'click a.chatbox-btn.add-contact': 'showAddContactModal',
-
                 },
 
                 initialize () {

+ 6 - 4
src/converse-vcard.js

@@ -97,6 +97,11 @@
 
     converse.plugins.add('converse-vcard', {
 
+        enabled (_converse) {
+            _converse.api.settings.update({'use_vcards': true});
+            return _converse.use_vcards;
+        },
+
         overrides: {
             // Overrides mentioned here will be picked up by converse.js's
             // plugin architecture they will replace existing methods on the
@@ -126,7 +131,6 @@
              * loaded by converse.js's plugin machinery.
              */
             const { _converse } = this;
-            _converse.api.settings.update({'use_vcards': true});
 
             _converse.createRequestingContactFromVCard = function (presence, vcard) {
                 const bare_jid = Strophe.getBareJidFromJid(presence.getAttribute('from'));
@@ -152,9 +156,7 @@
 
             /* Event handlers */
             _converse.on('addClientFeatures', () => {
-                if (_converse.use_vcards) {
-                    _converse.connection.disco.addFeature(Strophe.NS.VCARD);
-                }
+                _converse.connection.disco.addFeature(Strophe.NS.VCARD);
             });
 
             _converse.on('chatBoxInitialized', (chatbox) => {