From 1d9dda374bcaca1ca9b3760082e900e77e8a7fe7 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Fri, 10 May 2013 10:00:25 +0200 Subject: [PATCH] Fetch own vcard on startup --- converse.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/converse.js b/converse.js index d4bfd6f7d..c00647f73 100644 --- a/converse.js +++ b/converse.js @@ -2113,8 +2113,8 @@ converse.onConnected = function (connection) { this.connection = connection; - this.connection.xmlInput = function (body) { console.log(body); }; - this.connection.xmlOutput = function (body) { console.log(body); }; + // this.connection.xmlInput = function (body) { console.log(body); }; + // this.connection.xmlOutput = function (body) { console.log(body); }; this.bare_jid = Strophe.getBareJidFromJid(this.connection.jid); this.domain = Strophe.getDomainFromJid(this.connection.jid); this.features = new this.Features(); @@ -2132,7 +2132,17 @@ this.rosterview = new this.RosterView({'model':this.roster}); this.xmppstatusview = new this.XMPPStatusView({'model': this.xmppstatus}).render(); - this.xmppstatus.fetch(); + this.xmppstatus.fetch({ + success: $.proxy(function (xmppstatus, resp) { + if (!xmppstatus.get('fullname')) { + this.getVCard( + null, // No 'to' attr when getting one's own vCard + $.proxy(function (jid, fullname, image, image_type, url) { + this.xmppstatus.set({'fullname': fullname}); + }, this)); + } + }, this) + }); this.connection.addHandler( $.proxy(this.roster.subscribeToSuggestedItems, this.roster),