# HG changeset patch # User Emmanuel Gil Peyrot # Date 1327636724 -3600 # Node ID 82bffc4a07a9604b43fe025747063969635416c8 # Parent 06e3a883d3a39f633fb9d0b716178f578203d0a9 Fix disco info. diff --git a/plugins.js b/plugins.js --- a/plugins.js +++ b/plugins.js @@ -154,10 +154,31 @@ Lightstring.discoItems = function(aConne }; Lightstring.discoInfo = function(aConnection, aTo, aNode, aCallback) { aConnection.send(Lightstring.stanza.disco.info(aTo, aNode), function(answer){ - var field = answer.querySelector('field[var="pubsub#creator"] > value'); - var creator = field ? field.textContent : ''; - //FIXME callback the entire data - aCallback(creator); + var identities = []; + var features = []; + + var children = answer.firstChild.children; + var length = children.length; + + for (var i = 0; i < length; i++) { + var child = children[i]; + + if (child.localName === 'feature') + features.push(child.getAttributeNS(null, 'var')); + + else if (child.localName === 'identity') { + var identity = { + category: child.getAttributeNS(null, 'category'), + type: child.getAttributeNS(null, 'type') + }; + var name = child.getAttributeNS(null, 'name'); + if (name) + identity.name = name; + identities.push(identity); + } + } + + aCallback({identities: identities, features: features}); }); }; //////////