failirc 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/failbot +162 -0
- data/bin/failircd +61 -0
- data/lib/failirc.rb +25 -0
- data/lib/failirc/client.rb +227 -0
- data/lib/failirc/client/channel.rb +98 -0
- data/lib/failirc/client/channels.rb +85 -0
- data/lib/failirc/client/client.rb +59 -0
- data/lib/failirc/client/clients.rb +43 -0
- data/lib/failirc/client/dispatcher.rb +209 -0
- data/lib/failirc/client/dispatcher/connectiondispatcher.rb +410 -0
- data/lib/failirc/client/dispatcher/event.rb +113 -0
- data/lib/failirc/client/dispatcher/eventdispatcher.rb +203 -0
- data/lib/failirc/client/module.rb +103 -0
- data/lib/failirc/client/modules/Base.rb +361 -0
- data/lib/failirc/client/modules/Logger.rb +89 -0
- data/lib/failirc/client/server.rb +89 -0
- data/lib/failirc/client/user.rb +66 -0
- data/lib/failirc/client/users.rb +100 -0
- data/lib/failirc/errors.rb +339 -0
- data/lib/failirc/extensions.rb +124 -0
- data/lib/failirc/mask.rb +117 -0
- data/lib/failirc/modes.rb +54 -0
- data/lib/failirc/responses.rb +360 -0
- data/lib/failirc/server.rb +266 -0
- data/lib/failirc/server/channel.rb +122 -0
- data/lib/failirc/server/channels.rb +84 -0
- data/lib/failirc/server/client.rb +100 -0
- data/lib/failirc/server/clients.rb +54 -0
- data/lib/failirc/server/dispatcher.rb +219 -0
- data/lib/failirc/server/dispatcher/connectiondispatcher.rb +477 -0
- data/lib/failirc/server/dispatcher/event.rb +113 -0
- data/lib/failirc/server/dispatcher/eventdispatcher.rb +196 -0
- data/lib/failirc/server/link.rb +50 -0
- data/lib/failirc/server/links.rb +49 -0
- data/lib/failirc/server/module.rb +103 -0
- data/lib/failirc/server/modules/Base.rb +2545 -0
- data/lib/failirc/server/modules/Cloaking.rb +170 -0
- data/lib/failirc/server/modules/Firewall.rb +104 -0
- data/lib/failirc/server/modules/Netlog.rb +67 -0
- data/lib/failirc/server/modules/Roulette.rb +78 -0
- data/lib/failirc/server/modules/TinyURL.rb +98 -0
- data/lib/failirc/server/modules/Translate.rb +62 -0
- data/lib/failirc/server/modules/WordFilter.rb +144 -0
- data/lib/failirc/server/user.rb +72 -0
- data/lib/failirc/server/users.rb +103 -0
- data/lib/failirc/sslutils.rb +74 -0
- data/lib/failirc/utils.rb +53 -0
- metadata +107 -0
@@ -0,0 +1,124 @@
|
|
1
|
+
# failirc, a fail IRC library.
|
2
|
+
#
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh.ffff@gmail.com]
|
4
|
+
#
|
5
|
+
# This file is part of failirc.
|
6
|
+
#
|
7
|
+
# failirc is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# failirc is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with failirc. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'socket'
|
21
|
+
require 'openssl'
|
22
|
+
|
23
|
+
class Reference
|
24
|
+
def initialize (name, vars)
|
25
|
+
@getter = eval "lambda { #{name} }", vars
|
26
|
+
@setter = eval "lambda { |v| #{name} = v }", vars
|
27
|
+
end
|
28
|
+
|
29
|
+
def value
|
30
|
+
@getter.call
|
31
|
+
end
|
32
|
+
|
33
|
+
def value= (newValue)
|
34
|
+
@setter.call(newValue)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def ref (&block)
|
39
|
+
Reference.new(block.call, block.binding)
|
40
|
+
end
|
41
|
+
|
42
|
+
class CaseInsensitiveHash < Hash
|
43
|
+
def initialize (*args)
|
44
|
+
super(*args)
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
alias ___set___ []=
|
50
|
+
alias ___get___ []
|
51
|
+
alias ___delete___ delete
|
52
|
+
|
53
|
+
public
|
54
|
+
|
55
|
+
def []= (key, value)
|
56
|
+
if key.class == String
|
57
|
+
key = key.downcase
|
58
|
+
end
|
59
|
+
|
60
|
+
___set___(key, value)
|
61
|
+
end
|
62
|
+
|
63
|
+
def [] (key)
|
64
|
+
if key.class == String
|
65
|
+
key = key.downcase
|
66
|
+
end
|
67
|
+
|
68
|
+
return ___get___(key)
|
69
|
+
end
|
70
|
+
|
71
|
+
def delete (key)
|
72
|
+
if key.class == String
|
73
|
+
key = key.downcase
|
74
|
+
end
|
75
|
+
|
76
|
+
___delete___(key)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class ThreadSafeHash < CaseInsensitiveHash
|
81
|
+
def initialize (*args)
|
82
|
+
@semaphore = Mutex.new
|
83
|
+
|
84
|
+
super(*args)
|
85
|
+
end
|
86
|
+
|
87
|
+
private
|
88
|
+
|
89
|
+
alias __set__ []=
|
90
|
+
alias __get__ []
|
91
|
+
alias __delete__ delete
|
92
|
+
|
93
|
+
public
|
94
|
+
|
95
|
+
def []= (key, value)
|
96
|
+
begin
|
97
|
+
@semaphore.synchronize {
|
98
|
+
return __set__(key, value)
|
99
|
+
}
|
100
|
+
rescue ThreadError
|
101
|
+
return __set__(key, value)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def [] (key)
|
106
|
+
begin
|
107
|
+
@semaphore.synchronize {
|
108
|
+
return __get__(key)
|
109
|
+
}
|
110
|
+
rescue ThreadError
|
111
|
+
return __get__(key)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def delete (key)
|
116
|
+
begin
|
117
|
+
@semaphore.synchronize {
|
118
|
+
return __delete__(key)
|
119
|
+
}
|
120
|
+
rescue ThreadError
|
121
|
+
return __delete__(key)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
data/lib/failirc/mask.rb
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
# failirc, a fail IRC library.
|
2
|
+
#
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh.ffff@gmail.com]
|
4
|
+
#
|
5
|
+
# This file is part of failirc.
|
6
|
+
#
|
7
|
+
# failirc is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# failirc is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with failirc. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
module IRC
|
21
|
+
|
22
|
+
class Mask
|
23
|
+
attr_accessor :nick, :user, :host
|
24
|
+
|
25
|
+
def initialize (nick=nil, user=nil, host=nil)
|
26
|
+
@nick = nick
|
27
|
+
@user = user
|
28
|
+
@host = host
|
29
|
+
end
|
30
|
+
|
31
|
+
def match (mask)
|
32
|
+
if !mask || mask.is_a?(String)
|
33
|
+
mask = Mask.parse(mask || '*!*@*')
|
34
|
+
end
|
35
|
+
|
36
|
+
matches = {}
|
37
|
+
|
38
|
+
if !nick || !mask.nick || Mask.toRegexp(nick).match(mask.nick)
|
39
|
+
matches[:nick] = true
|
40
|
+
end
|
41
|
+
|
42
|
+
if !user || !mask.user || Mask.toRegexp(user).match(mask.user)
|
43
|
+
matches[:user] = true
|
44
|
+
end
|
45
|
+
|
46
|
+
if !host || !mask.host || Mask.toRegexp(host).match(mask.host)
|
47
|
+
matches[:host] = true
|
48
|
+
end
|
49
|
+
|
50
|
+
return matches[:nick] && matches[:user] && matches[:host]
|
51
|
+
end
|
52
|
+
|
53
|
+
def == (mask)
|
54
|
+
if !mask.is_a?(Mask)
|
55
|
+
return false
|
56
|
+
end
|
57
|
+
|
58
|
+
return (@nick == mask.nick && @user == mask.user && @host == mask.host)
|
59
|
+
end
|
60
|
+
|
61
|
+
def != (mask)
|
62
|
+
!(self == mask)
|
63
|
+
end
|
64
|
+
|
65
|
+
def to_s
|
66
|
+
return "#{nick || '*'}!#{user || '*'}@#{host || '*'}"
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.toRegexp (string)
|
70
|
+
return Regexp.new(Regexp.escape(string).gsub(/\\\*/, '.*?').gsub(/\\\?/, '.'))
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.parse (string)
|
74
|
+
if !string
|
75
|
+
return Mask.new
|
76
|
+
end
|
77
|
+
|
78
|
+
if !string.match(/[!@]/)
|
79
|
+
return Mask.new(string)
|
80
|
+
end
|
81
|
+
|
82
|
+
if string.include?('!')
|
83
|
+
matches = string.match(/^(.*?)!(.*)$/)
|
84
|
+
|
85
|
+
if !matches[1] || matches[1].empty? || matches[1] == '*'
|
86
|
+
nick = nil
|
87
|
+
else
|
88
|
+
nick = matches[1]
|
89
|
+
end
|
90
|
+
|
91
|
+
string = matches[2]
|
92
|
+
end
|
93
|
+
|
94
|
+
if string.include?('@')
|
95
|
+
matches = string.match(/^(.*?)@(.*)$/)
|
96
|
+
|
97
|
+
if !matches[1] || matches[1].empty? || matches[1] == '*'
|
98
|
+
user = nil
|
99
|
+
else
|
100
|
+
user = matches[1]
|
101
|
+
end
|
102
|
+
|
103
|
+
if !matches[2] || matches[2].empty? || matches[2] == '*'
|
104
|
+
host = nil
|
105
|
+
else
|
106
|
+
host = matches[2]
|
107
|
+
end
|
108
|
+
else
|
109
|
+
user = string
|
110
|
+
host = nil
|
111
|
+
end
|
112
|
+
|
113
|
+
return Mask.new(nick, user, host)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# failirc, a fail IRC library.
|
2
|
+
#
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh.ffff@gmail.com]
|
4
|
+
#
|
5
|
+
# This file is part of failirc.
|
6
|
+
#
|
7
|
+
# failirc is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# failirc is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with failirc. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'failirc/extensions'
|
21
|
+
|
22
|
+
module IRC
|
23
|
+
|
24
|
+
class Modes < ThreadSafeHash
|
25
|
+
def initialize (string=nil)
|
26
|
+
super()
|
27
|
+
|
28
|
+
self[:extended] = ThreadSafeHash.new
|
29
|
+
|
30
|
+
if string
|
31
|
+
string.each_char {|char|
|
32
|
+
@modes[char.to_sym] = true
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_s
|
38
|
+
result = '+'
|
39
|
+
|
40
|
+
each_key {|mode|
|
41
|
+
if mode
|
42
|
+
mode = mode.to_s
|
43
|
+
|
44
|
+
if mode.length == 1
|
45
|
+
result << mode
|
46
|
+
end
|
47
|
+
end
|
48
|
+
}
|
49
|
+
|
50
|
+
return result
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,360 @@
|
|
1
|
+
# failirc, a fail IRC library.
|
2
|
+
#
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh.ffff@gmail.com]
|
4
|
+
#
|
5
|
+
# This file is part of failirc.
|
6
|
+
#
|
7
|
+
# failirc is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# failirc is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with failirc. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
module IRC
|
21
|
+
|
22
|
+
# Dummy reply number. Not used.
|
23
|
+
RPL_NONE = {
|
24
|
+
:code => 300,
|
25
|
+
:text => '""'
|
26
|
+
}
|
27
|
+
|
28
|
+
# Reply format used by USERHOST to list replies to the query list. The reply string is composed as follows:
|
29
|
+
# <reply> ::= <nick>['*'] '=' <'+'|'-'><hostname>
|
30
|
+
# The '*' indicates whether the client has registered as an Operator.
|
31
|
+
# The '-' or '+' characters represent whether the client has set an AWAY message or not respectively.
|
32
|
+
RPL_USERHOST = {
|
33
|
+
:code => 302,
|
34
|
+
:text => '":#{(result) ? \\"#{value.nick}=#{(result.modes[:oper]) ? \'*\' : \'\'} = #{(!result.modes[:away]) ? \'+\' : \'-\'}#{value.user}@#{value.host}\\" : \'\'"'
|
35
|
+
}
|
36
|
+
|
37
|
+
# Reply format used by ISON to list replies to the query list.
|
38
|
+
RPL_ISON = {
|
39
|
+
:code => 303,
|
40
|
+
:text => '":#{result}"'
|
41
|
+
}
|
42
|
+
|
43
|
+
RPL_AWAY = {
|
44
|
+
:code => 301,
|
45
|
+
:text => '"#{value.nick} :#{value.modes[:away]}"'
|
46
|
+
}
|
47
|
+
|
48
|
+
RPL_UNAWAY = {
|
49
|
+
:code => 305,
|
50
|
+
:text => '":You are no longer marked as being away"'
|
51
|
+
}
|
52
|
+
|
53
|
+
# These replies are used with the AWAY command (if allowed).
|
54
|
+
# RPL_AWAY is sent to any client sending a PRIVMSG to a client which is away.
|
55
|
+
# RPL_AWAY is only sent by the server to which the client is connected.
|
56
|
+
# Replies RPL_UNAWAY and RPL_NOWAWAY are sent when the client removes and sets an AWAY message.
|
57
|
+
RPL_NOWAWAY = {
|
58
|
+
:code => 306,
|
59
|
+
:text => '":You have been marked as being away"'
|
60
|
+
}
|
61
|
+
|
62
|
+
RPL_WHOISUSER = {
|
63
|
+
:code => 311,
|
64
|
+
:text => '"#{value.nick} #{value.user} #{value.host} * :#{value.realName}"'
|
65
|
+
}
|
66
|
+
|
67
|
+
RPL_WHOISSERVER = {
|
68
|
+
:code => 312,
|
69
|
+
:text => '"#{value.nick} #{value.server.host} :#{value.server.name}"'
|
70
|
+
}
|
71
|
+
|
72
|
+
RPL_WHOISOPERATOR = {
|
73
|
+
:code => 313,
|
74
|
+
:text => '"#{value.nick} :#{value.modes[:message]}"'
|
75
|
+
}
|
76
|
+
|
77
|
+
RPL_WHOISIDLE = {
|
78
|
+
:code => 317,
|
79
|
+
:text => '"#{value.nick} #{Time.now.tv_sec - value.modes[:last_action].on.tv_sec} #{value.connectedOn.tv_sec} :seconds idle, signon time"'
|
80
|
+
}
|
81
|
+
|
82
|
+
RPL_ENDOFWHOIS = {
|
83
|
+
:code => 318,
|
84
|
+
:text => '"#{value.nick} :End of /WHOIS list"'
|
85
|
+
}
|
86
|
+
|
87
|
+
# Replies 311 - 313, 317 - 319 are all replies generated in response to a WHOIS message.
|
88
|
+
# Given that there are enough parameters present, the answering server must either formulate a reply out of the above numerics (if the query nick is found) or return an error reply.
|
89
|
+
# The '*' in RPL_WHOISUSER is there as the literal character and not as a wild card.
|
90
|
+
# For each reply set, only RPL_WHOISCHANNELS may appear more than once (for long lists of channel names).
|
91
|
+
# The '@' and '+' characters next to the channel name indicate whether a client is a channel operator or has been granted permission to speak on a moderated channel.
|
92
|
+
# The RPL_ENDOFWHOIS reply is used to mark the end of processing a WHOIS message.
|
93
|
+
RPL_WHOISCHANNELS = {
|
94
|
+
:code => 319,
|
95
|
+
:text => '"#{value[:nick]} :#{value[:channels]}"'
|
96
|
+
}
|
97
|
+
|
98
|
+
RPL_WHOWASUSER = {
|
99
|
+
:code => 314,
|
100
|
+
:text => '"#{value.nick} #{value.user} #{value.host} * :#{value.realName}"'
|
101
|
+
}
|
102
|
+
|
103
|
+
# When replying to a WHOWAS message, a server must use the replies RPL_WHOWASUSER, RPL_WHOISSERVER or ERR_WASNOSUCHNICK for each nickname in the presented list.
|
104
|
+
# At the end of all reply batches, there must be RPL_ENDOFWHOWAS (even if there was only one reply and it was an error).
|
105
|
+
RPL_ENDOFWHOWAS = {
|
106
|
+
:code => 369,
|
107
|
+
:text => '"#{value.nick} :End of WHOWAS"'
|
108
|
+
}
|
109
|
+
|
110
|
+
RPL_LISTSTART = {
|
111
|
+
:code => 321,
|
112
|
+
:text => '"Channel :Users Name"'
|
113
|
+
}
|
114
|
+
|
115
|
+
RPL_LIST = {
|
116
|
+
:code => 322,
|
117
|
+
:text => '"#{value.name} #{value.users.length} #{value.modes.to_s != "+" ? "[#{value.modes.to_s}]" : ""} :#{value.topic.text}"'
|
118
|
+
}
|
119
|
+
|
120
|
+
# Replies RPL_LISTSTART, RPL_LIST, RPL_LISTEND mark the start, actual replies with data and end of the server's response to a LIST command.
|
121
|
+
# If there are no channels available to return, only the start and end reply must be sent.
|
122
|
+
RPL_LISTEND = {
|
123
|
+
:code => 323,
|
124
|
+
:text => '":End of /LIST"'
|
125
|
+
}
|
126
|
+
|
127
|
+
RPL_CHANNELMODEIS = {
|
128
|
+
:code => 324,
|
129
|
+
:text => '"#{value.name} #{value.modes}"'
|
130
|
+
}
|
131
|
+
|
132
|
+
RPL_NOTOPIC = {
|
133
|
+
:code => 331,
|
134
|
+
:text => '"#{value.name} :No topic is set"'
|
135
|
+
}
|
136
|
+
|
137
|
+
# When sending a TOPIC message to determine the channel topic, one of two replies is sent.
|
138
|
+
# If the topic is set, RPL_TOPIC is sent back else RPL_NOTOPIC.
|
139
|
+
RPL_TOPIC = {
|
140
|
+
:code => 332,
|
141
|
+
:text => '"#{value.channel.name} :#{value}"'
|
142
|
+
}
|
143
|
+
|
144
|
+
# Returned by the server to indicate that the attempted INVITE message was successful and is being passed onto the end client.
|
145
|
+
RPL_INVITING = {
|
146
|
+
:code => 341,
|
147
|
+
:text => '"#{value[:nick]} #{value[:channel]}"'
|
148
|
+
}
|
149
|
+
|
150
|
+
# Returned by a server answering a SUMMON message to indicate that it is summoning that user.
|
151
|
+
RPL_SUMMONING = {
|
152
|
+
:code => 342,
|
153
|
+
:text => '"#{value.user} :Summoning user to IRC"'
|
154
|
+
}
|
155
|
+
|
156
|
+
# Reply by the server showing its version details.
|
157
|
+
# The <version> is the version of the software being used (including any patchlevel revisions) and the <debuglevel> is used to indicate if the server is running in "debug mode".
|
158
|
+
# The "comments" field may contain any comments about the version or further version details.
|
159
|
+
RPL_VERSION = {
|
160
|
+
:code => 351,
|
161
|
+
:text => '"failirc-#{server.version}. #{server.host} :#{value}"'
|
162
|
+
}
|
163
|
+
|
164
|
+
RPL_WHOREPLY = {
|
165
|
+
:code => 352,
|
166
|
+
:text => '"#{value[:channel].name} #{value[:user].user} #{value[:user].host} #{value[:user].server.host} #{value[:user].nick} #{\'H\' || \'G\'}#{value[:user].modes[:level]} :#{value[:hops]} #{value[:user].realName}"'
|
167
|
+
}
|
168
|
+
|
169
|
+
# The RPL_WHOREPLY and RPL_ENDOFWHO pair are used to answer a WHO message.
|
170
|
+
# The RPL_WHOREPLY is only sent if there is an appropriate match to the WHO query.
|
171
|
+
# If there is a list of parameters supplied with a WHO message, a RPL_ENDOFWHO must be sent after processing each list item with <name> being the item.
|
172
|
+
RPL_ENDOFWHO = {
|
173
|
+
:code => 315,
|
174
|
+
:text => '"#{value} :End of /WHO list"'
|
175
|
+
}
|
176
|
+
|
177
|
+
RPL_NAMREPLY = {
|
178
|
+
:code => 353,
|
179
|
+
:text => '"= #{value[:channel]} :#{value[:users]}"'
|
180
|
+
}
|
181
|
+
|
182
|
+
# To reply to a NAMES message, a reply pair consisting of RPL_NAMREPLY and RPL_ENDOFNAMES is sent by the server back to the client.
|
183
|
+
# If there is no channel found as in the query, then only RPL_ENDOFNAMES is returned.
|
184
|
+
# The exception to this is when a NAMES message is sent with no parameters and all visible channels and contents are sent back in a series of RPL_NAMEREPLY messages with a RPL_ENDOFNAMES to mark the end.
|
185
|
+
RPL_ENDOFNAMES = {
|
186
|
+
:code => 366,
|
187
|
+
:text => '"#{value} :End of /NAMES list"'
|
188
|
+
}
|
189
|
+
|
190
|
+
RPL_LINKS = {
|
191
|
+
:code => 364,
|
192
|
+
:text => '"#{value.mask} #{value.host} :#{message.hopcount} #{value.informations}"'
|
193
|
+
}
|
194
|
+
|
195
|
+
# In replying to the LINKS message, a server must send replies back using the RPL_LINKS numeric and mark the end of the list using an RPL_ENDOFLINKS reply.v
|
196
|
+
RPL_ENDOFLINKS = {
|
197
|
+
:code => 365,
|
198
|
+
:text => '"#{value.mask} :End of /LINKS list"'
|
199
|
+
}
|
200
|
+
|
201
|
+
RPL_BANLIST = {
|
202
|
+
:code => 367,
|
203
|
+
:text => '"#{value}"'
|
204
|
+
}
|
205
|
+
|
206
|
+
# When listing the active 'bans' for a given channel, a server is required to send the list back using the RPL_BANLIST and RPL_ENDOFBANLIST messages.
|
207
|
+
# A separate RPL_BANLIST is sent for each active banid. After the banids have been listed (or if none present) a RPL_ENDOFBANLIST must be sent.
|
208
|
+
RPL_ENDOFBANLIST = {
|
209
|
+
:code => 368,
|
210
|
+
:text => '"#{value} :End of channel ban list"'
|
211
|
+
}
|
212
|
+
|
213
|
+
RPL_INFO = {
|
214
|
+
:code => 371,
|
215
|
+
:text => '":#{value}"'
|
216
|
+
}
|
217
|
+
|
218
|
+
# A server responding to an INFO message is required to send all its 'info' in a series of RPL_INFO messages with a RPL_ENDOFINFO reply to indicate the end of the replies.
|
219
|
+
RPL_ENDOFINFO = {
|
220
|
+
:code => 374,
|
221
|
+
:text => '":End of /INFO list"'
|
222
|
+
}
|
223
|
+
|
224
|
+
RPL_MOTDSTART = {
|
225
|
+
:code => 375,
|
226
|
+
:text => '":- #{server.host} Message of the day - "'
|
227
|
+
}
|
228
|
+
|
229
|
+
RPL_MOTD = {
|
230
|
+
:code => 372,
|
231
|
+
:text => '":- #{value}"'
|
232
|
+
}
|
233
|
+
|
234
|
+
# When responding to the MOTD message and the MOTD file is found, the file is displayed line by line, with each line no longer than 80 characters, using RPL_MOTD format replies.
|
235
|
+
# These should be surrounded by a RPL_MOTDSTART (before the RPL_MOTDs) and an RPL_ENDOFMOTD (after).
|
236
|
+
RPL_ENDOFMOTD = {
|
237
|
+
:code => 376,
|
238
|
+
:text => '":End of /MOTD command"'
|
239
|
+
}
|
240
|
+
|
241
|
+
# RPL_YOUREOPER is sent back to a client which has just successfully issued an OPER message and gained operator status.
|
242
|
+
RPL_YOUREOPER = {
|
243
|
+
:code => 381,
|
244
|
+
:text => '":You are now an IRC operator"'
|
245
|
+
}
|
246
|
+
|
247
|
+
# If the REHASH option is used and an operator sends a REHASH message, an RPL_REHASHING is sent back to the operator.
|
248
|
+
RPL_REHASHING = {
|
249
|
+
:code => 382,
|
250
|
+
:text => '"#{value.path} :Rehashing"'
|
251
|
+
}
|
252
|
+
|
253
|
+
# When replying to the TIME message, a server must send the reply using the RPL_TIME format above.
|
254
|
+
# The string showing the time need only contain the correct day and time there.
|
255
|
+
# There is no further requirement for the time string.
|
256
|
+
RPL_TIME = {
|
257
|
+
:code => 391,
|
258
|
+
:text => '"#{value.host} :#{value.time}"'
|
259
|
+
}
|
260
|
+
|
261
|
+
RPL_USERSSTART = {
|
262
|
+
:code => 392,
|
263
|
+
:text => '":UserID Terminal Host"'
|
264
|
+
}
|
265
|
+
|
266
|
+
RPL_USERS = {
|
267
|
+
:code => 393,
|
268
|
+
:text => '":%-8s %-9s %-8s"'
|
269
|
+
}
|
270
|
+
|
271
|
+
RPL_ENDOFUSERS = {
|
272
|
+
:code => 394,
|
273
|
+
:text => '":End of users"'
|
274
|
+
}
|
275
|
+
|
276
|
+
# If the USERS message is handled by a server, the replies RPL_USERSTART, RPL_USERS, RPL_ENDOFUSERS and RPL_NOUSERS are used.
|
277
|
+
# RPL_USERSSTART must be sent first, following by either a sequence of RPL_USERS or a single RPL_NOUSER.
|
278
|
+
# Following this is RPL_ENDOFUSERS.
|
279
|
+
RPL_NOUSERS = {
|
280
|
+
:code => 395,
|
281
|
+
:text => '":Nobody logged in"'
|
282
|
+
}
|
283
|
+
|
284
|
+
RPL_TRACELINK = {
|
285
|
+
:code => 200,
|
286
|
+
:text => '"Link #{value.version} #{value.debugLevel} #{value.destination} #{value.next.host}"'
|
287
|
+
}
|
288
|
+
|
289
|
+
RPL_TRACECONNECTING = {
|
290
|
+
:code => 201,
|
291
|
+
:text => '"Try. #{value.class} #{value.host}"'
|
292
|
+
}
|
293
|
+
|
294
|
+
RPL_TRACEHANDSHAKE = {
|
295
|
+
:code => 202,
|
296
|
+
:text => '"H.S. #{value.class} #{value.host}"'
|
297
|
+
}
|
298
|
+
|
299
|
+
RPL_TRACEUNKNOWN = {
|
300
|
+
:code => 203,
|
301
|
+
:text => '"???? #{value.class} #{value.ip}"'
|
302
|
+
}
|
303
|
+
|
304
|
+
RPL_TRACEOPERATOR = {
|
305
|
+
:code => 204,
|
306
|
+
:text => '"Oper #{value.class} #{value.nick}"'
|
307
|
+
}
|
308
|
+
|
309
|
+
RPL_TRACEUSER = {
|
310
|
+
:code => 205,
|
311
|
+
:text => '"User #{value.class} #{value.nick}"'
|
312
|
+
}
|
313
|
+
|
314
|
+
RPL_TRACESERVER = {
|
315
|
+
:code => 206,
|
316
|
+
:text => '"Serv #{value.class} <int>S <int>C <server> <nick!user|*!*>@<host|server>"'
|
317
|
+
}
|
318
|
+
|
319
|
+
# custom
|
320
|
+
RPL_WELCOME = {
|
321
|
+
:code => 1,
|
322
|
+
:text => '":Welcome to the #{server.config.elements[\'config/server/name\'].text} #{value.mask}"'
|
323
|
+
}
|
324
|
+
|
325
|
+
RPL_HOSTEDBY = {
|
326
|
+
:code => 2,
|
327
|
+
:text => '":Your host is #{server.host}[#{server.ip}/#{value.listen.attributes[\'port\']}], running version failirc-#{server.version}"'
|
328
|
+
}
|
329
|
+
|
330
|
+
RPL_SERVCREATEDON = {
|
331
|
+
:code => 3,
|
332
|
+
:text => '":This server was created #{server.createdOn}"'
|
333
|
+
}
|
334
|
+
|
335
|
+
RPL_SERVINFO = {
|
336
|
+
:code => 4,
|
337
|
+
:text => '"#{server.host} failirc-#{server.version} #{value[:user]} #{value[:channel]}"'
|
338
|
+
}
|
339
|
+
|
340
|
+
RPL_ISUPPORT = {
|
341
|
+
:code => 5,
|
342
|
+
:text => '"#{value} :are supported by this server"'
|
343
|
+
}
|
344
|
+
|
345
|
+
RPL_CHANCREATEDON = {
|
346
|
+
:code => 329,
|
347
|
+
:text => '"#{value.name} #{value.createdOn.tv_sec}"'
|
348
|
+
}
|
349
|
+
|
350
|
+
RPL_TOPICSETON = {
|
351
|
+
:code => 333,
|
352
|
+
:text => '"#{value.channel.name} #{value.setBy} #{value.setOn.tv_sec}"'
|
353
|
+
}
|
354
|
+
|
355
|
+
RPL_USINGSSL = {
|
356
|
+
:code => 671,
|
357
|
+
:text => '"#{value.nick} :is using a Secure Connection"'
|
358
|
+
}
|
359
|
+
|
360
|
+
end
|