net-yail 1.3.0 → 1.3.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.
data/lib/net/yail.rb CHANGED
@@ -230,7 +230,7 @@ class YAIL
230
230
  include Net::IRCEvents::Defaults
231
231
  include Net::IRCOutputAPI
232
232
 
233
- VERSION = '1.3.0'
233
+ VERSION = '1.3.1'
234
234
 
235
235
  attr_reader(
236
236
  :me, # Nickname on the IRC server
@@ -19,7 +19,9 @@ class MessageParser
19
19
 
20
20
  # Note that all regexes are non-greedy. I'm scared of greedy regexes, sirs.
21
21
  USER = /\S+?/
22
- NICK = /\w[\w\d\\`'^{}\]\[-]+?/
22
+ # RFC suggested that a nick *had* to start with a letter, but that seems to
23
+ # not be the case.
24
+ NICK = /[\w\d\\`'^{}\]\[-]+?/
23
25
  HOST = /\S+?/
24
26
  SERVERNAME = /\S+?/
25
27
 
@@ -55,7 +57,7 @@ class MessageParser
55
57
  # separate the trailing arg as it can contain nearly any character. And
56
58
  # finally, we split the "middle" args on space.
57
59
  arglist = matches[6].sub(/^ +/, '')
58
- (middle_args, trailing_arg) = arglist.split(/ +:/, 2)
60
+ (middle_args, trailing_arg) = arglist.split(/ *:/, 2)
59
61
  @params.push(middle_args.split(/ +/), trailing_arg)
60
62
  @params.flatten!
61
63
  end
@@ -56,5 +56,16 @@ class MessageParserText < Test::Unit::TestCase
56
56
  assert_equal 'Towelie', msg.params.shift
57
57
  assert_equal '#bottest', msg.params.shift
58
58
  assert_equal 'End of /NAMES list.', msg.params.shift
59
+
60
+ # Nick change when nick is "unusual" - this also tests the bug with a single parameter being
61
+ # treated incorrectly
62
+ msg = Net::YAIL::MessageParser.new(':[1]!~nerdmaste@nerd.nerdbucket.com NICK :Deadnerd')
63
+ assert_equal '[1]', msg.nick
64
+ assert_equal 'NICK', msg.command
65
+ assert_equal '~nerdmaste', msg.user
66
+ assert_equal 'nerd.nerdbucket.com', msg.host
67
+ assert_equal '[1]!~nerdmaste@nerd.nerdbucket.com', msg.prefix
68
+ assert_equal 'Deadnerd', msg.params.shift
69
+ assert_equal 0, msg.params.length
59
70
  end
60
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-yail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Echols
@@ -9,7 +9,7 @@ autorequire: net/yail
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-28 00:00:00 -07:00
12
+ date: 2009-05-11 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15