commit 63cfae848ab5751c743b64d9897e2e5ec1da20df
Author: Oswald Buddenhagen <[email protected]>
Date: Sat Nov 23 13:51:20 2019 +0100
catch server's failure to FETCH *
the query is untypical enough to have caused problems with davmail (when
we still used *:*) and mailo.com (until it got fixed), so better check
that the result (not) returned by the server makes sense.
src/drv_imap.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/drv_imap.c b/src/drv_imap.c
index ca9081c..97b8bfc 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -2434,9 +2434,15 @@ imap_open_box_p3( imap_store_t *ctx, imap_cmd_t *gcmd,
int response )
{
imap_cmd_open_box_t *cmdp = (imap_cmd_open_box_t *)gcmd;
- // This will happen if the box is empty.
- if (!ctx->uidnext)
+ if (!ctx->uidnext) {
+ if (ctx->total_msgs) {
+ error( "IMAP error: querying server for highest UID
failed\n" );
+ imap_open_box_p4( ctx, cmdp, RESP_NO );
+ return;
+ }
+ // This is ok, the box is simply empty.
ctx->uidnext = 1;
+ }
imap_open_box_p4( ctx, cmdp, response );
}
@@ -3012,10 +3018,16 @@ imap_find_new_msgs_p3( imap_store_t *ctx, imap_cmd_t
*gcmd, int response )
imap_cmd_find_new_t *cmdp = (imap_cmd_find_new_t *)gcmd;
imap_cmd_find_new_t *cmd;
- if (response != RESP_OK || ctx->uidnext <= cmdp->uid) {
+ if (response != RESP_OK) {
imap_find_new_msgs_p4( ctx, gcmd, response );
return;
}
+ if (!ctx->uidnext) {
+ // We are assuming that the new messages were not in fact
instantly deleted.
+ error( "IMAP error: re-querying server for highest UID
failed\n" );
+ imap_find_new_msgs_p4( ctx, gcmd, RESP_NO );
+ return;
+ }
INIT_IMAP_CMD(imap_cmd_find_new_t, cmd, cmdp->callback,
cmdp->callback_aux)
cmd->out_msgs = cmdp->out_msgs;
imap_exec( (imap_store_t *)ctx, &cmd->gen, imap_find_new_msgs_p4,
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel