} else {
_cbVCard(roster[jid2id(jid)].vCard);
}
-
}
function getOwnInfo() {
return true;
}
+function _cbMessage(msg) {
+ var jid = $(msg).attr('from');
+ var id = jid2id($(msg).attr('from')) + 'Chat';
+ var body = $(msg).find('body:first').text();
+ body = escape(body);
+ body = body.replace(/%0A/g, '<br/>');
+ body = body.replace(/%3C/g, '<');
+ body = body.replace(/%3E/g, '>');
+ body = body.replace(/%26/g, '&');
+ body = unescape(body);
+ if ($('#' + id).length > 0) {
+ $('#' + id + ' p').append('<br/>');
+ $('#' + id + ' p').append('<span class="sender">' + jid + ': </span>');
+ $('#' + id + ' p').append(body);
+ } else {
+ $('body').append('<div class="chat" id="' + id + '"><p><span class="sender">' + jid + ': </span>' + body + '</p></div>');
+ }
+
+ return true;
+}
+
function genCaps() {
var S = '';
S += 'client/web//' + appName + '<'
getOwnInfo();
getRoster();
connection.addHandler(_cbDisco, Strophe.NS.DISCO_INFO, 'iq', 'get');
+ connection.addHandler(_cbMessage, Strophe.NS.CLIENT, 'message');
}
}
$('#ownInfo').hide();
$('#vCard_container').empty();
$('#friends').empty();
+ $('.chat').remove();
$('label').show();
jid.show();
pass.show();