Cache vCard retrieval.
We still need a cache invalidation mechanism. Currently PEP event notifications look most promising. http://xmpp.org/extensions/xep-0163.html http://xmpp.org/extensions/xep-0292.html#self-pubsub
This commit is contained in:
parent
219089d261
commit
e9916ec912
16
converse.js
16
converse.js
@ -701,7 +701,6 @@
|
|||||||
$target.parent().remove();
|
$target.parent().remove();
|
||||||
$('form.search-xmpp-contact').hide();
|
$('form.search-xmpp-contact').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
xmppchat.RoomsPanel = Backbone.View.extend({
|
xmppchat.RoomsPanel = Backbone.View.extend({
|
||||||
@ -1363,7 +1362,19 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
xmppchat.getVCard = function (jid, callback) {
|
xmppchat.getVCard = function (jid, callback) {
|
||||||
// TODO: cache vcards
|
/* First we check if we don't already have a RosterItem, since it will
|
||||||
|
* contain all the vCard details.
|
||||||
|
*/
|
||||||
|
var model = xmppchat.roster.getItem(jid);
|
||||||
|
if (model) {
|
||||||
|
callback(
|
||||||
|
model.get('jid'),
|
||||||
|
model.get('fullname'),
|
||||||
|
model.get('image'),
|
||||||
|
model.get('image_type'),
|
||||||
|
model.get('url')
|
||||||
|
)
|
||||||
|
} else {
|
||||||
xmppchat.connection.vcard.get($.proxy(function (iq) {
|
xmppchat.connection.vcard.get($.proxy(function (iq) {
|
||||||
$vcard = $(iq).find('vCard');
|
$vcard = $(iq).find('vCard');
|
||||||
var fullname = $vcard.find('FN').text(),
|
var fullname = $vcard.find('FN').text(),
|
||||||
@ -1373,6 +1384,7 @@
|
|||||||
callback(jid, fullname, img, img_type, url);
|
callback(jid, fullname, img, img_type, url);
|
||||||
}, this), jid)
|
}, this), jid)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
xmppchat.RosterItems = Backbone.Collection.extend({
|
xmppchat.RosterItems = Backbone.Collection.extend({
|
||||||
localStorage: new Backbone.LocalStorage("conversejs.rosterItems"),
|
localStorage: new Backbone.LocalStorage("conversejs.rosterItems"),
|
||||||
|
Loading…
Reference in New Issue
Block a user