Commit fae73a68 authored by Adrien Dorsaz's avatar Adrien Dorsaz

auto beautifier

parent d7f54c2b
......@@ -68,7 +68,7 @@ for (let key = 0; key < connectButtons.length; key++) {
connectButtons[key].onclick = sendConnect;
}
let panelListener = function(message, sender, sendRepsone) {
let panelListener = function (message, sender, sendRepsone) {
let asynchroneResponse = false;
if (message == "refreshNetwork") {
......
......@@ -404,7 +404,7 @@ class Client {
* * disco#items on first level of service
* * disco#info on each of discovered node of first level service
*/
discoPubsubService (_entity, _node = null) {
discoPubsubService(_entity, _node = null) {
console.log('client: discoPubsubService: starting');
let iqinfo = new IQ({
......@@ -430,11 +430,11 @@ class Client {
let identities = iqResponse.getElementsByTagName('identity');
let features = iqResponse.getElementsByTagName('feature');
for (let i = 0; i < identities.length; i++){
for (let i = 0; i < identities.length; i++) {
entity.addFeature(identities[i]);
}
for (let i = 0; i < features.length; i++){
for (let i = 0; i < features.length; i++) {
entity.addFeature(features[i]);
}
......
......@@ -20,7 +20,7 @@ class IQ extends Stanza {
iq.setAttribute('id', this.id);
for (let key of Object.keys(this.extendedAttributes)){
for (let key of Object.keys(this.extendedAttributes)) {
iq.setAttribute(key, this.extendedAttributes[key]);
}
......
......@@ -29,7 +29,11 @@ class Entity {
let name = _identity.getAttribute('name');
let node = _identity.getAttribute('node');
let idKey = {'type': type, 'category': category, 'node': node};
let idKey = {
'type': type,
'category': category,
'node': node
};
let identity = this.identities.get(idKey)
if (identity) {
......
......@@ -25,47 +25,47 @@ class Network {
}
registerService(_netElement) {
switch(typeof(_netElement)) {
case 'Entity':
switch (typeof (_netElement)) {
case 'Entity':
for (let [idKey, idValue] of _netElement.identities) {
if (idKey.xmllang == 'en'
|| idKey.xmllang == this.xmllang) {
for (let [idKey, idValue] of _netElement.identities) {
if (idKey.xmllang == 'en'
|| idKey.xmllang == this.xmllang) {
// If pubsub service is discoverd save it on the pubsub/services path
if (idKey.type == "pubsub"
&& idKey.category == "service") {
let service = [];
service["metaData"] = [];
service["metaData"]["name"] = idValue;
service["collections"] = new Map();
service["leaves"] = new Map();
this.pubsub.set(_netElement.jid, service);
}
// If pubsub service is discoverd save it on the pubsub/services path
if (idKey.type == "pubsub"
&& idKey.category == "service") {
let service = [];
service["metaData"] = [];
service["metaData"]["name"] = idValue;
service["collections"] = new Map();
service["leaves"] = new Map();
this.pubsub.set(_netElement.jid, service);
}
}
}
if (this.pubsub.has(_netElement.jid)){
let service = this.pubsub.get(_netElement.jid);
for (let [idKey, idValue] of _netElement.identities) {
if (idKey.type == "pubsub"
&& idKey.category == "collection") {
service["collections"].set(idKey.node, []);
}
if (this.pubsub.has(_netElement.jid)) {
let service = this.pubsub.get(_netElement.jid);
for (let [idKey, idValue] of _netElement.identities) {
if (idKey.type == "pubsub"
&& idKey.category == "collection") {
service["collections"].set(idKey.node, []);
}
if (idKey.type == "pubsub"
&& idKey.category == "leaf") {
service["leaves"].set(idKey.node, []);
}
if (idKey.type == "pubsub"
&& idKey.category == "leaf") {
service["leaves"].set(idKey.node, []);
}
}
}
for (let feature of _netElement.features) {
let featureNode = entityNode.createElement("feature");
featureNode.addAttribute("type", feature)
for (let feature of _netElement.features) {
let featureNode = entityNode.createElement("feature");
featureNode.addAttribute("type", feature)
// TODO: decide which features to track and how to use them
}
// TODO: decide which features to track and how to use them
}
break;
}
......@@ -87,6 +87,6 @@ class Network {
* This will be used to restore network from local storage
*/
parse(_jsonNet) {
return ;
return;
}
}
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