<input type='submit' id='connect' value='connect' />
</form>
</div>
+ <div id="ownInfo">
+ <div id="ownPHOTO"><span class="vCardName">Avatar: </span><img src="imgs/none.png" /></div>
+ <div id="ownFN"><span class="vCardName">Full Name: </span></div>
+ <div id="ownFAMILY"><span class="vCardName">Last Name: </span></div>
+ <div id="ownGIVEN"><span class="vCardName">First Name: </span></div>
+ <div id="ownMIDDLE"><span class="vCardName">Middle Name: </span></div>
+ <div id="ownNICKNAME"><span class="vCardName">Nickname: </span></div>
+ <div id="ownBDAY"><span class="vCardName">Birthday: </span></div>
+ <div id="ownTELWORK"><span class="vCardName">Telephone (Work): </span></div>
+ <div id="ownTELHOME"><span class="vCardName">Telephone (Home): </span></div>
+ <div id="ownCTRY"><span class="vCardName">Country: </span></div>
+ <div id="ownUSERID"><span class="vCardName">E-Mail: </span></div>
+ </div>
<div id='friends'>
</div>
<div id='vCard_container'>
return false;
}
+function _cbOwnVCard(e) {
+ var easy_cases = new Array('FN', 'FAMILY', 'MIDDLE', 'GIVEN', 'NICKNAME', 'BDAY', 'CTRY', 'USERID');
+ for (var i=0; i<easy_cases.length; i++) {
+ var text = e.getElementsByTagName(easy_cases[i])[0];
+ if (text) {
+ text = Strophe.getText(text);
+ $('#own'+easy_cases[i]).append(Strophe.xmlTextNode(text));
+ }
+ }
+ var avatar = e.getElementsByTagName('PHOTO')[0];
+ if (avatar) {
+ var mime = Strophe.getText(avatar.getElementsByTagName('TYPE')[0]);
+ var binval = Strophe.getText(avatar.getElementsByTagName('BINVAL')[0]);
+
+ $("#ownPHOTO img").attr('src', 'data:'+mime+';base64,'+binval);
+ }
+ $('#ownInfo').show();
+
+ return false;
+}
+
function getVCard(jid) {
var id = 'getvCard'+jid2id(jid);
if (roster[jid2id(jid)].vCard == "") {
}
+function getOwnInfo() {
+ var id = 'getvCard'+jid2id(connection.jid);
+ var vCardiq = $iq({'to': Strophe.getBareJidFromJid(connection.jid),
+ 'id': id,
+ 'type': 'get'}
+ ).c('vCard', {'xmlns':NS_VCARD});
+ connection.addHandler(_cbOwnVCard, null, 'iq', 'result', id);
+ connection.send(vCardiq.tree());
+}
+
function addFriend(jid, nick) {
roster[jid2id(jid)] = new Buddy(nick, jid);
$('#friends').append('<div class="friend" id="'+jid2id(jid)+'"><img src="imgs/none.png" /><br /><span class="nick">'+nick+'</span></div>');
} else if (status == Strophe.Status.CONNECTED) {
log('Strophe is connected.');
+ getOwnInfo();
getRoster();
connection.addHandler(_cbDisco, Strophe.NS.DISCO_INFO, 'iq', 'get');
}
var button = $('#connect').get(0);
$('#log').empty();
+ $('#ownInfo').empty();
$('#vCard_container').empty();
$('#friends').empty();
$('label').show();