net-yail 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/net/yail.rb +1 -1
- data/lib/net/yail/message_parser.rb +4 -2
- data/tests/tc_message_parser.rb +11 -0
- metadata +2 -2
data/lib/net/yail.rb
CHANGED
@@ -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
|
-
|
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(/
|
60
|
+
(middle_args, trailing_arg) = arglist.split(/ *:/, 2)
|
59
61
|
@params.push(middle_args.split(/ +/), trailing_arg)
|
60
62
|
@params.flatten!
|
61
63
|
end
|
data/tests/tc_message_parser.rb
CHANGED
@@ -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.
|
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-
|
12
|
+
date: 2009-05-11 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|