summaryrefslogtreecommitdiffstats
path: root/app/models/mail_handler.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-21 19:22:31 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-21 19:22:31 +0000
commit28e4ff8957170c61f5cd0b7e7ab4f8e40e1afc80 (patch)
tree6a9c1a8d93efb60f9c5dd4193353ecfc93965fdb /app/models/mail_handler.rb
parent3d1bd79ffb1414240c2c5c952a306056d7ad8b06 (diff)
downloadredmine-28e4ff8957170c61f5cd0b7e7ab4f8e40e1afc80.tar.gz
redmine-28e4ff8957170c61f5cd0b7e7ab4f8e40e1afc80.zip
Merged r2426 and r2484 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2512 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/mail_handler.rb')
-rw-r--r--app/models/mail_handler.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 402c46127..cc016502e 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -163,10 +163,17 @@ class MailHandler < ActionMailer::Base
end
def get_keyword(attr, options={})
- if (options[:override] || @@handler_options[:allow_override].include?(attr.to_s)) && plain_text_body =~ /^#{attr}:[ \t]*(.+)$/i
- $1.strip
- elsif !@@handler_options[:issue][attr].blank?
- @@handler_options[:issue][attr]
+ @keywords ||= {}
+ if @keywords.has_key?(attr)
+ @keywords[attr]
+ else
+ @keywords[attr] = begin
+ if (options[:override] || @@handler_options[:allow_override].include?(attr.to_s)) && plain_text_body.gsub!(/^#{attr}:[ \t]*(.+)\s*$/i, '')
+ $1.strip
+ elsif !@@handler_options[:issue][attr].blank?
+ @@handler_options[:issue][attr]
+ end
+ end
end
end