1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

improve xmpp presence detections

This commit is contained in:
Dave Conway-Jones 2021-06-09 23:28:51 +01:00
parent cf310adb07
commit 14a8b3293b
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
2 changed files with 12 additions and 6 deletions

View File

@ -502,6 +502,7 @@ module.exports = function(RED) {
// ignore 404 error
}
}
return;
}
var state = stanza.getChild('show');
@ -513,12 +514,17 @@ module.exports = function(RED) {
statusText = "offline";
state = "offline";
}
var status = stanza.getChild('status');
if (typeof status !== "undefined") {
statusText = status.getText();
else {
statusText = "online";
state = "online";
}
// right, do we care if there's no status?
if (statusText !== "") {
var status = stanza.getChild('status');
if (status !== undefined) {
statusText = status.getText() || "online";
}
if (statusText !== "" && (stanza.attrs.from !== stanza.attrs.to)) {
var from = stanza.attrs.from;
var msg = {
topic:from,

View File

@ -1,6 +1,6 @@
{
"name": "node-red-node-xmpp",
"version": "0.5.4",
"version": "0.5.5",
"description": "A Node-RED node to talk to an XMPP server",
"dependencies": {
"@xmpp/client": "^0.12.0"