Make the fetching of VCards optional. Updates #100
This commit is contained in:
parent
7b2d16afbc
commit
cbde2a1d49
23
converse.js
23
converse.js
@ -87,6 +87,7 @@
|
||||
this.show_only_online_users = false;
|
||||
this.show_emoticons = true;
|
||||
this.show_toolbar = true;
|
||||
this.use_vcards = true;
|
||||
this.xhr_custom_status = false;
|
||||
this.xhr_custom_status_url = '';
|
||||
this.xhr_user_search = false;
|
||||
@ -114,6 +115,7 @@
|
||||
'show_only_online_users',
|
||||
'show_toolbar',
|
||||
'sid',
|
||||
'use_vcards',
|
||||
'xhr_custom_status',
|
||||
'xhr_custom_status_url',
|
||||
'xhr_user_search',
|
||||
@ -205,6 +207,12 @@
|
||||
};
|
||||
|
||||
this.getVCard = function (jid, callback, errback) {
|
||||
if (!this.use_vcards) {
|
||||
if (callback) {
|
||||
callback(jid, jid);
|
||||
}
|
||||
return;
|
||||
}
|
||||
converse.connection.vcard.get(
|
||||
$.proxy(function (iq) {
|
||||
// Successful callback
|
||||
@ -242,7 +250,8 @@
|
||||
if (errback) {
|
||||
errback(iq);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
this.onConnect = function (status) {
|
||||
@ -1384,16 +1393,7 @@
|
||||
$input.addClass('error');
|
||||
return;
|
||||
}
|
||||
converse.getVCard(
|
||||
jid,
|
||||
$.proxy(function (jid, fullname, image, image_type, url) {
|
||||
this.addContact(jid, fullname);
|
||||
}, this),
|
||||
$.proxy(function (stanza) {
|
||||
converse.log("An error occured while fetching vcard");
|
||||
var jid = $(stanza).attr('from');
|
||||
this.addContact(jid, jid);
|
||||
}, this));
|
||||
this.addContact(jid);
|
||||
$('.search-xmpp').hide();
|
||||
},
|
||||
|
||||
@ -1408,6 +1408,7 @@
|
||||
},
|
||||
|
||||
addContact: function (jid, name) {
|
||||
name = _.isEmpty(name)? jid: name;
|
||||
converse.connection.roster.add(jid, name, [], function (iq) {
|
||||
converse.connection.roster.subscribe(jid, null, converse.xmppstatus.get('fullname'));
|
||||
});
|
||||
|
@ -5,6 +5,7 @@ Changelog
|
||||
------------------
|
||||
|
||||
* #48 Add event emitter support and emit events. [jcbrand]
|
||||
* #100 Make the fetching of vCards optional (enabled by default). [jcbrand]
|
||||
|
||||
0.7.1 (2013-11-17)
|
||||
------------------
|
||||
|
@ -815,6 +815,15 @@ Default = ``false``
|
||||
If set to ``true``, only online users will be shown in the contacts roster.
|
||||
Users with any other status (e.g. away, busy etc.) will not be shown.
|
||||
|
||||
use_vcards
|
||||
----------
|
||||
|
||||
Default = ``true``
|
||||
|
||||
Determines whether the XMPP server will be queried for roster contacts' VCards
|
||||
or not. VCards contain extra personal information such as your fullname and
|
||||
avatar image.
|
||||
|
||||
xhr_custom_status
|
||||
-----------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user