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)
|
@imap.select(folder)
|
||||||
end
|
end
|
||||||
|
|
||||||
# sort messages by date on server (if not supported), if not fetch messages via search (first in, first out)
|
message_ids = timeout(6.minutes) do
|
||||||
filter = ['ALL']
|
|
||||||
if keep_on_server && check_type != 'check' && check_type != 'verify'
|
if keep_on_server && check_type != 'check' && check_type != 'verify'
|
||||||
filter = %w[NOT SEEN]
|
fetch_unread_message_ids
|
||||||
|
else
|
||||||
|
fetch_all_message_ids
|
||||||
end
|
end
|
||||||
|
|
||||||
message_ids = nil
|
|
||||||
timeout(6.minutes) do
|
|
||||||
|
|
||||||
message_ids = @imap.sort(['DATE'], filter, 'US-ASCII')
|
|
||||||
rescue
|
|
||||||
message_ids = @imap.search(filter)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# check mode only
|
# check mode only
|
||||||
|
@ -369,6 +362,22 @@ example
|
||||||
}
|
}
|
||||||
end
|
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
|
def disconnect
|
||||||
return if !@imap
|
return if !@imap
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue