diff options
author | Dmitry Kim <dmitry point kim at gmail point com> | 2007-05-10 23:03:19 +0000 |
---|---|---|
committer | Dmitry Kim <dmitry point kim at gmail point com> | 2007-05-10 23:03:19 +0000 |
commit | 00c5060554ca2546e3462f69a27fca521c0889aa (patch) | |
tree | 90fd51e678b148b549748b4597038b76d93abf84 /lib/rbot | |
parent | c9298e20540b63bed9bf994a523750fa8d1d7c42 (diff) |
+ (plugins) draft implementation of event hooks
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/plugins.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 7b476da9..ab7be40a 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -141,6 +141,10 @@ module Plugins @handler.handle(m) end + def call_event(ev, *args) + @bot.plugins.delegate('event_' + ev.to_s.gsub(/[^\w\?!]+/, '_'), *args) + end + def map(*args) @handler.map(self, *args) # register this map @@ -578,12 +582,13 @@ module Plugins # +message+ as a parameter def delegate(method, *args) # debug "Delegating #{method.inspect}" + ret = Array.new [core_modules, plugins].each { |pl| pl.each {|p| if(p.respond_to? method) begin # debug "#{p.botmodule_class} #{p.name} responds" - p.send method, *args + ret.push p.send(method, *args) rescue Exception => err raise if err.kind_of?(SystemExit) error report_error("#{p.botmodule_class} #{p.name} #{method}() failed:", err) @@ -592,6 +597,7 @@ module Plugins end } } + return ret # debug "Finished delegating #{method.inspect}" end |