X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=imap%2Fcommand.c;h=40a1cf316ff86df8b30cb58d31182ab5508eb49f;hb=cee79e37906a9ce36e9f92905da773841ec7c194;hp=ec6b5a77b5f584bd4ce8eb7365da1f26307a1a56;hpb=96d53ff49c308769efbf708e1e65819077cb7af6;p=apps%2Fmadmutt.git diff --git a/imap/command.c b/imap/command.c index ec6b5a7..40a1cf3 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; @@ -273,8 +279,8 @@ static void cmd_handle_fatal (IMAP_DATA * idata) idata->status = IMAP_FATAL; if ((idata->state == IMAP_SELECTED) && - (idata->reopen & IMAP_REOPEN_ALLOW) && !idata->ctx->closing) { - /*mx_fastclose_mailbox (idata->ctx); */ + (idata->reopen & IMAP_REOPEN_ALLOW)) { + /* mx_fastclose_mailbox (idata->ctx); */ mutt_error (_("Mailbox closed")); mutt_sleep (1); idata->state = IMAP_DISCONNECTED; @@ -284,6 +290,7 @@ static void cmd_handle_fatal (IMAP_DATA * idata) if (idata->state != IMAP_SELECTED) { idata->state = IMAP_DISCONNECTED; + mutt_socket_close (idata->conn); idata->status = 0; } } @@ -353,17 +360,9 @@ static int cmd_handle_untagged (IMAP_DATA * idata) s += 3; SKIPWS (s); mutt_error ("%s", s); - idata->status = IMAP_BYE; - - /*if (imap_reconnect(idata->ctx)!=0) { - if (idata->state == IMAP_SELECTED) - mx_fastclose_mailbox (idata->ctx); *//* XXX memleak? */ - mutt_socket_close (idata->conn); - idata->state = IMAP_DISCONNECTED; + mutt_sleep (2); + cmd_handle_fatal (idata); return -1; - /*} else { - return 0; - } */ } else if (option (OPTIMAPSERVERNOISE) && (ascii_strncasecmp ("NO", s, 2) == 0)) {