summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/reaction.rb2
-rw-r--r--lib/rbot/core/utils/extends.rb6
2 files changed, 6 insertions, 2 deletions
diff --git a/data/rbot/plugins/reaction.rb b/data/rbot/plugins/reaction.rb
index d3f4b558..879b89fa 100644
--- a/data/rbot/plugins/reaction.rb
+++ b/data/rbot/plugins/reaction.rb
@@ -238,7 +238,7 @@ class ReactionPlugin < Plugin
def unreplied(m)
return unless PrivMessage === m
- debug "testing #{m} for reactions"
+ debug "testing #{m.inspect} for reactions"
return if @reactions.empty?
candidates = @reactions.map { |react|
blob = react === m
diff --git a/lib/rbot/core/utils/extends.rb b/lib/rbot/core/utils/extends.rb
index 84833d9f..d734db61 100644
--- a/lib/rbot/core/utils/extends.rb
+++ b/lib/rbot/core/utils/extends.rb
@@ -510,12 +510,16 @@ module ::Irc
new_m = o[:class].new(o[:bot], o[:server], o[:source], o[:target], string)
new_m.recurse_depth = o[:depth]
if from
- # the created message will reply to the originating message
+ # the created message will reply to the originating message, but we
+ # must remember to set 'replied' on the fake message too, to
+ # prevent infinite loops that could be created for example with the reaction
+ # plugin by setting up a reaction to ping with cmd:ping
class << new_m
self
end.send(:define_method, :reply) do |*args|
debug "replying to '#{from.message}' with #{args.first}"
from.reply(*args)
+ new_m.replied = true
end
# the created message will follow originating message's in_thread
new_m.in_thread = from.in_thread if from.respond_to?(:in_thread)