mirror of
https://git.code.sf.net/p/archivemail/code
synced 2024-12-22 07:42:55 +00:00
IMAP: handle broken servers sending no untagged SEARCH response
The proprietary "SmartMail" IMAP server likes to send no untagged SEARCH response when the set of matching email messages is empty. This was brought up as sf.net support request #3213272.
This commit is contained in:
parent
947be25f82
commit
f9f9eacd88
1 changed files with 7 additions and 3 deletions
|
@ -1348,9 +1348,13 @@ def _archive_imap(mailbox_name):
|
||||||
result, response = imap_srv.search(None, imap_filter)
|
result, response = imap_srv.search(None, imap_filter)
|
||||||
if result != 'OK': unexpected_error("imap search failed; server says '%s'" %
|
if result != 'OK': unexpected_error("imap search failed; server says '%s'" %
|
||||||
response[0])
|
response[0])
|
||||||
# response is a list with a single item, listing message sequence numbers
|
if response[0] is not None:
|
||||||
# like ['1 2 3 1016']
|
# response is a list with a single item, listing message
|
||||||
|
# sequence numbers like ['1 2 3 1016']
|
||||||
message_list = response[0].split()
|
message_list = response[0].split()
|
||||||
|
else:
|
||||||
|
# Broken server has sent no untagged response; assume empty result set.
|
||||||
|
message_list = []
|
||||||
vprint("%d messages are matching filter" % len(message_list))
|
vprint("%d messages are matching filter" % len(message_list))
|
||||||
|
|
||||||
# First, gather data for the statistics.
|
# First, gather data for the statistics.
|
||||||
|
|
Loading…
Reference in a new issue