From 5c832c68f93277a8a0bcfa8f30493924b938a360 Mon Sep 17 00:00:00 2001 From: Yaohan Chen Date: Mon, 23 Jun 2008 19:30:29 -0400 Subject: fake messages will use the originating message's reply method this allows shell plugin to capture replies of a command even if this command is run because of a fake message --- lib/rbot/core/utils/extends.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/rbot/core/utils/extends.rb b/lib/rbot/core/utils/extends.rb index de6a7db4..59f5be76 100644 --- a/lib/rbot/core/utils/extends.rb +++ b/lib/rbot/core/utils/extends.rb @@ -418,6 +418,14 @@ module ::Irc raise RecurseTooDeep if o[:depth] > MAX_RECURSE_DEPTH new_m = o[:class].new(o[:bot], o[:server], o[:source], o[:target], string) new_m.recurse_depth = o[:depth] + # if "from" message is given, the created message will reply to "from" + if from + class << new_m + self + end.send(:define_method, :reply) do |*args| + from.reply *args + end + end return new_m unless o[:delegate] method = o[:class].to_s.gsub(/^Irc::|Message$/,'').downcase method = 'privmsg' if method == 'priv' -- cgit v1.2.3