summaryrefslogtreecommitdiffstats
path: root/lib/redmine/imap.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-06-22 12:56:10 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-06-22 12:56:10 +0000
commit8b33565b3e7bbca7ec2ef4aeedba4eb20cb66bdc (patch)
treef35049260f492b4a6f58079feded02bbb24f71ea /lib/redmine/imap.rb
parent268165a013ebf6734aa377cf62ce0a4f8b894921 (diff)
downloadredmine-8b33565b3e7bbca7ec2ef4aeedba4eb20cb66bdc.tar.gz
redmine-8b33565b3e7bbca7ec2ef4aeedba4eb20cb66bdc.zip
IMAP: Mark emails as Seen.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1571 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/imap.rb')
-rw-r--r--lib/redmine/imap.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/redmine/imap.rb b/lib/redmine/imap.rb
index d09832c2e..aceb75cb2 100644
--- a/lib/redmine/imap.rb
+++ b/lib/redmine/imap.rb
@@ -30,14 +30,22 @@ module Redmine
imap.login(imap_options[:username], imap_options[:password]) unless imap_options[:username].nil?
imap.select(folder)
imap.search(['ALL']).each do |message_id|
- puts "Receiving message #{message_id}"
msg = imap.fetch(message_id,'RFC822')[0].attr['RFC822']
+ logger.debug "Receiving message #{message_id}" if logger && logger.debug?
if MailHandler.receive(msg, options)
- imap.store(message_id, "+FLAGS", [:Deleted])
+ imap.store(message_id, "+FLAGS", [:Seen, :Deleted])
+ else
+ imap.store(message_id, "+FLAGS", [:Seen])
end
end
imap.expunge
end
+
+ private
+
+ def logger
+ RAILS_DEFAULT_LOGGER
+ end
end
end
end