From: pdmef Date: Thu, 21 Jul 2005 07:51:16 +0000 (+0000) Subject: Rocco Rutte: X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=3f3ce3e32da45b2626dfa40a994cb37ca4021e5b Rocco Rutte: - make imap_reconnect() work if server closes connection without muttng noting it (waiting within queries, etc.) (produces lots of errors and warnings so that it's ugly but it works) (real fix still to come) git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@332 e385b8ad-14ed-0310-8656-cc95a2468c6d --- diff --git a/imap/command.c b/imap/command.c index ec6b5a7..ba9d666 100644 --- a/imap/command.c +++ b/imap/command.c @@ -168,6 +168,12 @@ int imap_exec (IMAP_DATA * idata, const char *cmd, int flags) int outlen; int rc; + if (!idata) { + mutt_error (_("No mailbox is open.")); + mutt_sleep (1); + return (-1); + } + if (idata->status == IMAP_FATAL) { cmd_handle_fatal (idata); return -1; diff --git a/imap/imap.c b/imap/imap.c index adebf53..110486e 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1046,7 +1046,7 @@ int imap_sync_mailbox (CONTEXT * ctx, int expunge, int *index_hint) idata->reopen |= IMAP_EXPUNGE_EXPECTED; if (imap_exec (idata, "EXPUNGE", 0) != 0) { imap_error (_("imap_sync_mailbox: EXPUNGE failed"), idata->cmd.buf); - rc = -1; + rc = imap_reconnect (ctx); goto out; } } diff --git a/mx.c b/mx.c index 05a4032..183f710 100644 --- a/mx.c +++ b/mx.c @@ -1165,7 +1165,7 @@ int mx_check_mailbox (CONTEXT * ctx, int *index_hint, int lock) { if (ctx) { if (ctx->locked) lock = 0; - if (MX_COMMAND(ctx->magic-1,mx_check_mailbox)) + if (MX_IDX(ctx->magic-1) && MX_COMMAND(ctx->magic-1,mx_check_mailbox)) return (MX_COMMAND(ctx->magic-1,mx_check_mailbox)(ctx, index_hint, lock)); }