浏览代码

Fetch the user's vcard when you subscribe to them

JC Brand 12 年之前
父节点
当前提交
cb2dab38fd
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. 10 2
      converse.js

+ 10 - 2
converse.js

@@ -654,7 +654,15 @@
 
         addContactFromForm: function (ev) {
             ev.preventDefault();
-            this.addContact($(ev.target).find('input').val());
+            converse.getVCard(
+                $(ev.target).find('input').val(),
+                $.proxy(function (jid, fullname, image, image_type, url) {
+                    // XXX: Should we perhaps create a roster item here?
+                    this.addContact(jid, fullname);
+                }, this),
+                $.proxy(function () {
+                    console.log("An error occured while fetching vcard");
+                }, this));
             $('.search-xmpp').hide();
         },
 
@@ -1428,7 +1436,7 @@
                         jid: item.jid,
                         subscription: item.subscription,
                         ask: item.ask,
-                        fullname: item.name,
+                        fullname: item.name || item.jid,
                         is_last: is_last
                     });
                 } else {