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.
Files changed (48) hide show
  1. data/bin/failbot +162 -0
  2. data/bin/failircd +61 -0
  3. data/lib/failirc.rb +25 -0
  4. data/lib/failirc/client.rb +227 -0
  5. data/lib/failirc/client/channel.rb +98 -0
  6. data/lib/failirc/client/channels.rb +85 -0
  7. data/lib/failirc/client/client.rb +59 -0
  8. data/lib/failirc/client/clients.rb +43 -0
  9. data/lib/failirc/client/dispatcher.rb +209 -0
  10. data/lib/failirc/client/dispatcher/connectiondispatcher.rb +410 -0
  11. data/lib/failirc/client/dispatcher/event.rb +113 -0
  12. data/lib/failirc/client/dispatcher/eventdispatcher.rb +203 -0
  13. data/lib/failirc/client/module.rb +103 -0
  14. data/lib/failirc/client/modules/Base.rb +361 -0
  15. data/lib/failirc/client/modules/Logger.rb +89 -0
  16. data/lib/failirc/client/server.rb +89 -0
  17. data/lib/failirc/client/user.rb +66 -0
  18. data/lib/failirc/client/users.rb +100 -0
  19. data/lib/failirc/errors.rb +339 -0
  20. data/lib/failirc/extensions.rb +124 -0
  21. data/lib/failirc/mask.rb +117 -0
  22. data/lib/failirc/modes.rb +54 -0
  23. data/lib/failirc/responses.rb +360 -0
  24. data/lib/failirc/server.rb +266 -0
  25. data/lib/failirc/server/channel.rb +122 -0
  26. data/lib/failirc/server/channels.rb +84 -0
  27. data/lib/failirc/server/client.rb +100 -0
  28. data/lib/failirc/server/clients.rb +54 -0
  29. data/lib/failirc/server/dispatcher.rb +219 -0
  30. data/lib/failirc/server/dispatcher/connectiondispatcher.rb +477 -0
  31. data/lib/failirc/server/dispatcher/event.rb +113 -0
  32. data/lib/failirc/server/dispatcher/eventdispatcher.rb +196 -0
  33. data/lib/failirc/server/link.rb +50 -0
  34. data/lib/failirc/server/links.rb +49 -0
  35. data/lib/failirc/server/module.rb +103 -0
  36. data/lib/failirc/server/modules/Base.rb +2545 -0
  37. data/lib/failirc/server/modules/Cloaking.rb +170 -0
  38. data/lib/failirc/server/modules/Firewall.rb +104 -0
  39. data/lib/failirc/server/modules/Netlog.rb +67 -0
  40. data/lib/failirc/server/modules/Roulette.rb +78 -0
  41. data/lib/failirc/server/modules/TinyURL.rb +98 -0
  42. data/lib/failirc/server/modules/Translate.rb +62 -0
  43. data/lib/failirc/server/modules/WordFilter.rb +144 -0
  44. data/lib/failirc/server/user.rb +72 -0
  45. data/lib/failirc/server/users.rb +103 -0
  46. data/lib/failirc/sslutils.rb +74 -0
  47. data/lib/failirc/utils.rb +53 -0
  48. metadata +107 -0
@@ -0,0 +1,89 @@
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/client/module'
21
+
22
+ module IRC
23
+
24
+ class Client
25
+
26
+ module Modules
27
+
28
+ class Logger < Module
29
+ @@version = '0.0.1'
30
+
31
+ def self.version
32
+ return @@version
33
+ end
34
+
35
+ def description
36
+ "Logger-#{Logger.version}"
37
+ end
38
+
39
+ def initialize (server)
40
+ @events = {
41
+ :pre => Event::Callback.new(self.method(:dispatch), -9001),
42
+ :post => Event::Callback.new(self.method(:dispatch), -9001),
43
+
44
+ :custom => {
45
+ :log => self.method(:log),
46
+ },
47
+ }
48
+
49
+ super(server)
50
+ end
51
+
52
+ def rehash
53
+ if @log && @log != $stdout
54
+ @log.close
55
+ end
56
+
57
+ file = client.config.elements['config/modules/module[@name="Logger"]/file']
58
+
59
+ if file
60
+ @log = File.open(file.text)
61
+ else
62
+ @log = $stdout
63
+ end
64
+ end
65
+
66
+ def finalize
67
+ if @log != $stdout
68
+ @log.close
69
+ end
70
+ end
71
+
72
+ def dispatch (event, thing, string)
73
+ if (event.chain == :input && event.special == :pre) || (event.chain == :output && event.special == :post)
74
+ @log.puts "[#{Time.now}] #{(event.chain == :input) ? '<' : '>'} #{string.inspect}"
75
+ @log.flush
76
+ end
77
+ end
78
+
79
+ def log (string)
80
+ @log.puts "[#{Time.now}] #{string}"
81
+ @log.flush
82
+ end
83
+ end
84
+
85
+ end
86
+
87
+ end
88
+
89
+ end
@@ -0,0 +1,89 @@
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/client/channels'
21
+ require 'failirc/client/clients'
22
+
23
+ module IRC
24
+
25
+ class Client
26
+
27
+ class Server
28
+ attr_reader :client, :socket, :config, :name, :host, :ip, :port, :channels, :clients
29
+ attr_accessor :nick, :password
30
+
31
+ def initialize (client, socket, config, name=nil)
32
+ @client = client
33
+ @socket = socket
34
+ @config = config
35
+
36
+ @channels = Channels.new(self)
37
+ @clients = Clients.new(self)
38
+
39
+ @host = socket.peeraddr[2]
40
+ @ip = socket.peeraddr[3]
41
+ @port = socket.peeraddr[1]
42
+
43
+ nick = client.nick
44
+
45
+ if !name
46
+ name = @host
47
+ else
48
+ if client.server name
49
+ raise Error.new "There is already a server named `#{name}`."
50
+ end
51
+ end
52
+
53
+ while client.server name
54
+ name << '_'
55
+ end
56
+
57
+ @name = name
58
+ end
59
+
60
+ def name= (value)
61
+ if client.server value
62
+ raise Error.new "There is already a server named `#{name}`."
63
+ end
64
+
65
+ client.dispatcher.servers[:byName].delete(name)
66
+ client.dispatcher.servers[:byName][value] = self
67
+ end
68
+
69
+ def send (symbol, *args)
70
+ begin
71
+ self.method(symbol).call(*args)
72
+ rescue Exception => e
73
+ self.debug e
74
+ end
75
+ end
76
+
77
+ def raw (text)
78
+ @client.dispatcher.dispatch :output, self, text
79
+ @client.dispatcher.connection.output.push @socket, text
80
+ end
81
+
82
+ def to_s
83
+ name
84
+ end
85
+ end
86
+
87
+ end
88
+
89
+ end
@@ -0,0 +1,66 @@
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/modes'
21
+
22
+ module IRC
23
+
24
+ class Client
25
+
26
+ class User
27
+ attr_reader :client, :channel, :modes
28
+
29
+ def initialize (client, channel, modes=Modes.new)
30
+ @client = client
31
+ @channel = channel
32
+ @modes = modes
33
+ end
34
+
35
+ def mask
36
+ @client.mask
37
+ end
38
+
39
+ def server
40
+ @client.server
41
+ end
42
+
43
+ def nick
44
+ @client.nick
45
+ end
46
+
47
+ def user
48
+ @client.user
49
+ end
50
+
51
+ def host
52
+ @client.host
53
+ end
54
+
55
+ def to_s
56
+ return "#{modes[:level]}#{nick}"
57
+ end
58
+
59
+ def inspect
60
+ return "#<User: #{client.inspect} #{channel.inspect} #{modes.inspect}>"
61
+ end
62
+ end
63
+
64
+ end
65
+
66
+ end
@@ -0,0 +1,100 @@
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/utils'
21
+
22
+ require 'failirc/client/user'
23
+
24
+ module IRC
25
+
26
+ class Client
27
+
28
+ class Users < ThreadSafeHash
29
+ attr_reader :channel
30
+
31
+ def initialize (channel, *args)
32
+ @channel = channel
33
+
34
+ super(*args)
35
+ end
36
+
37
+ def client
38
+ @channel.client
39
+ end
40
+
41
+ def server
42
+ @channel.server
43
+ end
44
+
45
+ alias __get []
46
+
47
+ def [] (user)
48
+ if user.is_a?(Client) || user.is_a?(User)
49
+ user = user.nick
50
+ end
51
+
52
+ __get(user)
53
+ end
54
+
55
+ alias __set []=
56
+
57
+ def []= (user, value)
58
+ if user.is_a?(Client) || user.is_a?(User)
59
+ user = user.nick
60
+ end
61
+
62
+ __set(user, value)
63
+ end
64
+
65
+ alias __delete delete
66
+
67
+ def delete (key)
68
+ if key.is_a?(User) || key.is_a?(Client)
69
+ key = key.nick
70
+ end
71
+
72
+ key = key.downcase
73
+
74
+ user = self[key]
75
+
76
+ if user
77
+ __delete(key)
78
+
79
+ if channel.empty?
80
+ server.channels.delete(channel)
81
+ end
82
+ end
83
+
84
+ return user
85
+ end
86
+
87
+ def add (user)
88
+ if user.is_a?(Client)
89
+ self[user.nick] = User.new(user, @channel)
90
+ elsif user.is_a?(User)
91
+ self[user.nick] = user
92
+ else
93
+ raise 'You can only add Client or User.'
94
+ end
95
+ end
96
+ end
97
+
98
+ end
99
+
100
+ end
@@ -0,0 +1,339 @@
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
+ # Used to indicate the nickname parameter supplied to a command is currently unused.
23
+ ERR_NOSUCHNICK = {
24
+ :code => 401,
25
+ :text => '"#{value} :No such nick/channel"'
26
+ }
27
+
28
+ # Used to indicate the server name given currently doesn't exist.
29
+ ERR_NOSUCHSERVER = {
30
+ :code => 402,
31
+ :text => '"#{value} :No such server"'
32
+ }
33
+
34
+ # Used to indicate the given channel name is invalid.
35
+ ERR_NOSUCHCHANNEL = {
36
+ :code => 403,
37
+ :text => '"#{value} :No such channel"'
38
+ }
39
+
40
+ # Sent to a user who is either (a) not on a channel which is mode +n or (b) not a chanop (or mode +v) on a channel which has mode +m set and is trying to send a PRIVMSG message to that channel.
41
+ ERR_CANNOTSENDTOCHAN = {
42
+ :code => 404,
43
+ :text => '"#{value[:channel]} :Cannot send to channel"'
44
+ }
45
+
46
+ ERR_YOUNEEDVOICE = {
47
+ :code => 404,
48
+ :text => '"#{value} :You need voice (+v) (#{value})"'
49
+ }
50
+
51
+ ERR_NOEXTERNALMESSAGES = {
52
+ :code => 404,
53
+ :text => '"#{value} :No external channel messages (#{value})"'
54
+ }
55
+
56
+ ERR_YOUAREBANNED = {
57
+ :code => 404,
58
+ :text => '"#{value} :You are banned (#{value})"'
59
+ }
60
+
61
+ ERR_NOCTCPS = {
62
+ :code => 404,
63
+ :text => '"#{value} :CTCPs are not permtted in this channel (#{value})"'
64
+ }
65
+
66
+ ERR_NOCOLORS = {
67
+ :code => 404,
68
+ :text => '"#{value} :Color is not permitted in this channel (#{value})"'
69
+ }
70
+
71
+ # Sent to a user when they have joined the maximum number of allowed channels and they try to join another channel.
72
+ ERR_TOOMANYCHANNELS = {
73
+ :code => 405,
74
+ :text => '"#{value.name} :You have joined too many channels"'
75
+ }
76
+
77
+ # Sent to a user when they have joined the maximum number of allowed channels and they try to join another channel.
78
+ ERR_WASNOSUCHNICK = {
79
+ :code => 406,
80
+ :text => '"#{value} :There was no such nickname"'
81
+ }
82
+
83
+ # Returned to a client which is attempting to send PRIVMSG/NOTICE using the user@host destination format and for a user@host which has several occurrences.
84
+ ERR_TOOMANYTARGETS = {
85
+ :code => 407,
86
+ :text => '"#{value} :Duplicate recipients. No message delivered"'
87
+ }
88
+
89
+ # PING or PONG message missing the originator parameter which is required since these commands must work without valid prefixes.
90
+ ERR_NOORIGIN = {
91
+ :code => 409,
92
+ :text => '":No origin specified"'
93
+ }
94
+
95
+ ERR_NORECIPIENT = {
96
+ :code => 411,
97
+ :text => '":No recipient given (#{value})"'
98
+ }
99
+
100
+ ERR_NOTEXTTOSEND = {
101
+ :code => 412,
102
+ :text => '":No text to send"'
103
+ }
104
+
105
+ ERR_NOTOPLEVEL = {
106
+ :code => 413,
107
+ :text => '"#{mask} :No toplevel domain specified"'
108
+ }
109
+
110
+ # 412 - 414 are returned by PRIVMSG to indicate that the message wasn't delivered for some reason. ERR_NOTOPLEVEL and ERR_WILDTOPLEVEL are errors that are returned when an invalid use of "PRIVMSG $<server>" or "PRIVMSG #<host>" is attempted.
111
+ ERR_WILDTOPLEVEL = {
112
+ :code => 414,
113
+ :text => '"#{mask} :Wildcard in toplevel domain"'
114
+ }
115
+
116
+ # Returned to a registered client to indicate that the command sent is unknown by the server.
117
+ ERR_UNKNOWNCOMMAND = {
118
+ :code => 421,
119
+ :text => '"#{value} :Unknown command"'
120
+ }
121
+
122
+ # Server's MOTD file could not be opened by the server.
123
+ ERR_NOMOTD = {
124
+ :code => 422,
125
+ :text => '":MOTD File is missing"'
126
+ }
127
+
128
+ # Returned by a server in response to an ADMIN message when there is an error in finding the appropriate information.
129
+ ERR_NOADMININFO = {
130
+ :code => 423,
131
+ :text => '"#{server.name} :No administrative info available"'
132
+ }
133
+
134
+ # Generic error message used to report a failed file operation during the processing of a message.
135
+ ERR_FILEERROR = {
136
+ :code => 424,
137
+ :text => '":File error doing #{fileOperation} on #{file}"'
138
+ }
139
+
140
+ # Returned when a nickname parameter expected for a command and isn't found.
141
+ ERR_NONICKNAMEGIVEN = {
142
+ :code => 431,
143
+ :text => '":No nickname given"'
144
+ }
145
+
146
+ # Returned after receiving a NICK message which contains characters which do not fall in the defined set. See section x.x.x for details on valid nicknames.
147
+ ERR_ERRONEUSNICKNAME = {
148
+ :code => 432,
149
+ :text => '"#{value} :Erroneus nickname"'
150
+ }
151
+
152
+ # Returned when a NICK message is processed that results in an attempt to change to a currently existing nickname.
153
+ ERR_NICKNAMEINUSE = {
154
+ :code => 433,
155
+ :text => '"#{value} :Nickname is already in use"'
156
+ }
157
+
158
+ # Returned by a server to a client when it detects a nickname collision (registered of a NICK that already exists by another server).
159
+ ERR_NICKCOLLISION = {
160
+ :code => 436,
161
+ :text => '"#{value} :Nickname collision KILL"'
162
+ }
163
+
164
+ # Returned by the server to indicate that the target user of the command is not on the given channel.
165
+ ERR_USERNOTINCHANNEL = {
166
+ :code => 441,
167
+ :text => '"#{value[:nick]} #{value[:channel]} :They aren\'t on that channel"'
168
+ }
169
+
170
+ # Returned by the server whenever a client tries to perform a channel effecting command for which the client isn't a member.
171
+ ERR_NOTONCHANNEL = {
172
+ :code => 442,
173
+ :text => '"#{value} :You\'re not on that channel"'
174
+ }
175
+
176
+ # Returned when a client tries to invite a user to a channel they are already on.
177
+ ERR_USERONCHANNEL = {
178
+ :code => 443,
179
+ :text => '"#{value[:nick]} #{value[:channel]} :is already on channel"'
180
+ }
181
+
182
+ # Returned by the summon after a SUMMON command for a user was unable to be performed since they were not logged in.
183
+ ERR_NOLOGIN = {
184
+ :code => 444,
185
+ :text => '"#{user} :User not logged in"'
186
+ }
187
+
188
+ # Returned as a response to the SUMMON command. Must be returned by any server which does not implement it.
189
+ ERR_SUMMONDISABLED = {
190
+ :code => 445,
191
+ :text => '":SUMMON has been disabled"'
192
+ }
193
+
194
+ # Returned as a response to the USERS command. Must be returned by any server which does not implement it.
195
+ ERR_USERSDISABLED = {
196
+ :code => 446,
197
+ :text => '":USERS has been disabled"'
198
+ }
199
+
200
+ # Returned by the server to indicate that the client must be registered before the server will allow it to be parsed in detail.
201
+ ERR_NOTREGISTERED = {
202
+ :code => 451,
203
+ :text => '":You have not registered"'
204
+ }
205
+
206
+ # Returned by the server by numerous commands to indicate to the client that it didn't supply enough parameters.
207
+ ERR_NEEDMOREPARAMS = {
208
+ :code => 461,
209
+ :text => '"#{value} :Not enough parameters"'
210
+ }
211
+
212
+ # Returned by the server to any link which tries to change part of the registered details (such as password or user details from second USER message).
213
+ ERR_ALREADYREGISTRED = {
214
+ :code => 462,
215
+ :text => '":You may not reregister"'
216
+ }
217
+
218
+ # Returned to a client which attempts to register with a server which does not been setup to allow connections from the host the attempted connection is tried.
219
+ ERR_NOPERMFORHOST = {
220
+ :code => 463,
221
+ :text => '":Your host isn\'t among the privileged"'
222
+ }
223
+
224
+ # Returned to indicate a failed attempt at registering a connection for which a password was required and was either not given or incorrect.
225
+ ERR_PASSWDMISMATCH = {
226
+ :code => 464,
227
+ :text => '":Password incorrect"'
228
+ }
229
+
230
+ # Returned after an attempt to connect and register yourself with a server which has been setup to explicitly deny connections to you.
231
+ ERR_YOUREBANNEDCREEP = {
232
+ :code => 465,
233
+ :text => '":You are banned from this server"'
234
+ }
235
+
236
+ ERR_KEYSET = {
237
+ :code => 467,
238
+ :text => '"#{value} :Channel key already set"'
239
+ }
240
+
241
+ ERR_CHANNELISFULL = {
242
+ :code => 471,
243
+ :text => '"#{value} :Cannot join channel (+l)"'
244
+ }
245
+
246
+ ERR_UNKNOWNMODE = {
247
+ :code => 472,
248
+ :text => '"#{value} :is unknown mode char to me"'
249
+ }
250
+
251
+ ERR_INVITEONLYCHAN = {
252
+ :code => 473,
253
+ :text => '"#{value} :Cannot join channel (+i)"'
254
+ }
255
+
256
+ ERR_BANNEDFROMCHAN = {
257
+ :code => 474,
258
+ :text => '"#{value} :Cannot join channel (+b)"'
259
+ }
260
+
261
+ ERR_BADCHANNELKEY = {
262
+ :code => 475,
263
+ :text => '"#{value} :Cannot join channel (+k)"'
264
+ }
265
+
266
+ ERR_NOKNOCK = {
267
+ :code => 480,
268
+ :text => '":Cannot knock on #{value[:channel]} (#{value[:reason]})"'
269
+ }
270
+
271
+
272
+ # Any command requiring operator privileges to operate must return this error to indicate the attempt was unsuccessful.
273
+ ERR_NOPRIVILEGES = {
274
+ :code => 481,
275
+ :text => '":Permission Denied- You\'re not an IRC operator"'
276
+ }
277
+
278
+ # Any command requiring 'chanop' privileges (such as MODE messages) must return this error if the client making the attempt is not a chanop on the specified channel.
279
+ ERR_CHANOPRIVSNEEDED = {
280
+ :code => 482,
281
+ :text => '"#{value} :You\'re not channel operator"'
282
+ }
283
+
284
+ # Any attempts to use the KILL command on a server are to be refused and this error returned directly to the client.
285
+ ERR_CANTKILLSERVER = {
286
+ :code => 483,
287
+ :text => '":You cant kill a server!"'
288
+ }
289
+
290
+ # If a client sends an OPER message and the server has not been configured to allow connections from the client's host as an operator, this error must be returned.
291
+ ERR_NOOPERHOST = {
292
+ :code => 491,
293
+ :text => '":No O-lines for your host"'
294
+ }
295
+
296
+ # Returned by the server to indicate that a MODE message was sent with a nickname parameter and that the a mode flag sent was not recognized.
297
+ ERR_UMODEUNKNOWNFLAG = {
298
+ :code => 501,
299
+ :text => '":Unknown MODE flag"'
300
+ }
301
+
302
+ # Error sent to any user trying to view or change the user mode for a user other than themselves.
303
+ ERR_USERSDONTMATCH = {
304
+ :code => 502,
305
+ :text => '":Cant change mode for other users"'
306
+ }
307
+
308
+ # custom
309
+ ERR_BADCHANMASK = {
310
+ :code => 476,
311
+ :text => '"#{value} :Bad channel name"'
312
+ }
313
+
314
+ ERR_ALLMUSTUSESSL = {
315
+ :code => 974,
316
+ :text => '"z :all members must be connected via SSL"'
317
+ }
318
+
319
+ ERR_SSLREQUIRED = {
320
+ :code => 489,
321
+ :text => '"#{value} :Cannot join channel (SSL is required)"'
322
+ }
323
+
324
+ ERR_NONICKCHANGE = {
325
+ :code => 447,
326
+ :text => '"Can not change nickname while on #{value} (+N)"'
327
+ }
328
+
329
+ ERR_NOKICKS = {
330
+ :code => 972,
331
+ :text => '"KICK :channel is +Q"'
332
+ }
333
+
334
+ ERR_NOINVITE = {
335
+ :code => 518,
336
+ :text => '"Cannot invite (+V) at channel #{value}"'
337
+ }
338
+
339
+ end