irc_parser 0.1.0
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/LICENSE +21 -0
- data/README.md +105 -0
- data/Rakefile +155 -0
- data/extra/benchmark.rb +41 -0
- data/irc_parser.gemspec +98 -0
- data/lib/irc_parser.rb +25 -0
- data/lib/irc_parser/factory.erb +53 -0
- data/lib/irc_parser/helper.rb +71 -0
- data/lib/irc_parser/messages.rb +96 -0
- data/lib/irc_parser/messages/commands.rb +274 -0
- data/lib/irc_parser/messages/errors.rb +51 -0
- data/lib/irc_parser/messages/replies.rb +212 -0
- data/lib/irc_parser/parser.rb +557 -0
- data/lib/irc_parser/parser.rl +89 -0
- data/spec/fixtures/from_weechat.rb +24 -0
- data/spec/fixtures/inbound.log +3959 -0
- data/spec/irc_parser/helper_spec.rb +32 -0
- data/spec/irc_parser/irc_parser_spec.rb +12 -0
- data/spec/irc_parser/messages_spec.rb +195 -0
- data/spec/irc_parser/parser_spec.rb +9 -0
- data/spec/irc_parser/rfc1459/4_1_connection_registration/4_1_1_password_message_spec.rb +28 -0
- data/spec/irc_parser/rfc1459/4_1_connection_registration/4_1_2_nick_message_spec.rb +35 -0
- data/spec/irc_parser/rfc1459/4_1_connection_registration/4_1_3_user_message_spec.rb +47 -0
- data/spec/irc_parser/rfc1459/4_1_connection_registration/4_1_4_server_message_spec.rb +33 -0
- data/spec/irc_parser/rfc1459/4_1_connection_registration/4_1_5_oper_spec.rb +17 -0
- data/spec/irc_parser/rfc1459/4_1_connection_registration/4_1_6_quit_spec.rb +17 -0
- data/spec/irc_parser/rfc1459/4_1_connection_registration/4_1_7_server_quit_message_spec.rb +32 -0
- data/spec/irc_parser/rfc1459/4_2_channel_operations/4_2_1_join_message_spec.rb +65 -0
- data/spec/irc_parser/rfc1459/4_2_channel_operations/4_2_2_part_message_spec.rb +23 -0
- data/spec/irc_parser/rfc1459/4_2_channel_operations/4_2_3_1_channel_modes_spec.rb +159 -0
- data/spec/irc_parser/rfc1459/4_2_channel_operations/4_2_3_2_user_modes_spec.rb +55 -0
- data/spec/irc_parser/rfc1459/4_2_channel_operations/4_2_4_topic_message_spec.rb +36 -0
- data/spec/irc_parser/rfc1459/4_2_channel_operations/4_2_5_names_message_spec.rb +25 -0
- data/spec/irc_parser/rfc1459/4_2_channel_operations/4_2_6_list_message_spec.rb +23 -0
- data/spec/irc_parser/rfc1459/4_2_channel_operations/4_2_7_invite_message_spec.rb +31 -0
- data/spec/irc_parser/rfc1459/4_2_channel_operations/4_2_8_kick_command_spec.rb +56 -0
- data/spec/irc_parser/rfc1459/4_3_server_queries_and_commands/4_3_1_version_message_spec.rb +30 -0
- data/spec/irc_parser/rfc1459/4_3_server_queries_and_commands/4_3_2_stats_message_spec.rb +32 -0
- data/spec/irc_parser/rfc1459/4_3_server_queries_and_commands/4_3_3_links_message_spec.rb +31 -0
- data/spec/irc_parser/rfc1459/4_3_server_queries_and_commands/4_3_4_time_message_spec.rb +34 -0
- data/spec/irc_parser/rfc1459/4_3_server_queries_and_commands/4_3_5_connect_message_spec.rb +32 -0
- data/spec/irc_parser/rfc1459/4_3_server_queries_and_commands/4_3_6_trace_message_spec.rb +28 -0
- data/spec/irc_parser/rfc1459/4_3_server_queries_and_commands/4_3_7_admin_command_spec.rb +28 -0
- data/spec/irc_parser/rfc1459/4_3_server_queries_and_commands/4_3_8_info_command_spec.rb +38 -0
- data/spec/irc_parser/rfc1459/4_4_sending_messages/4_4_1_private_messages_spec.rb +63 -0
- data/spec/irc_parser/rfc1459/4_4_sending_messages/4_4_2_notice_spec.rb +63 -0
- data/spec/irc_parser/rfc1459/4_5_user_based_queries/4_5_1_who_query_spec.rb +27 -0
- data/spec/irc_parser/rfc1459/4_5_user_based_queries/4_5_2_whois_query_spec.rb +27 -0
- data/spec/irc_parser/rfc1459/4_5_user_based_queries/4_5_3_whowas_spec.rb +40 -0
- data/spec/irc_parser/rfc1459/4_6_miscellaneous_messages/4_6_1_kill_message_spec.rb +20 -0
- data/spec/irc_parser/rfc1459/4_6_miscellaneous_messages/4_6_2_ping_message_spec.rb +35 -0
- data/spec/irc_parser/rfc1459/4_6_miscellaneous_messages/4_6_3_pong_message_spec.rb +26 -0
- data/spec/irc_parser/rfc1459/4_6_miscellaneous_messages/4_6_4_error_spec.rb +26 -0
- data/spec/irc_parser/rfc1459/5_0_optionals/5_1_0_away_spec.rb +25 -0
- data/spec/irc_parser/rfc1459/5_0_optionals/5_2_0_rehash_message_spec.rb +14 -0
- data/spec/irc_parser/rfc1459/5_0_optionals/5_3_0_restart_message_spec.rb +14 -0
- data/spec/irc_parser/rfc1459/5_0_optionals/5_4_0_summon_message_spec.rb +28 -0
- data/spec/irc_parser/rfc1459/5_0_optionals/5_5_0_users_spec.rb +27 -0
- data/spec/irc_parser/rfc1459/5_0_optionals/5_6_0_operwall_message_spec.rb +17 -0
- data/spec/irc_parser/rfc1459/5_0_optionals/5_7_0_userhost_message_spec.rb +16 -0
- data/spec/irc_parser/rfc1459/5_0_optionals/5_8_0_ison_message_spec.rb +16 -0
- data/spec/irc_parser/rfc1459/6_0_replies/6_1_error_parsing_spec.rb +488 -0
- data/spec/irc_parser/rfc1459/6_0_replies/6_2_command_responses_generation_spec.rb +934 -0
- data/spec/irc_parser/rfc2812/5_1_command_responses/5_1_command_responses_spec.rb +63 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/support/messages_helper.rb +24 -0
- data/spec/support/simplecov.rb +12 -0
- metadata +185 -0
|
@@ -0,0 +1,934 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "command responses" do
|
|
4
|
+
|
|
5
|
+
# Dummy reply number. Not used.
|
|
6
|
+
it_parses "300 Wiz" do |msg|
|
|
7
|
+
msg.nick.should == "Wiz"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Reply format used by USERHOST to list replies to the query list. The reply
|
|
11
|
+
# string is composed as follows:
|
|
12
|
+
#
|
|
13
|
+
# <reply> ::= <nick>['*'] '=' <'+'|'-'><hostname>
|
|
14
|
+
#
|
|
15
|
+
# The '*' indicates whether the client has registered as
|
|
16
|
+
# an Operator. The '-' or '+' characters represent whether the client has
|
|
17
|
+
# set an AWAY msg or not respectively.
|
|
18
|
+
it_parses "302 Wiz :user = +host" do |msg|
|
|
19
|
+
msg.nick = "emmanuel"
|
|
20
|
+
msg.postfix.should == "user = +host"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Reply format used by ISON to list replies to the query list.
|
|
24
|
+
it_parses "303 Wiz :tony motola" do |msg|
|
|
25
|
+
msg.nick.should == "Wiz"
|
|
26
|
+
msg.nicks.should == ["tony", "motola"]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# These replies are used with the AWAY command (if allowed). AWAY is sent to
|
|
30
|
+
# any client sending a PRIVMSG to a client which is away. AWAY is only sent
|
|
31
|
+
# by the server to which the client is connected. Replies UNAWAY and NOWAWAY
|
|
32
|
+
# are sent when the client removes and sets an AWAY msg.
|
|
33
|
+
it_parses "301 Wiz nick :away message" do |msg|
|
|
34
|
+
msg.nick.should == "Wiz"
|
|
35
|
+
msg.away_nick.should == "nick"
|
|
36
|
+
msg.message.should == "away message"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it_parses "305 Wiz :You are no longer marked as being away" do |msg|
|
|
40
|
+
msg.nick = "Wiz"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it_parses "306 Wiz :You have been marked as being away" do |msg|
|
|
44
|
+
msg.nick = "Wiz"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Replies 311 - 313, 317 - 319 are all replies generated in response to a
|
|
48
|
+
# WHOIS msg. Given that there are enough parameters present, the
|
|
49
|
+
# answering server must either formulate a reply out of the above numerics
|
|
50
|
+
# (if the query nick is found) or return an error reply. The '*' in
|
|
51
|
+
# WHOISUSER is there as the literal character and not as a wild card. For
|
|
52
|
+
# each reply set, only WHOISCHANNELS may appear more than once (for long
|
|
53
|
+
# lists of channel names). The '@' and '+' characters next to the channel
|
|
54
|
+
# name indicate whether a client is a channel operator or has been granted
|
|
55
|
+
# permission to speak on a moderated channel. The ENDOFWHOIS reply is used
|
|
56
|
+
# to mark the end of processing a WHOIS msg.
|
|
57
|
+
it_parses "311 Wiz nick user 192.168.0.1 * :real name" do |msg|
|
|
58
|
+
msg.nick.should == "Wiz"
|
|
59
|
+
msg.user_nick.should == "nick"
|
|
60
|
+
msg.user.should == "user"
|
|
61
|
+
msg.ip.should == "192.168.0.1"
|
|
62
|
+
msg.realname.should == "real name"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it_parses "312 nick user server :server info" do |msg|
|
|
66
|
+
msg.nick.should == "nick"
|
|
67
|
+
msg.user.should == "user"
|
|
68
|
+
msg.server.should == "server"
|
|
69
|
+
msg.info.should == "server info"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it_parses "313 nick user :is an IRC operator" do |msg|
|
|
73
|
+
msg.nick.should == "nick"
|
|
74
|
+
msg.user.should == "user"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it_parses "317 nick user 10 :seconds idle" do |msg|
|
|
78
|
+
msg.nick.should == "nick"
|
|
79
|
+
msg.seconds.should == "10"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it_parses "318 Wiz nick :End of /WHOIS list" do |msg|
|
|
83
|
+
msg.nick.should == "Wiz"
|
|
84
|
+
msg.user_nick.should == "nick"
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# {[@|+]<channel><space>}
|
|
88
|
+
it_parses "319 nick user :@channel1 +channel2 #channel3" do |msg|
|
|
89
|
+
msg.nick.should == "nick"
|
|
90
|
+
msg.channels.should == %w|@channel1 +channel2 #channel3|
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# When replying to a WHOWAS msg, a server must use the replies
|
|
94
|
+
# WHOWASUSER, WHOISSERVER or ERR_WASNOSUCHNICK for each nickname in the
|
|
95
|
+
# presented list. At the end of all reply batches, there must be ENDOFWHOWAS
|
|
96
|
+
# (even if there was only one reply and it was an error).
|
|
97
|
+
it_parses "314 nick user host * :real name" do |msg|
|
|
98
|
+
msg.nick.should == "nick"
|
|
99
|
+
msg.user.should == "user"
|
|
100
|
+
msg.host.should == "host"
|
|
101
|
+
msg.realname.should == "real name"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it_parses "369 nick :End of WHOWAS" do |msg|
|
|
105
|
+
msg.nick.should == "nick"
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Replies LISTSTART, LIST, LISTEND mark the start, actual replies with data
|
|
109
|
+
# and end of the server's response to a LIST command. If there are no
|
|
110
|
+
# channels available to return, only the start and end reply must be sent.
|
|
111
|
+
it_parses "321 Channel :Users Name" do |msg|
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it_parses "322 emmanuel #channel 12 :some topic" do |msg|
|
|
115
|
+
msg.nick.should == "emmanuel"
|
|
116
|
+
msg.channel.should == "#channel"
|
|
117
|
+
msg.visible.should == "12"
|
|
118
|
+
msg.topic.should == "some topic"
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it_parses "323 Wiz :End of /LIST" do |msg|
|
|
122
|
+
msg.nick.should == "Wiz"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it_parses "324 Wiz #channel o params" do |msg|
|
|
126
|
+
msg.nick.should == "Wiz"
|
|
127
|
+
msg.channel.should == "#channel"
|
|
128
|
+
msg.mode.should == "o"
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# When sending a TOPIC msg to determine the channel topic, one of two
|
|
132
|
+
# replies is sent. If the topic is set, TOPIC is sent back else NOTOPIC.
|
|
133
|
+
it_parses "331 Wiz #channel :No topic is set" do |msg|
|
|
134
|
+
msg.nick.should == "Wiz"
|
|
135
|
+
msg.channel.should == "#channel"
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
it_parses "332 nick #channel :the topic" do |msg|
|
|
139
|
+
msg.nick.should == "nick"
|
|
140
|
+
msg.channel.should == "#channel"
|
|
141
|
+
msg.topic.should == "the topic"
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Returned by the server to indicate that the attempted INVITE msg was
|
|
145
|
+
# successful and is being passed onto the end client.
|
|
146
|
+
it_parses "341 Wiz #channel nick" do |msg|
|
|
147
|
+
msg.nick.should == "Wiz"
|
|
148
|
+
msg.channel.should == "#channel"
|
|
149
|
+
msg.nick_inv.should == "nick"
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Returned by a server answering a SUMMON msg to indicate that it is
|
|
153
|
+
# summoning that user.
|
|
154
|
+
it_parses "342 Wiz user :Summoning user to IRC" do |msg|
|
|
155
|
+
msg.nick = "Wiz"
|
|
156
|
+
msg.user.should == "user"
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Reply by the server showing its version details. The <version> is the
|
|
160
|
+
# version of the software being used (including any patchlevel revisions) and
|
|
161
|
+
# the <debuglevel> is used to indicate if the server is running in "debug
|
|
162
|
+
# mode". The "comments" field may contain any comments about the version or
|
|
163
|
+
# further version details.
|
|
164
|
+
it_parses "351 Wiz version.debuglevel server :the comments" do |msg|
|
|
165
|
+
msg.nick.should == "Wiz"
|
|
166
|
+
msg.version.should == "version.debuglevel"
|
|
167
|
+
msg.server.should == "server"
|
|
168
|
+
msg.comments.should == "the comments"
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# The WHOREPLY and ENDOFWHO pair are used to answer a WHO msg. The
|
|
172
|
+
# WHOREPLY is only sent if there is an appropriate match to the WHO query.
|
|
173
|
+
# If there is a list of parameters supplied with a WHO msg, a ENDOFWHO
|
|
174
|
+
# must be sent after processing each list item with <name> being the item.
|
|
175
|
+
it_parses "352 #channel user host server nick H*@ :10 John B. Jovi" do |msg| # <H|G>[*][@|+]
|
|
176
|
+
msg.channel.should == "#channel"
|
|
177
|
+
msg.user.should == "user"
|
|
178
|
+
msg.host.should == "host"
|
|
179
|
+
msg.server.should == "server"
|
|
180
|
+
msg.user_nick.should == "nick"
|
|
181
|
+
msg.flags.should == "H*@"
|
|
182
|
+
msg.format_postfix(:hopcount => "10", :realname => "John B. Jovi")
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
it_parses "315 Wiz name :End of /WHO list" do |msg|
|
|
186
|
+
msg.nick.should == "Wiz"
|
|
187
|
+
msg.pattern.should == "name"
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# To reply to a NAMES msg, a reply pair consisting of NAMREPLY and
|
|
191
|
+
# ENDOFNAMES is sent by the server back to the client. If there is no
|
|
192
|
+
# channel found as in the query, then only ENDOFNAMES is returned. The
|
|
193
|
+
# exception to this is when a NAMES msg is sent with no parameters and
|
|
194
|
+
# all visible channels and contents are sent back in a series of NAMEREPLY
|
|
195
|
+
# msgs with a ENDOFNAMES to mark the end.
|
|
196
|
+
it_parses "353 Wiz @ #channel :@nick1 +nick2 nick3" do |msg|
|
|
197
|
+
msg.nick.should == "Wiz"
|
|
198
|
+
msg.channel.should == "#channel"
|
|
199
|
+
msg.nicks_with_flags.should == %w|@nick1 +nick2 nick3|
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
it_parses "366 #channel :End of /NAMES list" do |msg|
|
|
203
|
+
msg.channel.should == "#channel"
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# In replying to the LINKS msg, a server must send replies back using the
|
|
207
|
+
# LINKS numeric and mark the end of the list using an ENDOFLINKS reply.
|
|
208
|
+
it_parses "364 Wiz mask server.com :10 server info" do |msg|
|
|
209
|
+
msg.nick.should == "Wiz"
|
|
210
|
+
msg.mask.should == "mask"
|
|
211
|
+
msg.server.should == "server.com"
|
|
212
|
+
msg.postfix.should == "10 server info"
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
it_parses "365 Wiz mask :End of /LINKS list" do |msg|
|
|
216
|
+
msg.nick = "Wiz"
|
|
217
|
+
msg.mask.should == "mask"
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# When listing the active 'bans' for a given channel, a server is required to
|
|
221
|
+
# send the list back using the BANLIST and ENDOFBANLIST msgs. A separate
|
|
222
|
+
# BANLIST is sent for each active banid. After the banids have been listed
|
|
223
|
+
# (or if none present) a ENDOFBANLIST must be sent.
|
|
224
|
+
it_parses "367 Wiz @channel banid" do |msg|
|
|
225
|
+
msg.channel.should == "@channel"
|
|
226
|
+
msg.ban_id.should == "banid"
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
it_parses "368 Wiz &channel :End of channel ban list" do |msg|
|
|
230
|
+
msg.channel.should == "&channel"
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# A server responding to an INFO msg is required to send all its 'info'
|
|
234
|
+
# in a series of INFO msgs with a ENDOFINFO reply to indicate the end of
|
|
235
|
+
# the replies.
|
|
236
|
+
it_parses "371 Wiz :Some Message" do |msg|
|
|
237
|
+
msg.info.should == "Some Message"
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
it_parses "374 Wiz :End of /INFO list" do |msg|
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# When responding to the MOTD msg and the MOTD file is found, the file is
|
|
244
|
+
# displayed line by line, with each line no longer than 80 characters, using
|
|
245
|
+
# MOTD format replies. These should be surrounded by a MOTDSTART (before the
|
|
246
|
+
# MOTDs) and an ENDOFMOTD (after).
|
|
247
|
+
it_parses "375 Wiz :- pepito.com Message of the day -" do |msg|
|
|
248
|
+
msg.postfix.should == "- pepito.com Message of the day -"
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
it_parses "372 Wiz :- This is the very cool motd" do |msg|
|
|
252
|
+
msg.postfix.should == "- This is the very cool motd"
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
it_parses "376 Wiz :End of /MOTD command" do |msg|
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# YOUREOPER is sent back to a client which has just successfully issued an
|
|
259
|
+
# OPER msg and gained operator status.
|
|
260
|
+
it_parses "381 Wiz :You are now an IRC operator" do |msg|
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
# If the REHASH option is used and an operator sends a REHASH msg, an
|
|
264
|
+
# REHASHING is sent back to the operator.
|
|
265
|
+
it_parses "382 Wiz config.sys :Rehashing" do |msg|
|
|
266
|
+
msg.config_file.should == "config.sys"
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# When replying to the TIME msg, a server must send the reply using the
|
|
270
|
+
# TIME format above. The string showing
|
|
271
|
+
# the time need only contain the correct day and time there. There is no
|
|
272
|
+
# further requirement for the time string.
|
|
273
|
+
it_parses "391 Wiz server.com :10:10pm" do |msg|
|
|
274
|
+
msg.server.should == "server.com"
|
|
275
|
+
msg.local_time.should == "10:10pm"
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# If the USERS msg is handled by a server, the replies it_generates
|
|
279
|
+
# USERSTART, USERS, ENDOFUSERS and it_generates
|
|
280
|
+
# NOUSERS are used. USERSSTART must be sent first, following by
|
|
281
|
+
# either a sequence of USERS or a single NOUSER.
|
|
282
|
+
# Following this is ENDOFUSERS.
|
|
283
|
+
it_parses "392 Wiz :UserID Terminal Host" do |msg|
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
it_parses "393 Wiz :012344567 012345678 01234567" do |msg|
|
|
287
|
+
msg.postfix.should == "012344567 012345678 01234567"
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
it_parses "394 Wiz :End of users" do |msg|
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
it_parses "395 Wiz :Nobody logged in" do |msg|
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# The TRACE* are all returned by the server in response to the
|
|
297
|
+
# TRACE msg. How many are returned is dependent on the the TRACE message
|
|
298
|
+
# and whether it was sent by an operator or not. There is no predefined
|
|
299
|
+
# order for which occurs first. Replies TRACEUNKNOWN,
|
|
300
|
+
# TRACECONNECTING and TRACEHANDSHAKE are all used
|
|
301
|
+
# for connections which have not been fully established and are either
|
|
302
|
+
# unknown, still attempting to connect or in the process of completing the
|
|
303
|
+
# 'server handshake'. TRACELINK is sent by any server which
|
|
304
|
+
# handles a TRACE msg and has to pass it on to another server. The list
|
|
305
|
+
# of TRACELINKs sent in response to a TRACE command traversing
|
|
306
|
+
# the IRC network should reflect the actual connectivity of the servers
|
|
307
|
+
# themselves along that path. TRACENEWTYPE is to be used for any
|
|
308
|
+
# connection which does not fit in the other categories but is being
|
|
309
|
+
# displayed anyway.
|
|
310
|
+
it_parses "200 Wiz Link 1.10 destination.com next_server.net" do |msg|
|
|
311
|
+
msg.version.should == "1.10"
|
|
312
|
+
msg.destination.should == "destination.com"
|
|
313
|
+
msg.next_server.should == "next_server.net"
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
it_parses "201 Wiz Try. class server" do |msg|
|
|
317
|
+
msg.klass.should == "class"
|
|
318
|
+
msg.server.should == "server"
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
it_parses "202 Wiz H.S. class server" do |msg|
|
|
322
|
+
msg.klass.should == "class"
|
|
323
|
+
msg.server.should == "server"
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
it_parses "203 Wiz ???? class 10.2.10.20" do |msg|
|
|
327
|
+
msg.klass.should == "class"
|
|
328
|
+
msg.ip_address.should == "10.2.10.20"
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
it_parses "204 Wiz Oper class nick" do |msg|
|
|
332
|
+
msg.nick.should == "Wiz"
|
|
333
|
+
msg.klass.should == "class"
|
|
334
|
+
msg.user_nick.should == "nick"
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
it_parses "205 Wiz User class nick" do |msg|
|
|
338
|
+
msg.nick.should == "Wiz"
|
|
339
|
+
msg.klass.should == "class"
|
|
340
|
+
msg.user_nick.should == "nick"
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
it_parses "206 Wiz Serv class 10S 20C server nick!user@host" do |msg|
|
|
344
|
+
msg.klass="class"
|
|
345
|
+
msg.intS="10S"
|
|
346
|
+
msg.intC="20C"
|
|
347
|
+
msg.server="server"
|
|
348
|
+
msg.identity="nick!user@host"""
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
it_parses "208 Wiz newtype 0 client_name" do |msg|
|
|
352
|
+
msg.new_type.should == "newtype"
|
|
353
|
+
msg.client_name.should == "client_name"
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
it_parses "261 Wiz File logfile.log 2000" do |msg|
|
|
357
|
+
msg.logfile.should == "logfile.log"
|
|
358
|
+
msg.debug_level.should == "2000"
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
# To answer a query about a client's own mode, UMODEIS is sent back.
|
|
362
|
+
it_parses "211 Wiz linkname sendq 123 2048 456 1024 100" do |msg|
|
|
363
|
+
msg.nick = "Wiz"
|
|
364
|
+
msg.linkname= "linkname"
|
|
365
|
+
msg.sendq= "sendq"
|
|
366
|
+
msg.sent_messages= "123"
|
|
367
|
+
msg.sent_bytes= "2048"
|
|
368
|
+
msg.received_messages= "456"
|
|
369
|
+
msg.received_bytes= "1024"
|
|
370
|
+
msg.time_open= "100"
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
it_parses "212 Wiz command 10" do |msg|
|
|
374
|
+
msg.command.should == "command"
|
|
375
|
+
msg.count.should == "10"
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
it_parses "213 Wiz C host * name 1232 class" do |msg|
|
|
379
|
+
msg.host.should == "host"
|
|
380
|
+
msg.name_param.should == "name"
|
|
381
|
+
msg.port.should == "1232"
|
|
382
|
+
msg.klass.should == "class"
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
it_parses "214 Wiz N host * name 1232 class" do |msg|
|
|
386
|
+
msg.host.should == "host"
|
|
387
|
+
msg.name_param.should == "name"
|
|
388
|
+
msg.port.should == "1232"
|
|
389
|
+
msg.klass.should == "class"
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
it_parses "215 Wiz I host1 * host2 1232 class" do |msg|
|
|
393
|
+
msg.host.should == "host1"
|
|
394
|
+
msg.second_host.should == "host2"
|
|
395
|
+
msg.port.should == "1232"
|
|
396
|
+
msg.klass.should == "class"
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
it_parses "216 Wiz K host * username 1232 class" do |msg|
|
|
400
|
+
msg.host.should == "host"
|
|
401
|
+
msg.username.should == "username"
|
|
402
|
+
msg.port.should == "1232"
|
|
403
|
+
msg.klass.should == "class"
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
it_parses "218 Wiz Y class 10 20 30" do |msg|
|
|
407
|
+
msg.klass.should == "class"
|
|
408
|
+
msg.ping_frequency.should == "10"
|
|
409
|
+
msg.connect_frequency.should == "20"
|
|
410
|
+
msg.max_sendq.should == "30"
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
it_parses "219 Wiz L :End of /STATS report" do |msg|
|
|
414
|
+
msg.stats_letter= "L"
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
it_parses "241 Wiz L hostmask * servername.com 20" do |msg|
|
|
418
|
+
msg.host_mask.should == "hostmask"
|
|
419
|
+
msg.server_name.should == "servername.com"
|
|
420
|
+
msg.max_depth.should == "20"
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
it_parses "242 Wiz :Server Up 20 days 10:30:30" do |msg|
|
|
424
|
+
msg.nick.should == "Wiz"
|
|
425
|
+
msg.postfix.should == "Server Up 20 days 10:30:30"
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
it_parses "243 Wiz O hostmask * name" do |msg|
|
|
429
|
+
msg.host_mask.should == "hostmask"
|
|
430
|
+
msg.name_param.should == "name"
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
it_parses "244 Wiz H hostmask * servername" do |msg|
|
|
434
|
+
msg.host_mask.should == "hostmask"
|
|
435
|
+
msg.server_name.should == "servername"
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
it_parses ":server 221 Wiz nick +i" do |msg|
|
|
439
|
+
msg.prefix.should == "server"
|
|
440
|
+
msg.nick.should == "Wiz"
|
|
441
|
+
msg.user_nick.should == "nick"
|
|
442
|
+
msg.flags.should == "+i"
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
# In processing an LUSERS msg, the server sends a set of replies from
|
|
446
|
+
# LUSERCLIENT, LUSEROP, USERUNKNOWN, it_generates
|
|
447
|
+
# LUSERCHANNELS and LUSERME. When replying, a server must send
|
|
448
|
+
# back LUSERCLIENT and LUSERME. The other replies are only sent
|
|
449
|
+
# back if a non-zero count is found for them.
|
|
450
|
+
it_parses "251 Wiz :There are 10 users and 20 invisible on 30 servers" do |msg|
|
|
451
|
+
msg.nick.should == "Wiz"
|
|
452
|
+
msg.postfix.should == "There are 10 users and 20 invisible on 30 servers"
|
|
453
|
+
end
|
|
454
|
+
|
|
455
|
+
it_parses "252 Wiz 10 :operator(s) online" do |msg|
|
|
456
|
+
msg.operator_count.should == "10"
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
it_parses "253 Wiz 7 :unknown connection(s)" do |msg|
|
|
460
|
+
msg.connections.should == "7"
|
|
461
|
+
end
|
|
462
|
+
|
|
463
|
+
it_parses "254 Wiz 3 :channels formed" do |msg|
|
|
464
|
+
msg.channels_count.should == "3"
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
it_parses "255 Wiz :I have 8 clients and 3 servers" do |msg|
|
|
468
|
+
msg.nick.should == "Wiz"
|
|
469
|
+
msg.postfix.should == "I have 8 clients and 3 servers"
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
# When replying to an ADMIN msg, a server is expected to use replies
|
|
473
|
+
# RLP_ADMINME through to ADMINEMAIL and provide a text msg with each.
|
|
474
|
+
# For ADMINLOC1 a description of what city, state and country the server is
|
|
475
|
+
# in is expected, followed by details of the university and department
|
|
476
|
+
# (ADMINLOC2) and finally the administrative contact for the server (an email
|
|
477
|
+
# address here is required) in ADMINEMAIL.
|
|
478
|
+
it_parses "256 Wiz server.com :Administrative info" do |msg|
|
|
479
|
+
msg.server.should == "server.com"
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
it_parses "257 Wiz :info" do |msg|
|
|
483
|
+
msg.info.should == "info"
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
it_parses "258 Wiz :info" do |msg|
|
|
487
|
+
msg.info.should == "info"
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
it_parses "259 Wiz :info" do |msg|
|
|
491
|
+
msg.info.should == "info"
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
#------------------------------------------------------------------------------
|
|
495
|
+
|
|
496
|
+
it_generates IRCParser::Messages::RplNone, "300 Wiz" do |msg|
|
|
497
|
+
msg.nick = "Wiz"
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
it_generates IRCParser::Messages::RplUserHost, "302 Wiz :user = +host" do |msg|
|
|
501
|
+
msg.nick = "Wiz"
|
|
502
|
+
msg.format_postfix(:users => "user", :host_with_sign => "+host")
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
it_generates IRCParser::Messages::RplIsOn, "303 Wiz :tony motola" do |msg|
|
|
507
|
+
msg.nick = "Wiz"
|
|
508
|
+
msg.nicks = ["tony", "motola"]
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
it_generates IRCParser::Messages::RplAway, "301 Wiz nick :away message" do |msg|
|
|
512
|
+
msg.nick = "Wiz"
|
|
513
|
+
msg.away_nick = "nick"
|
|
514
|
+
msg.postfix = "away message"
|
|
515
|
+
end
|
|
516
|
+
|
|
517
|
+
it_generates IRCParser::Messages::RplUnAway, "305 Wiz :You are no longer marked as being away" do |msg|
|
|
518
|
+
msg.nick = "Wiz"
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
it_generates IRCParser::Messages::RplNowAway, "306 Wiz :You have been marked as being away" do |msg|
|
|
522
|
+
msg.nick = "Wiz"
|
|
523
|
+
end
|
|
524
|
+
|
|
525
|
+
it_generates IRCParser::Messages::RplWhoIsUser, "311 Wiz nick user 192.192.192.192 * :real name" do |msg|
|
|
526
|
+
msg.nick = "Wiz"
|
|
527
|
+
msg.user_nick = "nick"
|
|
528
|
+
msg.user = "user"
|
|
529
|
+
msg.realname = "real name"
|
|
530
|
+
msg.ip = "192.192.192.192"
|
|
531
|
+
end
|
|
532
|
+
|
|
533
|
+
it_generates IRCParser::Messages::RplWhoIsServer, "312 nick user server :server info" do |msg|
|
|
534
|
+
msg.nick = "nick"
|
|
535
|
+
msg.user = "user"
|
|
536
|
+
msg.server = "server"
|
|
537
|
+
msg.info = "server info"
|
|
538
|
+
end
|
|
539
|
+
|
|
540
|
+
it_generates IRCParser::Messages::RplWhoIsOperator, "313 nick user :is an IRC operator" do |msg|
|
|
541
|
+
msg.user = "user"
|
|
542
|
+
msg.nick = "nick"
|
|
543
|
+
end
|
|
544
|
+
|
|
545
|
+
it_generates IRCParser::Messages::RplWhoIsIdle, "317 nick user 10 :seconds idle" do |msg|
|
|
546
|
+
msg.nick = "nick"
|
|
547
|
+
msg.user = "user"
|
|
548
|
+
msg.seconds = "10"
|
|
549
|
+
end
|
|
550
|
+
|
|
551
|
+
it_generates IRCParser::Messages::RplEndOfWhoIs, "318 Wiz nick :End of /WHOIS list" do |msg|
|
|
552
|
+
msg.nick = "Wiz"
|
|
553
|
+
msg.user_nick = "nick"
|
|
554
|
+
end
|
|
555
|
+
|
|
556
|
+
it_generates IRCParser::Messages::RplWhoIsChannels, "319 nick user :@channel1 +channel2 #channel3" do |msg|
|
|
557
|
+
msg.nick = "nick"
|
|
558
|
+
msg.user = "user"
|
|
559
|
+
msg.channels = %w|@channel1 +channel2 #channel3|
|
|
560
|
+
end
|
|
561
|
+
|
|
562
|
+
it_generates IRCParser::Messages::RplWhoWasUser, "314 nick user host * :real name" do |msg|
|
|
563
|
+
msg.nick = "nick"
|
|
564
|
+
msg.user = "user"
|
|
565
|
+
msg.host = "host"
|
|
566
|
+
msg.realname = "real name"
|
|
567
|
+
end
|
|
568
|
+
|
|
569
|
+
it_generates IRCParser::Messages::RplEndOfWhoWas, "369 nick :End of WHOWAS" do |msg|
|
|
570
|
+
msg.nick = "nick"
|
|
571
|
+
end
|
|
572
|
+
|
|
573
|
+
it_generates IRCParser::Messages::RplListStart, "321 Wiz Channel :Users Name" do |msg|
|
|
574
|
+
msg.nick = "Wiz"
|
|
575
|
+
end
|
|
576
|
+
|
|
577
|
+
it_generates IRCParser::Messages::RplList, "322 emmanuel #channel 12 :some topic" do |msg|
|
|
578
|
+
msg.nick= "emmanuel"
|
|
579
|
+
msg.channel = "#channel"
|
|
580
|
+
msg.visible = "12"
|
|
581
|
+
msg.topic = "some topic"
|
|
582
|
+
end
|
|
583
|
+
|
|
584
|
+
it_generates IRCParser::Messages::RplListEnd, "323 Wiz :End of /LIST" do |msg|
|
|
585
|
+
msg.nick = "Wiz"
|
|
586
|
+
end
|
|
587
|
+
|
|
588
|
+
it_generates IRCParser::Messages::RplChannelModeIs, "324 Wiz #channel o" do |msg|
|
|
589
|
+
msg.nick = "Wiz"
|
|
590
|
+
msg.channel = "#channel"
|
|
591
|
+
msg.mode = "o"
|
|
592
|
+
end
|
|
593
|
+
|
|
594
|
+
it_generates IRCParser::Messages::RplNoTopic, "331 Wiz #channel :No topic is set" do |msg|
|
|
595
|
+
msg.nick = "Wiz"
|
|
596
|
+
msg.channel = "#channel"
|
|
597
|
+
end
|
|
598
|
+
|
|
599
|
+
it_generates IRCParser::Messages::RplTopic, "332 nick #channel :the topic" do |msg|
|
|
600
|
+
msg.nick = "nick"
|
|
601
|
+
msg.channel = "#channel"
|
|
602
|
+
msg.topic = "the topic"
|
|
603
|
+
end
|
|
604
|
+
|
|
605
|
+
it_generates IRCParser::Messages::RplInviting, "341 Wiz #channel nick" do |msg|
|
|
606
|
+
msg.nick = "Wiz"
|
|
607
|
+
msg.channel = "#channel"
|
|
608
|
+
msg.nick_inv = "nick"
|
|
609
|
+
end
|
|
610
|
+
|
|
611
|
+
it_generates IRCParser::Messages::RplSummoning, "342 Wiz user :Summoning user to IRC" do |msg|
|
|
612
|
+
msg.nick = "Wiz"
|
|
613
|
+
msg.user = "user"
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
it_generates IRCParser::Messages::RplVersion, "351 Wiz version.debuglevel server :the comments" do |msg|
|
|
617
|
+
msg.nick = "Wiz"
|
|
618
|
+
msg.version = "version.debuglevel"
|
|
619
|
+
msg.server = "server"
|
|
620
|
+
msg.comments = "the comments"
|
|
621
|
+
end
|
|
622
|
+
|
|
623
|
+
it_generates IRCParser::Messages::RplWhoReply, "352 #channel user host server nick H*@ :10 John B. Jovi" do |msg| # <H|G>[*][@|+]
|
|
624
|
+
msg.channel = "#channel"
|
|
625
|
+
msg.user = "user"
|
|
626
|
+
msg.host = "host"
|
|
627
|
+
msg.server = "server"
|
|
628
|
+
msg.user_nick = "nick"
|
|
629
|
+
msg.flags = "H*@"
|
|
630
|
+
msg.here! true
|
|
631
|
+
msg.ircop! true
|
|
632
|
+
msg.opped! true
|
|
633
|
+
msg.format_postfix(:hopcount => 10, :realname => "John B. Jovi")
|
|
634
|
+
end
|
|
635
|
+
|
|
636
|
+
it_generates IRCParser::Messages::RplEndOfWho, "315 Wiz pattern :End of /WHO list" do |msg|
|
|
637
|
+
msg.nick = "Wiz"
|
|
638
|
+
msg.pattern = "pattern"
|
|
639
|
+
end
|
|
640
|
+
|
|
641
|
+
it_generates IRCParser::Messages::RplNamReply, "353 Wiz @ #channel :@nick1 +nick2 nick3" do |msg|
|
|
642
|
+
msg.nick= "Wiz"
|
|
643
|
+
msg.channel= "#channel"
|
|
644
|
+
msg.nicks_with_flags= %w|@nick1 +nick2 nick3|
|
|
645
|
+
end
|
|
646
|
+
|
|
647
|
+
it "can assign nicks to 353 replies", :focus => true do
|
|
648
|
+
m = IRCParser.message(:rpl_nam_reply) do |m|
|
|
649
|
+
m.nick = "Wiz"
|
|
650
|
+
m.channel, m.nicks_with_flags = "#chan", "Emmanuel"
|
|
651
|
+
end.to_s
|
|
652
|
+
m = IRCParser.parse(m.to_s)
|
|
653
|
+
m.nicks_with_flags.should == ["Emmanuel"]
|
|
654
|
+
end
|
|
655
|
+
|
|
656
|
+
it_generates IRCParser::Messages::RplEndOfNames, "366 #channel :End of /NAMES list" do |msg|
|
|
657
|
+
msg.channel = "#channel"
|
|
658
|
+
end
|
|
659
|
+
|
|
660
|
+
it_generates IRCParser::Messages::RplLinks, "364 Wiz mask server.com :10 server info" do |msg|
|
|
661
|
+
msg.nick = "Wiz"
|
|
662
|
+
msg.mask = "mask"
|
|
663
|
+
msg.server = "server.com"
|
|
664
|
+
msg.format_postfix(:hopcount => 10, :server_info => "server info")
|
|
665
|
+
end
|
|
666
|
+
|
|
667
|
+
it_generates IRCParser::Messages::RplEndOfLinks, "365 Wiz mask :End of /LINKS list" do |msg|
|
|
668
|
+
msg.nick = "Wiz"
|
|
669
|
+
msg.mask = "mask"
|
|
670
|
+
end
|
|
671
|
+
|
|
672
|
+
it_generates IRCParser::Messages::RplBanList, "367 Wiz @channel banid" do |msg|
|
|
673
|
+
msg.nick = "Wiz"
|
|
674
|
+
msg.channel = "@channel"
|
|
675
|
+
msg.ban_id = "banid"
|
|
676
|
+
end
|
|
677
|
+
|
|
678
|
+
it_generates IRCParser::Messages::RplEndOfBanList, "368 Wiz &channel :End of channel ban list" do |msg|
|
|
679
|
+
msg.nick = "Wiz"
|
|
680
|
+
msg.channel = "&channel"
|
|
681
|
+
end
|
|
682
|
+
|
|
683
|
+
it_generates IRCParser::Messages::RplInfo, "371 Wiz :Some Message" do |msg|
|
|
684
|
+
msg.nick = "Wiz"
|
|
685
|
+
msg.info = "Some Message"
|
|
686
|
+
end
|
|
687
|
+
|
|
688
|
+
it_generates IRCParser::Messages::RplEndOfInfo, "374 Wiz :End of /INFO list" do |msg|
|
|
689
|
+
msg.nick = "Wiz"
|
|
690
|
+
end
|
|
691
|
+
|
|
692
|
+
it_generates IRCParser::Messages::RplMotdStart, "375 Wiz :-pepito.com Message of the day-" do |msg|
|
|
693
|
+
msg.nick = "Wiz"
|
|
694
|
+
msg.format_postfix(:server => "pepito.com", :message => "Message of the day")
|
|
695
|
+
end
|
|
696
|
+
|
|
697
|
+
it_generates IRCParser::Messages::RplMotd, "372 Wiz :-This is the very cool motd" do |msg|
|
|
698
|
+
msg.nick = "Wiz"
|
|
699
|
+
msg.format_postfix(:motd => "This is the very cool motd")
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
it_generates IRCParser::Messages::RplEndOfMotd, "376 Wiz :End of /MOTD command" do |msg|
|
|
703
|
+
msg.nick = "Wiz"
|
|
704
|
+
end
|
|
705
|
+
|
|
706
|
+
it_generates IRCParser::Messages::RplYouReOper, "381 Wiz :You are now an IRC operator" do |msg|
|
|
707
|
+
msg.nick = "Wiz"
|
|
708
|
+
end
|
|
709
|
+
|
|
710
|
+
it_generates IRCParser::Messages::RplRehashing, "382 Wiz config.sys :Rehashing" do |msg|
|
|
711
|
+
msg.nick = "Wiz"
|
|
712
|
+
msg.config_file = "config.sys"
|
|
713
|
+
end
|
|
714
|
+
|
|
715
|
+
it_generates IRCParser::Messages::RplTime, "391 Wiz server.com :10:10pm" do |msg|
|
|
716
|
+
msg.nick = "Wiz"
|
|
717
|
+
msg.server = "server.com"
|
|
718
|
+
msg.local_time = "10:10pm"
|
|
719
|
+
end
|
|
720
|
+
|
|
721
|
+
it_generates IRCParser::Messages::RplUsersStart, "392 Wiz :UserID Terminal Host" do |msg|
|
|
722
|
+
msg.nick = "Wiz"
|
|
723
|
+
end
|
|
724
|
+
|
|
725
|
+
it_generates IRCParser::Messages::RplUsers, "393 Wiz :tony 42 fatso.com" do |msg|
|
|
726
|
+
msg.nick = "Wiz"
|
|
727
|
+
msg.format_postfix(:username => "tony", :ttyline => 42, :hostname => "fatso.com")
|
|
728
|
+
end
|
|
729
|
+
|
|
730
|
+
it_generates IRCParser::Messages::RplEndOfUsers, "394 Wiz :End of users" do |msg|
|
|
731
|
+
msg.nick = "Wiz"
|
|
732
|
+
end
|
|
733
|
+
|
|
734
|
+
it_generates IRCParser::Messages::RplNoUsers, "395 Wiz :Nobody logged in" do |msg|
|
|
735
|
+
msg.nick = "Wiz"
|
|
736
|
+
end
|
|
737
|
+
|
|
738
|
+
it_generates IRCParser::Messages::RplTraceLink, "200 Wiz Link 1.10 destination.com next_server.net" do |msg|
|
|
739
|
+
msg.nick = "Wiz"
|
|
740
|
+
msg.version = "1.10"
|
|
741
|
+
msg.destination = "destination.com"
|
|
742
|
+
msg.next_server = "next_server.net"
|
|
743
|
+
end
|
|
744
|
+
|
|
745
|
+
it_generates IRCParser::Messages::RplTraceConnecting, "201 Wiz Try. class server" do |msg|
|
|
746
|
+
msg.nick = "Wiz"
|
|
747
|
+
msg.klass = "class"
|
|
748
|
+
msg.server = "server"
|
|
749
|
+
end
|
|
750
|
+
|
|
751
|
+
it_generates IRCParser::Messages::RplTraceHandshake, "202 Wiz H.S. class server" do |msg|
|
|
752
|
+
msg.nick = "Wiz"
|
|
753
|
+
msg.klass = "class"
|
|
754
|
+
msg.server = "server"
|
|
755
|
+
end
|
|
756
|
+
|
|
757
|
+
it_generates IRCParser::Messages::RplTraceUnknown, "203 Wiz ???? class 10.2.10.20" do |msg|
|
|
758
|
+
msg.nick = "Wiz"
|
|
759
|
+
msg.klass = "class"
|
|
760
|
+
msg.ip_address = "10.2.10.20"
|
|
761
|
+
end
|
|
762
|
+
|
|
763
|
+
it_generates IRCParser::Messages::RplTraceOperator, "204 Wiz Oper class nick" do |msg|
|
|
764
|
+
msg.nick = "Wiz"
|
|
765
|
+
msg.klass = "class"
|
|
766
|
+
msg.user_nick = "nick"
|
|
767
|
+
end
|
|
768
|
+
|
|
769
|
+
it_generates IRCParser::Messages::RplTraceUser, "205 Wiz User class nick" do |msg|
|
|
770
|
+
msg.nick = "Wiz"
|
|
771
|
+
msg.klass = "class"
|
|
772
|
+
msg.user_nick = "nick"
|
|
773
|
+
end
|
|
774
|
+
|
|
775
|
+
it_generates IRCParser::Messages::RplTraceServer, "206 Wiz Serv class 10S 20C server nick!user@host" do |msg|
|
|
776
|
+
msg.nick = "Wiz"
|
|
777
|
+
msg.klass = "class"
|
|
778
|
+
msg.intS = "10S"
|
|
779
|
+
msg.intC = "20C"
|
|
780
|
+
msg.server = "server"
|
|
781
|
+
msg.identity = "nick!user@host"
|
|
782
|
+
end
|
|
783
|
+
|
|
784
|
+
it_generates IRCParser::Messages::RplTraceNewType, "208 Wiz newtype 0 client_name" do |msg|
|
|
785
|
+
msg.nick = "Wiz"
|
|
786
|
+
msg.new_type = "newtype"
|
|
787
|
+
msg.client_name = "client_name"
|
|
788
|
+
end
|
|
789
|
+
|
|
790
|
+
it_generates IRCParser::Messages::RplTraceLog, "261 Wiz File logfile.log 2000" do |msg|
|
|
791
|
+
msg.nick = "Wiz"
|
|
792
|
+
msg.logfile = "logfile.log"
|
|
793
|
+
msg.debug_level = "2000"
|
|
794
|
+
end
|
|
795
|
+
|
|
796
|
+
it_generates IRCParser::Messages::RplStatsLinkInfo, "211 Wiz linkname sendq 123 2048 456 1024 100" do |msg|
|
|
797
|
+
msg.nick = "Wiz"
|
|
798
|
+
msg.linkname= "linkname"
|
|
799
|
+
msg.sendq= "sendq"
|
|
800
|
+
msg.sent_messages= 123
|
|
801
|
+
msg.sent_bytes= 2048
|
|
802
|
+
msg.received_messages= 456
|
|
803
|
+
msg.received_bytes= 1024
|
|
804
|
+
msg.time_open= 100
|
|
805
|
+
end
|
|
806
|
+
|
|
807
|
+
it_generates IRCParser::Messages::RplStatsCommands, "212 Wiz command 10" do |msg|
|
|
808
|
+
msg.nick = "Wiz"
|
|
809
|
+
msg.command = "command"
|
|
810
|
+
msg.count = 10
|
|
811
|
+
end
|
|
812
|
+
|
|
813
|
+
it_generates IRCParser::Messages::RplStatsCLine, "213 Wiz C host * name 1232 class" do |msg|
|
|
814
|
+
msg.nick = "Wiz"
|
|
815
|
+
msg.host = "host"
|
|
816
|
+
msg.name_param = "name"
|
|
817
|
+
msg.port = "1232"
|
|
818
|
+
msg.klass = "class"
|
|
819
|
+
end
|
|
820
|
+
|
|
821
|
+
it_generates IRCParser::Messages::RplStatsNLine, "214 Wiz N host * name 1232 class" do |msg|
|
|
822
|
+
msg.nick = "Wiz"
|
|
823
|
+
msg.host = "host"
|
|
824
|
+
msg.name_param = "name"
|
|
825
|
+
msg.port = "1232"
|
|
826
|
+
msg.klass = "class"
|
|
827
|
+
end
|
|
828
|
+
|
|
829
|
+
it_generates IRCParser::Messages::RplStatsILine, "215 Wiz I host1 * host2 1232 class" do |msg|
|
|
830
|
+
msg.nick = "Wiz"
|
|
831
|
+
msg.host = "host1"
|
|
832
|
+
msg.second_host = "host2"
|
|
833
|
+
msg.port = "1232"
|
|
834
|
+
msg.klass = "class"
|
|
835
|
+
end
|
|
836
|
+
|
|
837
|
+
it_generates IRCParser::Messages::RplStatsKLine, "216 Wiz K host * username 1232 class" do |msg|
|
|
838
|
+
msg.nick = "Wiz"
|
|
839
|
+
msg.host = "host"
|
|
840
|
+
msg.username = "username"
|
|
841
|
+
msg.port = "1232"
|
|
842
|
+
msg.klass = "class"
|
|
843
|
+
end
|
|
844
|
+
|
|
845
|
+
it_generates IRCParser::Messages::RplStatsYLine, "218 Wiz Y class 10 20 30" do |msg|
|
|
846
|
+
msg.nick = "Wiz"
|
|
847
|
+
msg.klass = "class"
|
|
848
|
+
msg.ping_frequency = 10
|
|
849
|
+
msg.connect_frequency = 20
|
|
850
|
+
msg.max_sendq = 30
|
|
851
|
+
end
|
|
852
|
+
|
|
853
|
+
it_generates IRCParser::Messages::RplEndOfStats, "219 Wiz L :End of /STATS report" do |msg|
|
|
854
|
+
msg.nick = "Wiz"
|
|
855
|
+
msg.stats_letter= "L"
|
|
856
|
+
end
|
|
857
|
+
|
|
858
|
+
it_generates IRCParser::Messages::RplStatsLLine, "241 Wiz L hostmask * servername.com 20" do |msg|
|
|
859
|
+
msg.nick = "Wiz"
|
|
860
|
+
msg.host_mask = "hostmask"
|
|
861
|
+
msg.server_name = "servername.com"
|
|
862
|
+
msg.max_depth = 20
|
|
863
|
+
end
|
|
864
|
+
|
|
865
|
+
it_generates IRCParser::Messages::RplStatsUptime, "242 Wiz :Server Up 20 days 10:30:30" do |msg|
|
|
866
|
+
msg.nick = "Wiz"
|
|
867
|
+
msg.format_postfix(:days => 20, :time => "10:30:30")
|
|
868
|
+
end
|
|
869
|
+
|
|
870
|
+
it_generates IRCParser::Messages::RplStatsOLine, "243 Wiz O hostmask * name" do |msg|
|
|
871
|
+
msg.nick = "Wiz"
|
|
872
|
+
msg.host_mask = "hostmask"
|
|
873
|
+
msg.name_param = "name"
|
|
874
|
+
end
|
|
875
|
+
|
|
876
|
+
it_generates IRCParser::Messages::RplStatsHLine, "244 Wiz H hostmask * servername" do |msg|
|
|
877
|
+
msg.nick = "Wiz"
|
|
878
|
+
msg.host_mask = "hostmask"
|
|
879
|
+
msg.server_name = "servername"
|
|
880
|
+
end
|
|
881
|
+
|
|
882
|
+
it_generates IRCParser::Messages::RplUModeIs, ":server 221 Wiz nick +i" do |msg|
|
|
883
|
+
msg.prefix = "server"
|
|
884
|
+
msg.nick = "Wiz"
|
|
885
|
+
msg.user_nick = "nick"
|
|
886
|
+
msg.flags = "+i"
|
|
887
|
+
end
|
|
888
|
+
|
|
889
|
+
it_generates IRCParser::Messages::RplLUserClient, "251 Wiz :There are 10 users and 20 invisible on 30 servers" do |msg|
|
|
890
|
+
msg.nick = "Wiz"
|
|
891
|
+
msg.format_postfix(:users_count => 10, :invisible_count => 20, :servers => 30)
|
|
892
|
+
end
|
|
893
|
+
|
|
894
|
+
it_generates IRCParser::Messages::RplLUserOp, "252 Wiz 10 :operator(s) online" do |msg|
|
|
895
|
+
msg.nick = "Wiz"
|
|
896
|
+
msg.operator_count = 10
|
|
897
|
+
end
|
|
898
|
+
|
|
899
|
+
it_generates IRCParser::Messages::RplLUserUnknown, "253 Wiz 7 :unknown connection(s)" do |msg|
|
|
900
|
+
msg.nick = "Wiz"
|
|
901
|
+
msg.connections = 7
|
|
902
|
+
end
|
|
903
|
+
|
|
904
|
+
it_generates IRCParser::Messages::RplLUserChannels, "254 Wiz 3 :channels formed" do |msg|
|
|
905
|
+
msg.nick = "Wiz"
|
|
906
|
+
msg.channels_count = 3
|
|
907
|
+
end
|
|
908
|
+
|
|
909
|
+
it_generates IRCParser::Messages::RplLUserMe, "255 Wiz :I have 8 clients and 3 servers" do |msg|
|
|
910
|
+
msg.nick = "Wiz"
|
|
911
|
+
msg.format_postfix(:clients_count => 8, :servers_count => 3)
|
|
912
|
+
end
|
|
913
|
+
|
|
914
|
+
it_generates IRCParser::Messages::RplAdminMe, "256 Wiz server.com :Administrative info" do |msg|
|
|
915
|
+
msg.nick = "Wiz"
|
|
916
|
+
msg.server = "server.com"
|
|
917
|
+
end
|
|
918
|
+
|
|
919
|
+
it_generates IRCParser::Messages::RplAdminLoc1, "257 Wiz :info" do |msg|
|
|
920
|
+
msg.nick = "Wiz"
|
|
921
|
+
msg.info = "info"
|
|
922
|
+
end
|
|
923
|
+
|
|
924
|
+
it_generates IRCParser::Messages::RplAdminLoc2, "258 Wiz :info" do |msg|
|
|
925
|
+
msg.nick = "Wiz"
|
|
926
|
+
msg.info = "info"
|
|
927
|
+
end
|
|
928
|
+
|
|
929
|
+
it_generates IRCParser::Messages::RplAdminEmail, "259 Wiz :info" do |msg|
|
|
930
|
+
msg.nick = "Wiz"
|
|
931
|
+
msg.info = "info"
|
|
932
|
+
end
|
|
933
|
+
|
|
934
|
+
end
|