summaryrefslogtreecommitdiffstats
path: root/app/models/mail_handler.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-09 20:17:58 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-09 20:17:58 +0000
commit2d3b3cee156c5dedaafc12575cbf7c21adf76a70 (patch)
tree0b1a916d5ad670abb5a14be119115643d4c1dd2c /app/models/mail_handler.rb
parentc68721911370e2aa293fd951b933b5c7f74fd611 (diff)
downloadredmine-2d3b3cee156c5dedaafc12575cbf7c21adf76a70.tar.gz
redmine-2d3b3cee156c5dedaafc12575cbf7c21adf76a70.zip
Strip keywords from received email body (#2436).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2426 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 ea9671ff6..8e19bcdf4 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -203,10 +203,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