better handle xmpp stanza type being optional

to close #1071
This commit is contained in:
Dave Conway-Jones 2024-06-14 16:39:04 +01:00
parent df75872826
commit 305327faaa
No known key found for this signature in database
GPG Key ID: 1DDB0E91A28C2643
2 changed files with 2 additions and 2 deletions

View File

@ -444,7 +444,7 @@ module.exports = function(RED) {
subj = subj.getText();
if (subj.trim() !== "") { node.subject[stanza.attrs.from.split('/')[0]] = subj; }
}
if (stanza.attrs.type == 'chat') {
if (!stanza.attrs.hasOwnProperty("type") || stanza.attrs.type == 'chat') {
var body = stanza.getChild('body');
if (body) {
var msg = { payload:body.getText(), subject:node.subject[stanza.attrs.from.split('/')[0]] };

View File

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