diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-05-28 18:41:14 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-05-28 18:41:14 +0000 |
commit | 73aadc4900158ca1199be74556fbbe60cb99d7d6 (patch) | |
tree | 2c536c14ed57326d047e73b42fba8d95b9c39ef4 /lib/redmine/imap.rb | |
parent | 131dc3a8fcf0ae1c275d4977e195132b3f837608 (diff) | |
download | redmine-73aadc4900158ca1199be74556fbbe60cb99d7d6.tar.gz redmine-73aadc4900158ca1199be74556fbbe60cb99d7d6.zip |
Use uid_ methods for retrieving IMAP messages (#14101).
Patch by Pierre Pretorius.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11906 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/imap.rb')
-rw-r--r-- | lib/redmine/imap.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/redmine/imap.rb b/lib/redmine/imap.rb index 140131a6d..093ac3e40 100644 --- a/lib/redmine/imap.rb +++ b/lib/redmine/imap.rb @@ -29,21 +29,21 @@ module Redmine imap = Net::IMAP.new(host, port, ssl) imap.login(imap_options[:username], imap_options[:password]) unless imap_options[:username].nil? imap.select(folder) - imap.search(['NOT', 'SEEN']).each do |message_id| - msg = imap.fetch(message_id,'RFC822')[0].attr['RFC822'] - logger.debug "Receiving message #{message_id}" if logger && logger.debug? + imap.uid_search(['NOT', 'SEEN']).each do |uid| + msg = imap.uid_fetch(uid,'RFC822')[0].attr['RFC822'] + logger.debug "Receiving message #{uid}" if logger && logger.debug? if MailHandler.receive(msg, options) - logger.debug "Message #{message_id} successfully received" if logger && logger.debug? + logger.debug "Message #{uid} successfully received" if logger && logger.debug? if imap_options[:move_on_success] - imap.copy(message_id, imap_options[:move_on_success]) + imap.uid_copy(uid, imap_options[:move_on_success]) end - imap.store(message_id, "+FLAGS", [:Seen, :Deleted]) + imap.uid_store(uid, "+FLAGS", [:Seen, :Deleted]) else - logger.debug "Message #{message_id} can not be processed" if logger && logger.debug? - imap.store(message_id, "+FLAGS", [:Seen]) + logger.debug "Message #{uid} can not be processed" if logger && logger.debug? + imap.uid_store(uid, "+FLAGS", [:Seen]) if imap_options[:move_on_failure] - imap.copy(message_id, imap_options[:move_on_failure]) - imap.store(message_id, "+FLAGS", [:Deleted]) + imap.uid_copy(uid, imap_options[:move_on_failure]) + imap.uid_store(uid, "+FLAGS", [:Deleted]) end end end |