Fixes #3233 - ProtonMail Bridge error: Can’t use Channel::Driver::Imap
This commit is contained in:
parent
43b6374d16
commit
54c694689f
1 changed files with 22 additions and 13 deletions
|
@ -134,19 +134,12 @@ example
|
|||
@imap.select(folder)
|
||||
end
|
||||
|
||||
# sort messages by date on server (if not supported), if not fetch messages via search (first in, first out)
|
||||
filter = ['ALL']
|
||||
message_ids = timeout(6.minutes) do
|
||||
if keep_on_server && check_type != 'check' && check_type != 'verify'
|
||||
filter = %w[NOT SEEN]
|
||||
fetch_unread_message_ids
|
||||
else
|
||||
fetch_all_message_ids
|
||||
end
|
||||
|
||||
message_ids = nil
|
||||
timeout(6.minutes) do
|
||||
|
||||
message_ids = @imap.sort(['DATE'], filter, 'US-ASCII')
|
||||
rescue
|
||||
message_ids = @imap.search(filter)
|
||||
|
||||
end
|
||||
|
||||
# check mode only
|
||||
|
@ -369,6 +362,22 @@ example
|
|||
}
|
||||
end
|
||||
|
||||
def fetch_all_message_ids
|
||||
fetch_message_ids %w[ALL]
|
||||
end
|
||||
|
||||
def fetch_unread_message_ids
|
||||
fetch_message_ids %w[NOT SEEN]
|
||||
rescue
|
||||
fetch_message_ids %w[UNSEEN]
|
||||
end
|
||||
|
||||
def fetch_message_ids(filter)
|
||||
@imap.sort(['DATE'], filter, 'US-ASCII')
|
||||
rescue
|
||||
@imap.search(filter)
|
||||
end
|
||||
|
||||
def disconnect
|
||||
return if !@imap
|
||||
|
||||
|
|
Loading…
Reference in a new issue