Commit dfdf5e49 authored by Adrien Dorsaz's avatar Adrien Dorsaz

Fix to correctly fill the discovered datas

Entity class was saving 'node' attribute instead of 'xml:lang'.
Node attribute is used when discovering items, not entities.

Client was trying to add features instead of identities.

Network had some issue about the use of xmllang in key which are not mandatory
parent ef54b925
......@@ -455,7 +455,7 @@ class Client {
let features = iqResponse.getElementsByTagName('feature');
for (let i = 0; i < identities.length; i++) {
entity.addFeature(identities[i]);
entity.addIdentity(identities[i]);
}
for (let i = 0; i < features.length; i++) {
......
......@@ -34,12 +34,12 @@ class Entity {
let type = _identity.getAttribute('type');
let category = _identity.getAttribute('category');
let name = _identity.getAttribute('name');
let node = _identity.getAttribute('node');
let xmllang = _identity.getAttribute('xml:lang');
let idKey = {
'type': type,
'category': category,
'node': node
'xmllang': xmllang
};
let identity = this.identities.get(idKey)
......
......@@ -29,12 +29,14 @@ class Network {
if (_netElement instanceof Entity) {
// Look for identities
for (let [idKey, idValue] of _netElement.identityMap) {
// TODO: Better decide which identity we want to store
if (idKey.xmllang == 'en'
|| !idKey.xmllang
|| idKey.xmllang == this.xmllang) {
// If pubsub service is discoverd save it on the pubsub/services path
if (idKey.type == "pubsub"
&& idKey.category == "service") {
if (idKey.type == "service"
&& idKey.category == "pubsub") {
let service = new Map();
service.set("metaData", new Map());
service.get("metaData").set("name", idValue);
......@@ -67,7 +69,7 @@ class Network {
// Look for features
let service = null;
if (this.pubsub.has(_netElement.jid)) {
let service = this.pubsub.get(_netElement.jid);
service = this.pubsub.get(_netElement.jid);
}
if (service) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment