diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-01-07 23:39:33 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-01-08 14:50:46 +0100 |
commit | fad7eca91130783e810142127f7cb71ac89f7ffb (patch) | |
tree | 80f4cba38ef375c1ba0dc44d93025967b72339a2 /lib/rbot/rfc2812.rb | |
parent | 53613d63b294841cd0fd8995b76f4378b1c288f6 (diff) |
rfc2812: better handling of incomplete mode lines
Sometimes the bot may receive incomplete or malformed mode lines. This
can be seen for example by kicking repeatedly and at very short
intervals the bot from a channel with +l set to some numbers (at least
on freenode).
We (don't) handle these malformed modelines by skipping them rather than
crashing.
Diffstat (limited to 'lib/rbot/rfc2812.rb')
-rw-r--r-- | lib/rbot/rfc2812.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/rbot/rfc2812.rb b/lib/rbot/rfc2812.rb index 21cd9ff7..ee0d08d6 100644 --- a/lib/rbot/rfc2812.rb +++ b/lib/rbot/rfc2812.rb @@ -1534,7 +1534,7 @@ module Irc data[:modes].last << arg end } - else + when Channel # array of indices in data[:modes] where parameters # are needed who_wants_params = [] @@ -1587,6 +1587,10 @@ module Irc getting_args = true unless who_wants_params.empty? end end + unless who_wants_params.empty? + warning "Unhandled malformed modeline #{data[:modestring]} (unexpected empty arguments)" + return + end data[:modes].each { |mode| set, key, val = mode @@ -1596,6 +1600,8 @@ module Irc data[:target].mode[key].send(set) end } + else + warning "Ignoring #{data[:modestring]} for unrecognized target #{argv[0]} (#{data[:target].inspect})" end end end |