node-red-nodes/social/xmpp/92-xmpp.html

87 lines
3.9 KiB
HTML
Raw Normal View History

2013-10-30 21:38:23 +01:00
<!--
Copyright 2013 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="xmpp">
<div class="form-row">
<label for="node-input-server"><i class="icon-bookmark"></i> Server</label>
<input type="text" id="node-input-server" placeholder="talk.google.com" style="width: 40%;" >
<label for="node-input-port" style="margin-left: 10px; width: 35px; "> Port</label>
<input type="text" id="node-input-port" placeholder="Port" style="width:45px">
</div>
<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-sendObject" placeholder="" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-sendObject" style="width: 70%;">Send complete msg object ?</label>
</div>
<div class="form-row">
<label for="node-input-to"><i class="icon-envelope"></i> To</label>
<input type="text" id="node-input-to" placeholder="joe@gmail.com">
</div>
<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-join" placeholder="" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-join" style="width: 70%;">Is a Chat Room ?</label>
</div>
<div class="form-row">
<label for="node-input-nick"><i class="icon-user"></i> Nickname</label>
<input type="text" id="node-input-nick" placeholder="Joe">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips">The <b>To</b> field is optional. If not set uses the <b>msg.topic</b> property of the message.</div>
</script>
<script type="text/x-red" data-help-name="xmpp">
<p>Connects to an XMPP server to send and receive messages.</p>
<p>Incoming messages will appear as <b>msg.payload</b> on the first output, while <b>msg.topic</b> will contain who it is from.</p>
<p>The second output will user presence and status in <b>msg.payload</b>.</p>
<p>The <b>To</b> field is optional. If not set uses the <b>msg.topic</b> property of the message.</p>
<p>If you are joining a room then the <b>To</b> field must be filled in.</p>
<p>Uses the simple-xmpp module - you may also need to pre-configure your xmpp settings as per below.</p>
<p>Either add to your settings.js file...</p>
<p><pre>xmpp : { jid : "yourid", password: "password" },</pre></p>
<p>Or create a file xmppkeys.js containing</p>
<p><pre>module.exports = { jid: "yourid", password: "password" }</pre></p>
<p>This <b>must</b> be located in the directory above node-red.</p>
2013-10-30 21:38:23 +01:00
</script>
<script type="text/javascript">
RED.nodes.registerType('xmpp',{
category: 'advanced-function',
color:"Silver",
defaults: {
name: {value:""},
server: { value:"",required:true},
port: {value:5222,required:true},
to: {value:""},
join: {value:false},
sendObject: {value:false},
nick: {value:""}
},
inputs:1,
outputs:2,
icon: "xmpp.png",
label: function() {
return this.name||this.server||"xmpp";
},
labelStyle: function() {
return (this.name||!this.server)?"node_label_italic":"";
}
});
</script>