mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
parent
8431e624f7
commit
4cfbc6a32a
@ -157,13 +157,17 @@
|
||||
<input type="text" id="node-config-input-user" placeholder="joe@blah.im">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-nickname"><i class="fa fa-user"></i> Nickname</label>
|
||||
<label for="node-config-input-nickname"><i class="fa fa-heart"></i> Nickname</label>
|
||||
<input type="text" id="node-config-input-nickname" placeholder="Joe (optional)">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-password"><i class="fa fa-lock"></i> Password</label>
|
||||
<input type="password" id="node-config-input-password">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-resource"><i class="fa fa-globe"></i> Resource</label>
|
||||
<input type="text" id="node-config-input-resource" placeholder="optional resource id">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
@ -173,7 +177,8 @@
|
||||
server: {value:"", required:false},
|
||||
port: {value:5222, required:false, validate:RED.validators.number()},
|
||||
user: {value:""},
|
||||
nickname: {value:""}
|
||||
nickname: {value:""},
|
||||
resource: {value:""}
|
||||
},
|
||||
credentials: {
|
||||
password: {type:"password"}
|
||||
|
@ -30,6 +30,8 @@ module.exports = function(RED) {
|
||||
else {
|
||||
this.port = parseInt(n.port);
|
||||
}
|
||||
this.domain = this.jid.split('@')[1] || this.server;
|
||||
this.resource = n.resource || "";
|
||||
|
||||
// The password is obfuscated and stored in a separate location
|
||||
var credentials = this.credentials;
|
||||
@ -45,12 +47,16 @@ module.exports = function(RED) {
|
||||
if (RED.settings.verbose || LOGITALL) {
|
||||
this.log("Setting up connection xmpp: {service: "+proto+"://"+this.server+":"+this.port+", username: "+this.username+", password: "+this.password+"}");
|
||||
}
|
||||
this.client = client({
|
||||
var opts = {
|
||||
service: proto+'://' + this.server + ':' + this.port,
|
||||
domain: this.domain,
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
timeout: 60000
|
||||
});
|
||||
}
|
||||
if (this.resource !== "") { opts.resource = this.resource; }
|
||||
console.log("OPTS",opts)
|
||||
this.client = client(opts);
|
||||
|
||||
this.client.timeout = 60000;
|
||||
// helper variable for checking against later, maybe we should be using the client
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-node-xmpp",
|
||||
"version": "0.5.10",
|
||||
"version": "0.6.0",
|
||||
"description": "A Node-RED node to talk to an XMPP server",
|
||||
"dependencies": {
|
||||
"@xmpp/client": "^0.13.1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user