From: Florian Zeitz Date: Wed, 18 Mar 2009 20:59:03 +0000 (+0100) Subject: Fix for ejabberd / style changes X-Git-Url: https://git.babelmonkeys.de/?a=commitdiff_plain;h=fea35da5e0bcc2b48a76a9131ff40aee79b60136;p=socialXMPP.git Fix for ejabberd / style changes * Removed the "from"-attribute from roster and vCard IQ, because ejabberd doesn't like it * Make friend list look nicer --- diff --git a/css/standard.css b/css/standard.css index 5b260eb..54cbc06 100644 --- a/css/standard.css +++ b/css/standard.css @@ -1,3 +1,12 @@ #login { text-align: center; } + +#log_container { + clear: both; +} + +.friend { + float: left; + margin: 2em; +} diff --git a/index.html b/index.html index 68982c1..82c688d 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,6 @@
-
Status Log :
diff --git a/scripts/basic.js b/scripts/basic.js index 6620d49..e0d2c38 100644 --- a/scripts/basic.js +++ b/scripts/basic.js @@ -18,24 +18,25 @@ function rawOutput(data) { } function jid2id(jid) { - return jid.split('@')[0] + "-" + jid.split('@')[1]; + return jid.split('@').join('-').split('.').join('-'); } function _cbVCard(e) { var jid = e.getAttribute('from'); var avatar = e.getElementsByTagName('PHOTO')[0]; - var mime = Strophe.getText(avatar.getElementsByTagName('TYPE')[0]); - var binval = Strophe.getText(avatar.getElementsByTagName('BINVAL')[0]); + if (avatar) { + var mime = Strophe.getText(avatar.getElementsByTagName('TYPE')[0]); + var binval = Strophe.getText(avatar.getElementsByTagName('BINVAL')[0]); - $("#"+jid2id(jid)+" img").attr('src', 'data:'+mime+';base64,'+binval); + $("#"+jid2id(jid)+" img").attr('src', 'data:'+mime+';base64,'+binval); + } return false; } function getAvatar(jid) { - var id = 'getvCard'+jid; - var vCardiq = $iq({'from':connection.jid+"/"+connection.resource, - 'to':jid, + var id = 'getvCard'+jid2id(jid); + var vCardiq = $iq({'to':jid, 'id':id, 'type':'get'} ).c('vCard', {'xmlns':NS_VCARD}); @@ -45,7 +46,7 @@ function getAvatar(jid) { } function addFriend(jid, nick) { - $('#friends').append('

'+nick+'
'); + $('#friends').append('

'+nick+'
'); $('#'+jid2id(jid)).click(function() { getAvatar(jid); }); @@ -63,8 +64,7 @@ function _cbRoster(e) { function getRoster() { var id = 'getRoster'; - var rosteriq = $iq({'from':connection.jid+"/"+connection.resource, - 'id':id, + var rosteriq = $iq({'id':id, 'type':'get'} ).c('query', {'xmlns':Strophe.NS.ROSTER});