From 811e03d7765001aa2da20ab37d41e1c92b4ae53b Mon Sep 17 00:00:00 2001 From: Thibaut Horel Date: Thu, 20 Jan 2011 14:45:51 +0100 Subject: 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 --- webclient/lib/basic.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'webclient/lib') 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) -- cgit v1.2.3-70-g09d2