idata->check_status = IMAP_REOPENED;
static int imap_exec (char *buf, size_t buflen, IMAP_DATA *idata,		      const char *seq, const char *cmd, int flags){  int count;  mutt_socket_write (idata->conn, cmd);  do  {    if (mutt_socket_read_line_d (buf, buflen, idata->conn) < 0)      return (-1);    if (buf[0] == '*' && imap_handle_untagged (idata, buf) != 0)      return (-1);  }  while (mutt_strncmp (buf, seq, SEQLEN) != 0);  if ((idata->state == IMAP_SELECTED) &&       !idata->selected_ctx->closing &&       (idata->status == IMAP_NEW_MAIL ||        idata->status == IMAP_EXPUNGE))  {    count = idata->newMailCount;    if (idata->status == IMAP_NEW_MAIL && count > idata->selected_ctx->msgcount)    {      /* read new mail messages */      dprint (1, (debugfile, "imap_exec(): new mail detected\n"));      while (count > idata->selected_ctx->hdrmax)	mx_alloc_memory (idata->selected_ctx);      count = imap_read_headers (idata->selected_ctx, 	  idata->selected_ctx->msgcount, count - 1) + 1;    }    else    {      imap_reopen_mailbox (idata->selected_ctx, NULL);    }    idata->status = 0;    mutt_clear_error ();  }  if (!imap_code (buf))  {    char *pc;    if (flags == IMAP_OK_FAIL)      return (-2);    dprint (1, (debugfile, "imap_exec(): command failed: %s\n", buf));    pc = buf + SEQLEN;    SKIPWS (pc);    pc = imap_next_word (pc);    mutt_error (pc);    sleep (1);    return (-1);  }  return 0;}