mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
remove xmpp surplus error messages
This commit is contained in:
parent
f35e4baaef
commit
cf310adb07
@ -170,9 +170,9 @@
|
||||
RED.nodes.registerType('xmpp-server',{
|
||||
category: 'config',
|
||||
defaults: {
|
||||
server: {required:false},
|
||||
port: {value:5222,required:false,validate:RED.validators.number()},
|
||||
user: {type:"text"},
|
||||
server: {value:"", required:false},
|
||||
port: {value:5222, required:false, validate:RED.validators.number()},
|
||||
user: {value:""},
|
||||
nickname: {value:""}
|
||||
},
|
||||
credentials: {
|
||||
|
@ -9,7 +9,13 @@ module.exports = function(RED) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.nickname = n.nickname;
|
||||
this.jid = n.user;
|
||||
this.username = n.user.split('@')[0];
|
||||
if (this.jid.match(/\@/)) {
|
||||
this.username = n.user.split('@')[0];
|
||||
}
|
||||
else {
|
||||
this.username = n.user;
|
||||
this.jid = n.user+'@'+n.server;
|
||||
}
|
||||
// The user may elect to just specify the jid in the settings,
|
||||
// in which case extract the server from the jid and default the port
|
||||
if ("undefined" === typeof n.server || n.server === "") {
|
||||
@ -477,19 +483,24 @@ module.exports = function(RED) {
|
||||
reas = error.toString().split('><')[1].split(" xml")[0].trim();
|
||||
if (reas == "registration-required") { reas = "membership-required"; }
|
||||
}
|
||||
catch(e) {}
|
||||
var msg = {
|
||||
topic:stanza.attrs.from,
|
||||
payload: {
|
||||
code:error.attrs.code,
|
||||
status:"error",
|
||||
reason:reas,
|
||||
name:node.serverConfig.MUCs[stanza.attrs.from.split('/')[0]]
|
||||
}
|
||||
};
|
||||
node.send([null,msg]);
|
||||
node.status({fill:"red",shape:"ring",text:"error : "+error.attrs.code+", "+error.attrs.type+", "+reas});
|
||||
node.error(error.attrs.type+" error. "+error.attrs.code+" "+reas,msg);
|
||||
catch(e) { }
|
||||
if (error.attrs.code !== '404' && (error.attrs.code !== '400' && error.attrs.type !== 'wait')) {
|
||||
var msg = {
|
||||
topic:stanza.attrs.from,
|
||||
payload: {
|
||||
code:error.attrs.code,
|
||||
status:"error",
|
||||
reason:reas,
|
||||
name:node.serverConfig.MUCs[stanza.attrs.from.split('/')[0]]
|
||||
}
|
||||
};
|
||||
node.send([null,msg]);
|
||||
node.status({fill:"red",shape:"ring",text:"error : "+error.attrs.code+", "+error.attrs.type+", "+reas});
|
||||
node.error(error.attrs.type+" error. "+error.attrs.code+" "+reas,msg);
|
||||
}
|
||||
else {
|
||||
// ignore 404 error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -701,17 +712,22 @@ module.exports = function(RED) {
|
||||
if (reas == "registration-required") { reas = "membership-required"; }
|
||||
}
|
||||
catch(e) {}
|
||||
var msg = {
|
||||
topic:stanza.attrs.from,
|
||||
payload: {
|
||||
code:error.attrs.code,
|
||||
status:"error",
|
||||
reason:reas,
|
||||
name:node.serverConfig.MUCs[stanza.attrs.from.split('/')[0]]
|
||||
}
|
||||
};
|
||||
node.status({fill:"red",shape:"ring",text:"error : "+error.attrs.code+", "+error.attrs.type+", "+reas});
|
||||
node.error(error.attrs.type+" error. "+error.attrs.code+" "+reas,msg);
|
||||
if (error.attrs.code !== '404' && (error.attrs.code !== '400' && error.attrs.type !== 'wait')) {
|
||||
var msg = {
|
||||
topic:stanza.attrs.from,
|
||||
payload: {
|
||||
code:error.attrs.code,
|
||||
status:"error",
|
||||
reason:reas,
|
||||
name:node.serverConfig.MUCs[stanza.attrs.from.split('/')[0]]
|
||||
}
|
||||
};
|
||||
node.status({fill:"red",shape:"ring",text:"error : "+error.attrs.code+", "+error.attrs.type+", "+reas});
|
||||
node.error(error.attrs.type+" error. "+error.attrs.code+" "+reas,msg);
|
||||
}
|
||||
else {
|
||||
// ignore 404 error
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-node-xmpp",
|
||||
"version": "0.5.3",
|
||||
"version": "0.5.4",
|
||||
"description": "A Node-RED node to talk to an XMPP server",
|
||||
"dependencies": {
|
||||
"@xmpp/client": "^0.12.0"
|
||||
|
Loading…
Reference in New Issue
Block a user