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,30 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing version msg" do
|
|
4
|
+
|
|
5
|
+
# ; msg from Wiz to check the version of a server matching "*.se"
|
|
6
|
+
it_parses ":Wiz VERSION *.se" do |msg|
|
|
7
|
+
msg.prefix.should == "Wiz"
|
|
8
|
+
msg.server.should == "*.se"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# ; check the version of server "tolsun.oulu.fi".
|
|
12
|
+
it_parses "VERSION tolsun.oulu.fi" do |msg|
|
|
13
|
+
msg.prefix.should be_nil
|
|
14
|
+
msg.server.should == "tolsun.oulu.fi"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
# ; msg from Wiz to check the version of a server matching "*.se"
|
|
20
|
+
it_generates IRCParser::Messages::Version, ":Wiz VERSION *.se" do |msg|
|
|
21
|
+
msg.prefix= "Wiz"
|
|
22
|
+
msg.server= "*.se"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# ; check the version of server "tolsun.oulu.fi".
|
|
26
|
+
it_generates IRCParser::Messages::Version, "VERSION tolsun.oulu.fi" do |msg|
|
|
27
|
+
msg.server= "tolsun.oulu.fi"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing stats msg" do
|
|
4
|
+
|
|
5
|
+
# ; check the command usage for the server you are connected to
|
|
6
|
+
it_parses "STATS m" do |msg|
|
|
7
|
+
msg.prefix.should be_nil
|
|
8
|
+
msg.mode.should == "m"
|
|
9
|
+
msg.server.should be_nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# ; request by WiZ for C/N line information from server eff.org
|
|
13
|
+
it_parses ":Wiz STATS c eff.org" do |msg|
|
|
14
|
+
msg.prefix.should == "Wiz"
|
|
15
|
+
msg.mode.should == "c"
|
|
16
|
+
msg.server.should == "eff.org"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
#------------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
# ; check the command usage for the server you are connected to
|
|
22
|
+
it_generates IRCParser::Messages::Stats, "STATS m" do |msg|
|
|
23
|
+
msg.mode= "m"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# ; request by WiZ for C/N line information from server eff.org
|
|
27
|
+
it_generates IRCParser::Messages::Stats, ":Wiz STATS c eff.org" do |msg|
|
|
28
|
+
msg.prefix= "Wiz"
|
|
29
|
+
msg.mode= "c"
|
|
30
|
+
msg.server= "eff.org"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing links msg" do
|
|
4
|
+
|
|
5
|
+
# ; list all servers which have a name that matches *.au;
|
|
6
|
+
it_parses "LINKS *.au" do |msg|
|
|
7
|
+
msg.remote_server.should == "*.au"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# ; LINKS msg prefix WiZ to the first server matching *.edu for a list of servers matching *.bu.edu.
|
|
11
|
+
it_parses ":WiZ LINKS *.bu.edu *.edu" do |msg|
|
|
12
|
+
msg.prefix.should == "WiZ"
|
|
13
|
+
msg.remote_server.should == "*.bu.edu"
|
|
14
|
+
msg.server_mask.should == "*.edu"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
# ; list all servers which have a name that matches *.au;
|
|
20
|
+
it_generates IRCParser::Messages::Links, "LINKS *.au" do |msg|
|
|
21
|
+
msg.server_mask= "*.au"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# ; LINKS msg prefix WiZ to the first server matching *.edu for a list of servers matching *.bu.edu.
|
|
25
|
+
it_generates IRCParser::Messages::Links, ":WiZ LINKS *.bu.edu *.edu" do |msg|
|
|
26
|
+
msg.prefix= "WiZ"
|
|
27
|
+
msg.remote_server= "*.bu.edu"
|
|
28
|
+
msg.server_mask= "*.edu"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing time msg" do
|
|
4
|
+
|
|
5
|
+
it_parses "TIME" do |msg|
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# ; check the time on the server "tolson.oulu.fi"
|
|
9
|
+
it_parses "TIME tolsun.oulu.fi" do |msg|
|
|
10
|
+
msg.for_server.should == "tolsun.oulu.fi"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# ; user angel checking the time on a server matching "*.au"
|
|
14
|
+
it_parses ":Angel TIME *.au" do |msg|
|
|
15
|
+
msg.prefix.should == "Angel"
|
|
16
|
+
msg.for_server.should == "*.au"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
#------------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
it_generates IRCParser::Messages::Time, "TIME" do |msg|
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# ; check the time on the server "tolson.oulu.fi"
|
|
25
|
+
it_generates IRCParser::Messages::Time, "TIME tolsun.oulu.fi" do |msg|
|
|
26
|
+
msg.for_server= "tolsun.oulu.fi"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# ; user angel checking the time on a server matching "*.au"
|
|
30
|
+
it_generates IRCParser::Messages::Time, ":Angel TIME *.au" do |msg|
|
|
31
|
+
msg.prefix= "Angel"
|
|
32
|
+
msg.for_server= "*.au"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing connect msg" do
|
|
4
|
+
|
|
5
|
+
# ; Attempt to connect a server to tolsun.oulu.fi
|
|
6
|
+
it_parses "CONNECT tolsun.oulu.fi" do |msg|
|
|
7
|
+
msg.target_server.should == "tolsun.oulu.fi"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# ; CONNECT attempt by WiZ to get servers eff.org and csd.bu.edu connected on port 6667.
|
|
11
|
+
it_parses ":WiZ CONNECT eff.org 6667 csd.bu.edu" do |msg|
|
|
12
|
+
msg.prefix.should == "WiZ"
|
|
13
|
+
msg.target_server.should == "eff.org"
|
|
14
|
+
msg.port.should == "6667"
|
|
15
|
+
msg.remote_server.should == "csd.bu.edu"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
#------------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
# ; Attempt to connect a server to tolsun.oulu.fi
|
|
21
|
+
it_generates IRCParser::Messages::Connect, "CONNECT tolsun.oulu.fi" do |msg|
|
|
22
|
+
msg.target_server= "tolsun.oulu.fi"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# ; CONNECT attempt by WiZ to get servers eff.org and csd.bu.edu connected on port 6667.
|
|
26
|
+
it_generates IRCParser::Messages::Connect, ":WiZ CONNECT eff.org 6667 csd.bu.edu" do |msg|
|
|
27
|
+
msg.prefix= "WiZ"
|
|
28
|
+
msg.target_server= "eff.org"
|
|
29
|
+
msg.port= "6667"
|
|
30
|
+
msg.remote_server= "csd.bu.edu"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing trace msg" do
|
|
4
|
+
|
|
5
|
+
# ; TRACE to a target matching *.oulu.fi
|
|
6
|
+
it_parses "TRACE *.oulu.fi" do |msg|
|
|
7
|
+
msg.target.should == "*.oulu.fi"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# ; TRACE issued by WiZ to nick AngelDust
|
|
11
|
+
it_parses ":WiZ TRACE AngelDust" do |msg|
|
|
12
|
+
msg.prefix.should == "WiZ"
|
|
13
|
+
msg.target.should == "AngelDust"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
#------------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
# ; TRACE to a target matching *.oulu.fi
|
|
19
|
+
it_generates IRCParser::Messages::Trace, "TRACE *.oulu.fi" do |msg|
|
|
20
|
+
msg.target= "*.oulu.fi"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# ; TRACE issued by WiZ to nick AngelDust
|
|
24
|
+
it_generates IRCParser::Messages::Trace, ":WiZ TRACE AngelDust" do |msg|
|
|
25
|
+
msg.prefix= "WiZ"
|
|
26
|
+
msg.target= "AngelDust"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing admin command" do
|
|
4
|
+
|
|
5
|
+
# ; request an ADMIN reply from tolsun.oulu.fi
|
|
6
|
+
it_parses "ADMIN tolsun.oulu.fi" do |msg|
|
|
7
|
+
msg.target.should == "tolsun.oulu.fi"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# ; ADMIN request from WiZ for first target found to match *.edu.
|
|
11
|
+
it_parses ":WiZ ADMIN *.edu" do |msg|
|
|
12
|
+
msg.prefix.should == "WiZ"
|
|
13
|
+
msg.target.should == "*.edu"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
#------------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
# ; request an ADMIN reply from tolsun.oulu.fi
|
|
19
|
+
it_generates IRCParser::Messages::Admin, "ADMIN tolsun.oulu.fi" do |msg|
|
|
20
|
+
msg.target= "tolsun.oulu.fi"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# ; ADMIN request from WiZ for first target found to match *.edu.
|
|
24
|
+
it_generates IRCParser::Messages::Admin, ":WiZ ADMIN *.edu" do |msg|
|
|
25
|
+
msg.prefix= "WiZ"
|
|
26
|
+
msg.target= "*.edu"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing info command" do
|
|
4
|
+
|
|
5
|
+
# ; request an INFO reply from csd.bu.edu
|
|
6
|
+
it_parses "INFO csd.bu.edu" do |msg|
|
|
7
|
+
msg.target.should == "csd.bu.edu"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# ; INFO request from Avalon for first target found to match *.fi.
|
|
11
|
+
it_parses ":Avalon INFO *.fi" do |msg|
|
|
12
|
+
msg.prefix.should == "Avalon"
|
|
13
|
+
msg.target.should == "*.fi"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# ; request info from the target that Angel is connected to.
|
|
17
|
+
it_parses "INFO Angel" do |msg|
|
|
18
|
+
msg.target.should == "Angel"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
#------------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
# ; request an INFO reply from csd.bu.edu
|
|
24
|
+
it_generates IRCParser::Messages::Info, "INFO csd.bu.edu" do |msg|
|
|
25
|
+
msg.target= "csd.bu.edu"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# ; INFO request from Avalon for first target found to match *.fi.
|
|
29
|
+
it_generates IRCParser::Messages::Info, ":Avalon INFO *.fi" do |msg|
|
|
30
|
+
msg.prefix= "Avalon"
|
|
31
|
+
msg.target= "*.fi"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# ; request info from the target that Angel is connected to.
|
|
35
|
+
it_generates IRCParser::Messages::Info, "INFO Angel" do |msg|
|
|
36
|
+
msg.target= "Angel"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing private msgs" do
|
|
4
|
+
|
|
5
|
+
# ; Message from Angel to Wiz.
|
|
6
|
+
it_parses ":Angel PRIVMSG Wiz :Hello are you receiving this message ?" do |msg|
|
|
7
|
+
msg.prefix.should == "Angel"
|
|
8
|
+
msg.target.should == "Wiz"
|
|
9
|
+
msg.body.should == "Hello are you receiving this message ?"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# ; Message to Angel.
|
|
13
|
+
it_parses "PRIVMSG Angel :yes I'm receiving it !receiving it !'u>(768u+1n) .br" do |msg|
|
|
14
|
+
msg.target.should == "Angel"
|
|
15
|
+
msg.body.should == "yes I'm receiving it !receiving it !'u>(768u+1n) .br"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# ; Message to a client on server tolsun.oulu.fi with username of "jto".
|
|
19
|
+
it_parses "PRIVMSG jto@tolsun.oulu.fi :Hello !" do |msg|
|
|
20
|
+
msg.target.should == "jto@tolsun.oulu.fi"
|
|
21
|
+
msg.body.should == "Hello !"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# ; Message to everyone on a server which has a name matching *.fi.
|
|
25
|
+
it_parses "PRIVMSG $*.fi :Server tolsun.oulu.fi rebooting." do |msg|
|
|
26
|
+
msg.server_pattern.should == /.*\.fi/
|
|
27
|
+
msg.body.should == "Server tolsun.oulu.fi rebooting."
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# ; Message to all users who come from a host which has a name matching *.edu.
|
|
31
|
+
it_parses "PRIVMSG #*.edu :NSFNet is undergoing work, expect interruptions" do |msg|
|
|
32
|
+
msg.host_pattern.should == /.*\.edu/
|
|
33
|
+
msg.body.should == "NSFNet is undergoing work, expect interruptions"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
#------------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
it_generates IRCParser::Messages::PrivMsg, ":Angel PRIVMSG Wiz :Hello are you receiving this message ?" do |msg|
|
|
39
|
+
msg.prefix= "Angel"
|
|
40
|
+
msg.target= "Wiz"
|
|
41
|
+
msg.body= "Hello are you receiving this message ?"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it_generates IRCParser::Messages::PrivMsg, "PRIVMSG Angel :yes I'm receiving it !receiving it !'u>(768u+1n) .br" do |msg|
|
|
45
|
+
msg.target= "Angel"
|
|
46
|
+
msg.body= "yes I'm receiving it !receiving it !'u>(768u+1n) .br"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it_generates IRCParser::Messages::PrivMsg, "PRIVMSG jto@tolsun.oulu.fi :Hello !" do |msg|
|
|
50
|
+
msg.target= "jto@tolsun.oulu.fi"
|
|
51
|
+
msg.body= "Hello !"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it_generates IRCParser::Messages::PrivMsg, "PRIVMSG $*.fi :Server tolsun.oulu.fi rebooting." do |msg|
|
|
55
|
+
msg.target= "$*.fi"
|
|
56
|
+
msg.body= "Server tolsun.oulu.fi rebooting."
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it_generates IRCParser::Messages::PrivMsg, "PRIVMSG #*.edu :NSFNet is undergoing work, expect interruptions" do |msg|
|
|
60
|
+
msg.target= "#*.edu"
|
|
61
|
+
msg.body= "NSFNet is undergoing work, expect interruptions"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing notice" do
|
|
4
|
+
|
|
5
|
+
# ; Message from Angel to Wiz.
|
|
6
|
+
it_parses ":Angel NOTICE Wiz :Hello are you receiving this message ?" do |msg|
|
|
7
|
+
msg.prefix.should == "Angel"
|
|
8
|
+
msg.target.should == "Wiz"
|
|
9
|
+
msg.body.should == "Hello are you receiving this message ?"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# ; Message to Angel.
|
|
13
|
+
it_parses "NOTICE Angel :yes I'm receiving it !receiving it !'u>(768u+1n) .br" do |msg|
|
|
14
|
+
msg.target.should == "Angel"
|
|
15
|
+
msg.body.should == "yes I'm receiving it !receiving it !'u>(768u+1n) .br"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# ; Message to a client on server tolsun.oulu.fi with username of "jto".
|
|
19
|
+
it_parses "NOTICE jto@tolsun.oulu.fi :Hello !" do |msg|
|
|
20
|
+
msg.target.should == "jto@tolsun.oulu.fi"
|
|
21
|
+
msg.body.should == "Hello !"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# ; Message to everyone on a server which has a name matching *.fi.
|
|
25
|
+
it_parses "NOTICE $*.fi :Server tolsun.oulu.fi rebooting." do |msg|
|
|
26
|
+
msg.server_pattern.should == /.*\.fi/
|
|
27
|
+
msg.body.should == "Server tolsun.oulu.fi rebooting."
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# ; Message to all users who come from a host which has a name matching *.edu.
|
|
31
|
+
it_parses "NOTICE #*.edu :NSFNet is undergoing work, expect interruptions" do |msg|
|
|
32
|
+
msg.host_pattern.should == /.*\.edu/
|
|
33
|
+
msg.body.should == "NSFNet is undergoing work, expect interruptions"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
#------------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
it_generates IRCParser::Messages::Notice, ":Angel NOTICE Wiz :Hello are you receiving this message ?" do |msg|
|
|
39
|
+
msg.prefix= "Angel"
|
|
40
|
+
msg.target= "Wiz"
|
|
41
|
+
msg.body= "Hello are you receiving this message ?"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it_generates IRCParser::Messages::Notice, "NOTICE Angel :yes I'm receiving it !receiving it !'u>(768u+1n) .br" do |msg|
|
|
45
|
+
msg.target= "Angel"
|
|
46
|
+
msg.body= "yes I'm receiving it !receiving it !'u>(768u+1n) .br"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it_generates IRCParser::Messages::Notice, "NOTICE jto@tolsun.oulu.fi :Hello !" do |msg|
|
|
50
|
+
msg.target= "jto@tolsun.oulu.fi"
|
|
51
|
+
msg.body= "Hello !"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it_generates IRCParser::Messages::Notice, "NOTICE $*.fi :Server tolsun.oulu.fi rebooting." do |msg|
|
|
55
|
+
msg.target= "$*.fi"
|
|
56
|
+
msg.body= "Server tolsun.oulu.fi rebooting."
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it_generates IRCParser::Messages::Notice, "NOTICE #*.edu :NSFNet is undergoing work, expect interruptions" do |msg|
|
|
60
|
+
msg.target= "#*.edu"
|
|
61
|
+
msg.body= "NSFNet is undergoing work, expect interruptions"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing who query" do
|
|
4
|
+
# Parameters: [<name> [<o>]]
|
|
5
|
+
|
|
6
|
+
# ; List all users who match against "*.fi".
|
|
7
|
+
it_parses "WHO *.fi" do |msg|
|
|
8
|
+
msg.pattern.should == "*.fi"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# ; List all users with a match against "jto*" if they are an operator.
|
|
12
|
+
it_parses "WHO jto* o" do |msg|
|
|
13
|
+
msg.pattern.should == "jto*"
|
|
14
|
+
msg.should be_operator
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
it_generates IRCParser::Messages::Who, "WHO *.fi" do |msg|
|
|
20
|
+
msg.pattern= "*.fi"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it_generates IRCParser::Messages::Who, "WHO jto* o" do |msg|
|
|
24
|
+
msg.pattern= "jto*"
|
|
25
|
+
msg.operator!
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IRCParser, "parsing whois query" do
|
|
4
|
+
# Parameters: [<server>] <nickpattern>[,<nickpattern>[,...]]
|
|
5
|
+
|
|
6
|
+
# ; return available user information about nick WiZ
|
|
7
|
+
it_parses "WHOIS wiz" do |msg|
|
|
8
|
+
msg.pattern.should == "wiz"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# ; ask server eff.org for user information about trillian
|
|
12
|
+
it_parses "WHOIS eff.org trillian" do |msg|
|
|
13
|
+
msg.target.should == "eff.org"
|
|
14
|
+
msg.pattern.should == "trillian"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
it_generates IRCParser::Messages::WhoIs, "WHOIS wiz" do |msg|
|
|
20
|
+
msg.target= "wiz"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it_generates IRCParser::Messages::WhoIs, "WHOIS eff.org trillian" do |msg|
|
|
24
|
+
msg.target= "eff.org"
|
|
25
|
+
msg.pattern= "trillian"
|
|
26
|
+
end
|
|
27
|
+
end
|