diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-02 07:16:12 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-02 07:16:12 +0000 |
commit | 4fc1ba54e78e689b25633dbb1c76b594c3b8e6e5 (patch) | |
tree | 52e504483737126373d66a378262903368e728d6 /lib/rbot/message.rb | |
parent | e680c0565bf3fd0fede9cc124f9a40484f309c56 (diff) |
* (message.rb) CTCP commands may have no parameters
Diffstat (limited to 'lib/rbot/message.rb')
-rw-r--r-- | lib/rbot/message.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb index 7527940a..a1265532 100644 --- a/lib/rbot/message.rb +++ b/lib/rbot/message.rb @@ -1,3 +1,8 @@ +#-- vim:sw=2:et +#++ +# +# :title: IRC message datastructures + module Irc BotConfig.register BotConfigArrayValue.new('core.address_prefix', :default => [], :wizard => true, @@ -257,9 +262,11 @@ module Irc @address = true end - if(@message =~ /^\001(\S+)\s(.+)\001/) + if(@message =~ /^\001(\S+)(\s(.+))?\001/) @ctcp = $1 - @message = $2 + # FIXME need to support quoting of NULL and CR/LF, see + # http://www.irchelp.org/irchelp/rfc/ctcpspec.html + @message = $3 || String.new @action = @ctcp == 'ACTION' debug "Received CTCP command #{@ctcp} with options #{@message} (action? #{@action})" end |