mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
add info command to xmpp nodes
This commit is contained in:
parent
40362ee985
commit
cafdb26832
@ -161,12 +161,6 @@ module.exports = function(RED) {
|
|||||||
that.lastUsed.warn(stanza.getChild('error'));
|
that.lastUsed.warn(stanza.getChild('error'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (stanza.attrs.type === 'result') {
|
|
||||||
// AM To-Do check for 'bind' result with our current jid
|
|
||||||
var query = stanza.getChild('query');
|
|
||||||
if (RED.settings.verbose || LOGITALL) {that.log("result!"); }
|
|
||||||
if (RED.settings.verbose || LOGITALL) {that.log(query); }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -225,15 +219,6 @@ module.exports = function(RED) {
|
|||||||
xmpp.send(stanza);
|
xmpp.send(stanza);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getInfo(thing,id,xmpp) {
|
|
||||||
// Now try to get a list of all info about a thing
|
|
||||||
var stanza = xml('iq',
|
|
||||||
{type:'get', id:id, to:thing},
|
|
||||||
xml('query', 'http://jabber.org/protocol/disco#info')
|
|
||||||
);
|
|
||||||
xmpp.send(stanza);
|
|
||||||
}
|
|
||||||
|
|
||||||
function joinMUC(node, xmpp, name) {
|
function joinMUC(node, xmpp, name) {
|
||||||
// the presence with the muc x element signifies we want to join the muc
|
// the presence with the muc x element signifies we want to join the muc
|
||||||
// if we want to support passwords, we need to add that as a child of the x element
|
// if we want to support passwords, we need to add that as a child of the x element
|
||||||
@ -495,6 +480,21 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
if (RED.settings.verbose || LOGITALL) {this.log("ROOMS:"+this.server+this.roomsFound); }
|
if (RED.settings.verbose || LOGITALL) {this.log("ROOMS:"+this.server+this.roomsFound); }
|
||||||
}
|
}
|
||||||
|
if (query && query.attrs.hasOwnProperty("xmlns") && query.attrs["xmlns"] === "http://jabber.org/protocol/disco#info") {
|
||||||
|
var fe = [];
|
||||||
|
var _items = stanza.getChild('query').getChildren('feature');
|
||||||
|
for (var i = 0; i<_items.length; i++) {
|
||||||
|
fe.push(_items[i].attrs);
|
||||||
|
}
|
||||||
|
var id = []
|
||||||
|
var _idents = stanza.getChild('query').getChildren('identity');
|
||||||
|
for (var i = 0; i<_idents.length; i++) {
|
||||||
|
id.push(_idents[i].attrs);
|
||||||
|
}
|
||||||
|
var from = stanza.attrs.from;
|
||||||
|
var msg = {topic:from, payload: { identity:id, features:fe} };
|
||||||
|
node.send([null,msg]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -655,6 +655,16 @@ module.exports = function(RED) {
|
|||||||
if (RED.settings.verbose || LOGITALL) { node.log("sending stanza "+stanza.toString()); }
|
if (RED.settings.verbose || LOGITALL) { node.log("sending stanza "+stanza.toString()); }
|
||||||
xmpp.send(stanza);
|
xmpp.send(stanza);
|
||||||
}
|
}
|
||||||
|
else if (msg.command === "info") {
|
||||||
|
var to = node.to || msg.topic || "";
|
||||||
|
var stanza = xml('iq',
|
||||||
|
{type:'get', id:node.id, to:to},
|
||||||
|
xml('query', 'http://jabber.org/protocol/disco#info')
|
||||||
|
);
|
||||||
|
node.serverConfig.used(node);
|
||||||
|
if (RED.settings.verbose || LOGITALL) { node.log("sending stanza "+stanza.toString()); }
|
||||||
|
xmpp.send(stanza);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var to = node.to || msg.topic || "";
|
var to = node.to || msg.topic || "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user