2013-09-05 16:02:48 +02: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="irc in">
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-ircserver"><i class="icon-tasks"></i> IRC Server</label>
|
|
|
|
<input type="text" id="node-input-ircserver">
|
|
|
|
</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>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/x-red" data-help-name="irc in">
|
|
|
|
<p>Connects to a channel on an IRC server</p>
|
|
|
|
<p>Any messages on that channel will appear on the <b>msg.payload</b> at the output, while <b>msg.topic</b> will contain who it is from.</p>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
RED.nodes.registerType('irc in',{
|
|
|
|
category: 'social-input',
|
|
|
|
defaults: {
|
|
|
|
name: {value:""},
|
|
|
|
ircserver: {type:"irc-server", required:true}
|
|
|
|
},
|
|
|
|
color:"Silver",
|
|
|
|
inputs:0,
|
|
|
|
outputs:1,
|
|
|
|
icon: "hash.png",
|
|
|
|
label: function() {
|
2013-09-09 10:55:50 +02:00
|
|
|
var ircNode = RED.nodes.node(this.ircserver);
|
|
|
|
return this.name||((ircNode?ircNode.label():"irc");
|
2013-09-05 16:02:48 +02:00
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/x-red" data-template-name="irc out">
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-ircserver"><i class="icon-tasks"></i> IRC Server</label>
|
|
|
|
<input type="text" id="node-input-ircserver">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label> </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-name"><i class="icon-tag"></i> Name</label>
|
|
|
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
|
|
</div>
|
|
|
|
<div class="form-tips">Sending complete object will stringify the whole msg object before sending.</div>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/x-red" data-help-name="irc out">
|
|
|
|
<p>Connects to a channel on an IRC server</p>
|
|
|
|
<p>If you send something with NO msg.topic it will go to the channel - otherwise it will go to the id in the <b>msg.topic</b> field.</p>
|
|
|
|
<p>You can either just send the <b>msg.payload</b>, or you can send the complete <b>msg</b> object.</p>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
RED.nodes.registerType('irc out',{
|
|
|
|
category: 'social-output',
|
|
|
|
defaults: {
|
|
|
|
name: {value:""},
|
|
|
|
sendObject: {value:false},
|
|
|
|
ircserver: {type:"irc-server", required:true}
|
|
|
|
},
|
|
|
|
color:"Silver",
|
|
|
|
inputs:1,
|
|
|
|
outputs:0,
|
|
|
|
icon: "hash.png",
|
|
|
|
align: "right",
|
|
|
|
label: function() {
|
|
|
|
return this.name || (this.ircserver)?RED.nodes.node(this.ircserver).label():"irc";
|
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/x-red" data-template-name="irc-server">
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-config-input-server"><i class="icon-tasks"></i> IRC Server</label>
|
|
|
|
<input type="text" id="node-config-input-server" placeholder="irc.UK-IRC.net">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-config-input-channel"><i class="icon-tasks"></i> Channel</label>
|
|
|
|
<input type="text" id="node-config-input-channel" placeholder="#testing1234">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-config-input-nickname"><i class="icon-tasks"></i> Nickname</label>
|
|
|
|
<input type="text" id="node-config-input-nickname" placeholder="joe123">
|
|
|
|
</div>
|
|
|
|
<div class="form-tips">The channel to join must start with a # (as per normal irc rules...)</div>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
RED.nodes.registerType('irc-server',{
|
|
|
|
category: 'config',
|
|
|
|
defaults: {
|
|
|
|
channel: {value:"",required:true,validate:RED.validators.regex(/^#/)},
|
|
|
|
server: {value:"",required:true},
|
|
|
|
nickname: {value:"",required:true}
|
|
|
|
},
|
|
|
|
label: function() {
|
|
|
|
return this.server+":"+this.channel;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|