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 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
- # <IRCParser::Messages::Privmsg:0x00000001476370 @params=["Wiz", "Hello are you receiving this message?"], @prefix="Angel">
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
- msg = IRCParser.message(:privmsg) do |m|
79
- msg.from = "Wiz"
80
- msg.target = "Angel"
81
- msg.body = "Hello World!"
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
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'irc_parser'
7
- s.version = '0.1.0'
7
+ s.version = '0.1.1'
8
8
  s.date = '2011-08-08'
9
9
  s.rubyforge_project = 'irc_parser'
10
10
 
data/lib/irc_parser.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module IRCParser
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
 
4
4
  autoload :Helper, 'irc_parser/helper'
5
5
  autoload :Params, 'irc_parser/params'
@@ -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
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: irc_parser
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Emmanuel Oga