Browse Source

Disable vcard plugin is `use_vcard` is false

JC Brand 7 years ago
parent
commit
c8f72b350b
2 changed files with 6 additions and 5 deletions
  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: {
                 events: {
                     'click a.chatbox-btn.add-contact': 'showAddContactModal',
                     'click a.chatbox-btn.add-contact': 'showAddContactModal',
-
                 },
                 },
 
 
                 initialize () {
                 initialize () {

+ 6 - 4
src/converse-vcard.js

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