From 6de997681b998a4f09635b20726c812714a51e10 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sat, 20 Apr 2013 15:13:42 +0200 Subject: [PATCH] Fetch the user's vcard when you subscribe to them --- converse.css | 20 +++++++++++++++++--- converse.js | 9 ++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/converse.css b/converse.css index 0d8e29e2e..6549c1dd4 100644 --- a/converse.css +++ b/converse.css @@ -182,6 +182,10 @@ div.delayed .chat-message-me { color: #7EABBB; } +input.error { + border: 1px solid red; +} + .chat-message-error { color:#76797C; font-size:90%; @@ -272,7 +276,7 @@ dt#xmpp-contact-search { ul#found-users { padding: 10px 0 5px 5px; - border: 0; + border: 0; } form.search-xmpp-contact { @@ -596,8 +600,9 @@ form.sendXMPPMessage { height: 54px; } -#set-custom-xmpp-status { +form#set-custom-xmpp-status { float: left; + padding: 0; } #set-custom-xmpp-status button { @@ -617,7 +622,16 @@ div.xmpp-status { } input.custom-xmpp-status { - height: 18px; + width: 138px; +} + +form.add-xmpp-contact { + background: white; + padding: 5px; +} + +form.add-xmpp-contact input { + width: 130px; } .fancy-dropdown { diff --git a/converse.js b/converse.js index 3b7f202cf..6325a8923 100644 --- a/converse.js +++ b/converse.js @@ -654,8 +654,15 @@ addContactFromForm: function (ev) { ev.preventDefault(); + var $input = $(ev.target).find('input'); + var jid = $input.val(); + if (jid.indexOf("@") < 0) { + // this is not a valid JID + $input.addClass('error'); + return; + } converse.getVCard( - $(ev.target).find('input').val(), + jid, $.proxy(function (jid, fullname, image, image_type, url) { // XXX: Should we perhaps create a roster item here? this.addContact(jid, fullname);