diff options
author | Nikolaus Schulz <microschulz@web.de> | 2011-03-26 21:31:17 +0100 |
---|---|---|
committer | Nikolaus Schulz <microschulz@web.de> | 2011-07-09 16:53:19 +0200 |
commit | f9f9eacd888565660e44ee5119124614dd442e03 (patch) | |
tree | c89eef4ff39cd56d9658357e8a910e9945f3cbcc | |
parent | 947be25f8249b7822edfd1cae2822fc05b7cfccc (diff) | |
download | archivemail-f9f9eacd888565660e44ee5119124614dd442e03.tar.gz archivemail-f9f9eacd888565660e44ee5119124614dd442e03.tar.bz2 archivemail-f9f9eacd888565660e44ee5119124614dd442e03.zip |
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.
-rwxr-xr-x | archivemail | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/archivemail b/archivemail index 58d833d..8c0e2c9 100755 --- a/archivemail +++ b/archivemail @@ -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. |