summaryrefslogtreecommitdiffstats
path: root/imap
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2019-11-18 19:11:52 -0800
committerKevin McCarthy <kevin@8t8.us>2019-11-30 14:34:28 -0800
commitf2f6dd46596f30fdbdd5f8d85f253242a095cb9c (patch)
treef7e2092b65f2cb669242cf68a1ffa9e7d0f10a55 /imap
parent136ae0add512f21bc418f9e31a2f1b970ad1a490 (diff)
Fixes and cleanup for imap deflate patch.
Rework mutt_zstrm_read(): - Pass along the error if conn_read() returns < 0. - Separate out conn_eof and stream_eof flags so they can be dealt with differently. - Don't use Z_FINISH on conn_eof, because the passed in buf might not be big enough to hold the decompressed output. Instead continue looping until either Z_STREAM_END or Z_BUF_ERROR. - Remove recursive calls to retry, instead goto 'retry' target. - Remove op statements in malloc/free. - Bail on other rcs. Mutt doesn't check errno on a read error, so lump all other error codes into a -1 return value. Use default so we handle other weird stuff such as Z_NEED_DICT or Z_STREAM_ERROR too. Convert $imap_deflate to boolean, default unset. Configure.ac fixes: - Fix indentation - Remove unneeded AM_CONDITIONAL. - Don't restore LDFLAGS and CPPFLAGS. Save and restore LIBS instead. imap_conn_find() fixes: - Don't queue CAPABILITY command. (This mistake has been in there since UTF-8 and QRESYNC were added.). - Check imap_exec() returns 0 before wrapping. Even with FAIL_OK set, the imap_exec() can still return -1 on some errors.
Diffstat (limited to 'imap')
-rw-r--r--imap/imap.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/imap/imap.c b/imap/imap.c
index 8e8684f8..a46c1004 100644
--- a/imap/imap.c
+++ b/imap/imap.c
@@ -427,15 +427,14 @@ IMAP_DATA* imap_conn_find (const ACCOUNT* account, int flags)
if (new && idata->state == IMAP_AUTHENTICATED)
{
/* capabilities may have changed */
- imap_exec (idata, "CAPABILITY", IMAP_CMD_QUEUE);
+ imap_exec (idata, "CAPABILITY", IMAP_CMD_FAIL_OK);
#if defined(USE_ZLIB)
/* RFC 4978 */
if (mutt_bit_isset (idata->capabilities, COMPRESS_DEFLATE))
{
- if (query_quadoption (OPT_IMAPDEFLATE,
- _("Use deflate compression on connection?")) == MUTT_YES &&
- imap_exec (idata, "COMPRESS DEFLATE", IMAP_CMD_FAIL_OK) != -2)
+ if (option (OPTIMAPDEFLATE) &&
+ imap_exec (idata, "COMPRESS DEFLATE", IMAP_CMD_FAIL_OK) == 0)
mutt_zstrm_wrap_conn (idata->conn);
}
#endif