Replace another server call with VCard.

This time when a message is received for the first time.
This commit is contained in:
JC Brand 2013-03-05 09:33:29 +02:00
parent 121fab13a8
commit 8f697923f2

View File

@ -1192,11 +1192,9 @@
if ($forwarded.length) { if ($forwarded.length) {
$message = $forwarded.children('message'); $message = $forwarded.children('message');
} }
var from = Strophe.getBareJidFromJid(message_from), var from = Strophe.getBareJidFromJid(message_from),
to = Strophe.getBareJidFromJid($message.attr('to')), to = Strophe.getBareJidFromJid($message.attr('to')),
view, resource; view, resource;
if (from == xmppchat.connection.bare_jid) { if (from == xmppchat.connection.bare_jid) {
// I am the sender, so this must be a forwarded message... // I am the sender, so this must be a forwarded message...
partner_jid = to; partner_jid = to;
@ -1208,9 +1206,14 @@
view = this.views[partner_jid]; view = this.views[partner_jid];
if (!view) { if (!view) {
// FIXME Should use VCard xmppchat.getVCard(partner_jid, $.proxy(function (jid, fullname, img, img_type, url) {
$.getJSON(portal_url + "/xmpp-userinfo?user_id=" + Strophe.getNodeFromJid(partner_jid), $.proxy(function (data) { view = this.createChatBox({
view = this.createChatBox(partner_jid, data); 'jid': jid,
'fullname': fullname,
'image': img,
'image_type': img_type,
'url': url,
})
view.messageReceived(message); view.messageReceived(message);
xmppchat.roster.addResource(partner_jid, resource); xmppchat.roster.addResource(partner_jid, resource);
}, this)); }, this));