From 471fffa8a1c23d7fc5f64fe3c1bd0306d27632c3 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 11 Feb 2007 14:52:05 +0000 Subject: Minor messagemapper optimizations --- lib/rbot/botuser.rb | 10 ++++++++++ lib/rbot/messagemapper.rb | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/rbot/botuser.rb b/lib/rbot/botuser.rb index 41fca6cf..52b83151 100644 --- a/lib/rbot/botuser.rb +++ b/lib/rbot/botuser.rb @@ -101,6 +101,16 @@ class String end +class Symbol + + # Returns an Irc::Auth::Comand from the receiver + def to_irc_auth_command + Irc::Auth::Command.new(self) + end + +end + + module Irc diff --git a/lib/rbot/messagemapper.rb b/lib/rbot/messagemapper.rb index 39b258e3..e009f030 100644 --- a/lib/rbot/messagemapper.rb +++ b/lib/rbot/messagemapper.rb @@ -47,7 +47,7 @@ module Irc def initialize(parent) @parent = parent @templates = Array.new - @fallback = 'usage' + @fallback = :usage end # args:: hash format containing arguments for this template @@ -162,7 +162,7 @@ module Irc debug "#{f.inspect} => #{r}" } debug "no handler found, trying fallback" - if @fallback != nil && @parent.respond_to?(@fallback) + if @fallback && @parent.respond_to?(@fallback) if m.bot.auth.allow?(@fallback, m.source, m.replyto) @parent.send(@fallback, m, {}) return true -- cgit v1.2.3