diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2011-01-20 14:45:51 +0100 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2011-01-20 14:45:51 +0100 |
| commit | 811e03d7765001aa2da20ab37d41e1c92b4ae53b (patch) | |
| tree | f4a8fa65dda66e45a5bd3b1b6bcfc5eaca147021 | |
| parent | 9e47ec37b49c9e55ca64576d12dd12ad259ebe8c (diff) | |
| download | alias-811e03d7765001aa2da20ab37d41e1c92b4ae53b.tar.gz | |
Client : when clicking on a name in the contact list, query the content
of its home node and display it.
This is the first complete chain : alias client -> alias component -> alias client
| -rw-r--r-- | webclient/basic.html | 1 | ||||
| -rw-r--r-- | webclient/lib/basic.js | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/webclient/basic.html b/webclient/basic.html index 66943b3..80f986a 100644 --- a/webclient/basic.html +++ b/webclient/basic.html @@ -25,6 +25,7 @@ <ul> </ul> </div> + <div id='main'></div> <div id='bottom'> <div id='bottomup'><a href="#" id='consolea'>Console</a></div> <div id='log'></div> diff --git a/webclient/lib/basic.js b/webclient/lib/basic.js index bfeff88..bdcf5f7 100644 --- a/webclient/lib/basic.js +++ b/webclient/lib/basic.js @@ -1,4 +1,5 @@ var BOSH_SERVICE = 'http://alias.fr.nf/http-bind'; +var server_component = 'object.alias.fr.nf' var connection = null; jQuery.expr[':'].Contains = function(a,i,m){ @@ -45,6 +46,19 @@ function getJID(contact) return contact.find('.roster-jid').text(); } +function getHome(contact) +{ + var name = Base64.encode(getJID(contact)) + '@' + server_component; + var iq = $iq({type : 'get', to : name}).c('query', {xmlns : 'alias:query', type:'content'}); + connection.sendIQ(iq, onHome); +} + +function onHome(iq) +{ + var content = $(iq).find('content').text(); + $('#main').html(content); +} + function insertContact(contact) { var presence = getPresence(contact); @@ -74,6 +88,7 @@ function insertContact(contact) } else $('#roster ul').append(contact); + contact.click(function(){getHome($(this));}); } function onPresence(presence) |
