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" >
2014-08-28 22:04:16 +02:00
< label for = "node-input-ircserver" > < i class = "fa fa-globe" > < / i > IRC Server< / label >
2013-09-05 16:02:48 +02:00
< input type = "text" id = "node-input-ircserver" >
< / div >
2014-01-02 12:15:03 +01:00
< div class = "form-row" >
2014-08-28 22:04:16 +02:00
< label for = "node-input-channel" > < i class = "fa fa-random" > < / i > Channel< / label >
2014-01-02 12:15:03 +01:00
< input type = "text" id = "node-input-channel" placeholder = "#nodered" >
< / div >
2013-09-05 16:02:48 +02:00
< div class = "form-row" >
2014-08-28 22:04:16 +02:00
< label for = "node-input-name" > < i class = "fa fa-tag" > < / i > Name< / label >
2013-09-05 16:02:48 +02:00
< input type = "text" id = "node-input-name" placeholder = "Name" >
< / div >
2014-01-02 12:15:03 +01:00
< div class = "form-tips" > The channel to join must start with a # (as per normal irc rules...)< / div >
2013-09-05 16:02:48 +02:00
< / script >
< script type = "text/x-red" data-help-name = "irc in" >
2013-11-02 13:12:47 +01:00
< p > Connects to a channel on an IRC server< / p >
2014-05-09 10:48:41 +02:00
< p > Any messages on that channel will appear on the < code > msg.payload< / code > at the output, while < code > msg.topic< / code > will contain who it is from.< / p >
< p > The second output provides a < code > msg.payload< / code > that has any status messages such as joins, parts, kicks etc.< / p >
2014-05-09 16:03:41 +02:00
< p > The type of the status message is set as < code > msg.payload.type< / code > .< / p >
< p > The possible status types are: < br / >
2014-05-09 10:48:41 +02:00
< table border = "1" cellpadding = "1" cellspacing = "1" >
2014-05-09 16:03:41 +02:00
< thead >
< tr >
< th scope = "col" > Type< / th >
< th scope = "col" > Description< / th >
< / tr >
< / thead >
< tbody >
< tr >
< td > message< / td >
< td > message is sent into the channel< / td >
< / tr >
< tr >
< td > pm< / td >
< td > private message to the bot< / td >
< / tr >
< tr >
< td > join< / td >
< td > a user joined the channel (also triggered when the bot joins a channel)< / td >
< / tr >
< tr >
< td > invite< / td >
< td > the bot is being invited to a channel< / td >
< / tr >
< tr >
< td > part< / td >
< td > a user leaves a channel< / td >
< / tr >
< tr >
< td > quit< / td >
< td > a user quits a channel< / td >
< / tr >
< tr >
< td > kick< / td >
< td > a user is kicked from a channel< / td >
< / tr >
< tr >
< td > names< / td >
< td > retrieves the list of users when the bot joins a channel< / td >
< / tr >
< / tbody >
2014-05-09 10:48:41 +02:00
< / table >
< / p >
2013-09-05 16:02:48 +02:00
< / script >
< script type = "text/javascript" >
RED.nodes.registerType('irc in',{
category: 'social-input',
defaults: {
name: {value:""},
2014-01-02 12:15:03 +01:00
ircserver: {type:"irc-server", required:true},
channel: {value:"",required:true,validate:RED.validators.regex(/^#/)}
2013-09-05 16:02:48 +02:00
},
color:"Silver",
inputs:0,
2014-01-02 12:15:03 +01:00
outputs:2,
2013-09-05 16:02:48 +02:00
icon: "hash.png",
label: function() {
2013-09-09 10:55:50 +02:00
var ircNode = RED.nodes.node(this.ircserver);
2013-09-09 22:42:12 +02:00
return this.name||(ircNode?ircNode.label():"irc");
2013-09-05 16:02:48 +02:00
},
labelStyle: function() {
return this.name?"node_label_italic":"";
2014-01-02 12:15:03 +01:00
},
oneditprepare: function() {
if (this.ircserver !== undefined) {
this.channel = this.channel || RED.nodes.node(this.ircserver).channel;
$("#node-input-channel").val(this.channel);
}
else { this.channel = this.channel; }
$("#node-input-channel").val(this.channel);
2013-09-05 16:02:48 +02:00
}
});
< / script >
2014-01-02 12:15:03 +01:00
2013-09-05 16:02:48 +02:00
< script type = "text/x-red" data-template-name = "irc out" >
< div class = "form-row" >
2014-08-28 22:04:16 +02:00
< label for = "node-input-ircserver" > < i class = "fa fa-globe" > < / i > IRC Server< / label >
2013-09-05 16:02:48 +02:00
< input type = "text" id = "node-input-ircserver" >
< / div >
2014-01-02 12:15:03 +01:00
< div class = "form-row" >
2014-08-28 22:04:16 +02:00
< label for = "node-input-channel" > < i class = "fa fa-random" > < / i > Channel< / label >
2014-01-02 12:15:03 +01:00
< input type = "text" id = "node-input-channel" placeholder = "#nodered" >
< / div >
2013-09-05 16:02:48 +02:00
< div class = "form-row" >
2014-08-28 22:04:16 +02:00
< label for = "node-input-sendObject" > < i class = "fa fa-arrows" > < / i > Action< / label >
2013-11-02 13:12:47 +01:00
< select type = "text" id = "node-input-sendObject" style = "display: inline-block; vertical-align: middle; width:70%;" >
2014-01-02 12:15:03 +01:00
< option value = "pay" > Send to channel< / option >
< option value = "true" > Send to userid in msg.topic as PRIVMSG< / option >
2013-11-02 13:12:47 +01:00
< option value = "false" > Send complete msg object to channel< / option >
< / select >
2013-09-05 16:02:48 +02:00
< / div >
< div class = "form-row" >
2014-08-28 22:04:16 +02:00
< label for = "node-input-name" > < i class = "fa fa-tag" > < / i > Name< / label >
2013-09-05 16:02:48 +02:00
< input type = "text" id = "node-input-name" placeholder = "Name" >
< / div >
2014-01-02 12:15:03 +01:00
< div class = "form-tips" > The channel to join must start with a # (as per normal irc rules...)< br / >
Sending the complete object will stringify the whole msg object before sending.< / div >
2013-09-05 16:02:48 +02:00
< / script >
< script type = "text/x-red" data-help-name = "irc out" >
2013-11-02 13:12:47 +01:00
< p > Sends messages to a channel on an IRC server< / p >
2014-05-09 10:48:41 +02:00
< p > You can send just the < code > msg.payload< / code > , or the complete < code > msg< / code > object to the selected channel,
or you can select to use < code > msg.topic< / code > to send the < code > msg.payload< / code > to a specific user in the channel (private conversation).< / p >
2013-09-05 16:02:48 +02:00
< / script >
< script type = "text/javascript" >
RED.nodes.registerType('irc out',{
category: 'social-output',
defaults: {
name: {value:""},
2013-11-02 13:12:47 +01:00
sendObject: {value:"pay", required:true},
2014-01-02 12:15:03 +01:00
ircserver: {type:"irc-server", required:true},
channel: {value:"",required:true,validate:RED.validators.regex(/^#/)}
2013-09-05 16:02:48 +02:00
},
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":"";
2014-01-02 12:15:03 +01:00
},
oneditprepare: function() {
if (this.ircserver !== undefined) {
this.channel = this.channel || RED.nodes.node(this.ircserver).channel;
$("#node-input-channel").val(this.channel);
}
else { this.channel = this.channel; }
2013-09-05 16:02:48 +02:00
}
});
< / script >
2014-01-02 12:15:03 +01:00
2013-09-05 16:02:48 +02:00
< script type = "text/x-red" data-template-name = "irc-server" >
< div class = "form-row" >
2014-08-28 22:04:16 +02:00
< label for = "node-config-input-server" > < i class = "fa fa-globe" > < / i > IRC Server< / label >
2014-01-02 12:15:03 +01:00
< input type = "text" id = "node-config-input-server" placeholder = "irc.freenode.net" >
2013-09-05 16:02:48 +02:00
< / div >
< div class = "form-row" >
2014-08-28 22:04:16 +02:00
< label for = "node-config-input-nickname" > < i class = "fa fa-user" > < / i > Nickname< / label >
2013-09-05 16:02:48 +02:00
< input type = "text" id = "node-config-input-nickname" placeholder = "joe123" >
< / div >
< / script >
< script type = "text/javascript" >
RED.nodes.registerType('irc-server',{
category: 'config',
defaults: {
server: {value:"",required:true},
nickname: {value:"",required:true}
},
label: function() {
2014-01-02 12:15:03 +01:00
return this.server;
2013-09-05 16:02:48 +02:00
}
});
< / script >