]> source.dussan.org Git - redmine.git/commitdiff
IMAP: Mark emails as Seen.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 22 Jun 2008 12:56:10 +0000 (12:56 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 22 Jun 2008 12:56:10 +0000 (12:56 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1571 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/imap.rb

index d09832c2ea5a8bea8c0d94d3c71248900d18f5aa..aceb75cb29bc421b3784f1ad90704139cab48596 100644 (file)
@@ -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