1
0
Fork 0
mirror of https://git.code.sf.net/p/archivemail/code synced 2024-12-21 23:32:54 +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:
Nikolaus Schulz 2011-03-26 21:31:17 +01:00
parent 947be25f82
commit f9f9eacd88

View file

@ -1348,9 +1348,13 @@ def _archive_imap(mailbox_name):
result, response = imap_srv.search(None, imap_filter)
if result != 'OK': unexpected_error("imap search failed; server says '%s'" %
response[0])
# response is a list with a single item, listing message sequence numbers
# like ['1 2 3 1016']
message_list = response[0].split()
if response[0] is not None:
# response is a list with a single item, listing message
# sequence numbers like ['1 2 3 1016']
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))
# First, gather data for the statistics.