diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2011-06-09 12:29:07 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2011-06-09 12:29:07 +0200 |
commit | 1fbb090ea91ab20916b3698d8afd6e300673b826 (patch) | |
tree | fb2bd1c08f75db78cca75c782ce52e32c10fb4c5 /lib | |
parent | c5bd13b7ccad6832b75e2a185169d3822c3cc4ef (diff) |
Mark threaded mapped messages as replied
This prevents them from being delegated to unreplied() before the processing
thread has the chance to mark it replied. The solution would fail for
threaded messages whose processing would not reply, but I'm not aware of
such a method currently exists.
A future design of the message delegation and mapping could thread the
actual delegation instead, and this problem would be solved.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rbot/messagemapper.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/rbot/messagemapper.rb b/lib/rbot/messagemapper.rb index c222ee71..d85f0b14 100644 --- a/lib/rbot/messagemapper.rb +++ b/lib/rbot/messagemapper.rb @@ -259,6 +259,12 @@ class Bot if m.bot.auth.allow?(auth, m.source, m.replyto) debug "template match found and auth'd: #{action.inspect} #{options.inspect}" if !m.in_thread && (tmpl.options[:thread] || tmpl.options[:threaded]) + # since the message action is in a separate thread, the message may be + # delegated to unreplied() before the thread has a chance to actually + # mark it as replied. since threading is used mostly for commands that + # are known to take some processing time (e.g. download a web page) before + # giving an output, we just mark these as 'replied' here + m.replied = true Thread.new do begin @parent.send(action, m, options) |