irc_parser 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -7
- data/irc_parser.gemspec +1 -1
- data/lib/irc_parser.rb +1 -1
- data/lib/irc_parser/messages/errors.rb +1 -1
- data/lib/irc_parser/messages/replies.rb +2 -2
- data/spec/irc_parser/rfc1459/6_0_replies/6_1_error_parsing_spec.rb +2 -1
- data/spec/irc_parser/rfc1459/6_0_replies/6_2_command_responses_generation_spec.rb +4 -2
- metadata +1 -1
data/README.md
CHANGED
@@ -50,7 +50,7 @@ To get a subclass of IRCParser::Message instead of an array of components:
|
|
50
50
|
```ruby
|
51
51
|
require 'irc_parser/messages'
|
52
52
|
msg = IRCParser.parse(":Angel PRIVMSG Wiz :Hello are you receiving this message?\r\n")
|
53
|
-
|
53
|
+
#<struct Struct::IRCPrivMsg prefix="Angel", target="Wiz", postfix="Hello are you receiving this message?">
|
54
54
|
|
55
55
|
msg.identifier # => "PRIVMSG"
|
56
56
|
msg.to_sym # => :priv_msg
|
@@ -75,12 +75,11 @@ There is also a shortcut:
|
|
75
75
|
|
76
76
|
```ruby
|
77
77
|
require 'irc_parser/messages'
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
83
|
-
msg.to_s # => ":Wiz PRIVMSG Angel :Hello World!\r\n"
|
78
|
+
IRCParser.message(:privmsg) do |m|
|
79
|
+
m.from = "Wiz"
|
80
|
+
m.target = "Angel"
|
81
|
+
m.body = "Hello World!"
|
82
|
+
end.to_s # => ":Wiz PRIVMSG Angel :Hello World!\r\n"
|
84
83
|
```
|
85
84
|
|
86
85
|
## TODO
|
data/irc_parser.gemspec
CHANGED
data/lib/irc_parser.rb
CHANGED
@@ -11,7 +11,7 @@ module IRCParser::Messages
|
|
11
11
|
define_message :ErrNoTextToSend , '412', :nick, "No text to send"
|
12
12
|
define_message :ErrNoTopLevel , '413', :nick, :mask, "No toplevel domain specified"
|
13
13
|
define_message :ErrWildTopLevel , '414', :nick, :mask, "Wildcard in toplevel domain"
|
14
|
-
define_message :ErrUnknownCommand , '421', :command, "Unknown command"
|
14
|
+
define_message :ErrUnknownCommand , '421', :nick, :command, "Unknown command"
|
15
15
|
define_message :ErrNoMotd , '422', :nick, "MOTD File is missing"
|
16
16
|
define_message :ErrNoAdminInfo , '423', :nick, :server, "No administrative info available"
|
17
17
|
define_message :ErrFileError , '424', :nick, "File error doing %{fileop} on %{file}"
|
@@ -132,7 +132,7 @@ module IRCParser::Messages
|
|
132
132
|
# 352 channel username address server nick flags :hops info
|
133
133
|
# 352 #peace&protection IsaacHayes sdn-ar-004mokcitP324.dialsprint.net NewBrunswick.NJ.US.Undernet.Org DrDthmtch H+ :4 Isaac Hayes (QuickScript.ml.org)
|
134
134
|
# Flags: <H|G>[*][@|+] (here, gone)
|
135
|
-
define_message :RplWhoReply, "352", :channel, :user, :host, :server, :user_nick, :flags, "%{hopcount} %{realname}" do
|
135
|
+
define_message :RplWhoReply, "352", :nick, :channel, :user, :host, :server, :user_nick, :flags, "%{hopcount} %{realname}" do
|
136
136
|
FLAGS_INDEX_ON_PARAMS = 6
|
137
137
|
|
138
138
|
FLAGS = {
|
@@ -193,7 +193,7 @@ module IRCParser::Messages
|
|
193
193
|
|
194
194
|
# http://www.mirc.net/raws/?view=366
|
195
195
|
# :rpl_end_of_names >> :sendak.freenode.net 366 emmanuel #pipita2 :End of /NAMES list.
|
196
|
-
define_message :RplEndOfNames, '366', :channel, "End of /NAMES list"
|
196
|
+
define_message :RplEndOfNames, '366', :nick, :channel, "End of /NAMES list"
|
197
197
|
|
198
198
|
# Not Used / Reserved ( http://tools.ietf.org/html/rfc1459#section-6.3
|
199
199
|
# RplTraceClass , '209'
|
@@ -81,7 +81,8 @@ describe IRCParser, "error replies" do
|
|
81
81
|
|
82
82
|
# Returned to a registered client to indicate that the command sent is
|
83
83
|
# unknown by the server.
|
84
|
-
it_parses "421 PILDONGA :Unknown command" do |msg|
|
84
|
+
it_parses "421 nick PILDONGA :Unknown command" do |msg|
|
85
|
+
msg.nick.should == "nick"
|
85
86
|
msg.command.should == "PILDONGA"
|
86
87
|
end
|
87
88
|
|
@@ -172,7 +172,8 @@ describe IRCParser, "command responses" do
|
|
172
172
|
# WHOREPLY is only sent if there is an appropriate match to the WHO query.
|
173
173
|
# If there is a list of parameters supplied with a WHO msg, a ENDOFWHO
|
174
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>[*][@|+]
|
175
|
+
it_parses "352 nick #channel user host server nick H*@ :10 John B. Jovi" do |msg| # <H|G>[*][@|+]
|
176
|
+
msg.nick.should == "nick"
|
176
177
|
msg.channel.should == "#channel"
|
177
178
|
msg.user.should == "user"
|
178
179
|
msg.host.should == "host"
|
@@ -199,7 +200,8 @@ describe IRCParser, "command responses" do
|
|
199
200
|
msg.nicks_with_flags.should == %w|@nick1 +nick2 nick3|
|
200
201
|
end
|
201
202
|
|
202
|
-
it_parses "366 #channel :End of /NAMES list" do |msg|
|
203
|
+
it_parses "366 nick #channel :End of /NAMES list" do |msg|
|
204
|
+
msg.nick.should == "nick"
|
203
205
|
msg.channel.should == "#channel"
|
204
206
|
end
|
205
207
|
|