1
0
Fork 0
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:
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) 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.