snprintf (buf, sizeof (buf), "%s STATUS %s (UIDVALIDITY)\r\n", seq, mbox);
if (mutt_bit_isset(idata->capabilities,IMAP4REV1)) { snprintf (buf, sizeof (buf), "%s STATUS %s (UIDVALIDITY)\r\n", seq, mbox); } else if (mutt_bit_isset(idata->capabilities,STATUS)) {  snprintf (buf, sizeof (buf), "%s STATUS %s (UID-VALIDITY)\r\n", seq, mbox); } else {  mutt_message _("Unable to append to IMAP mailboxes at this server"); return (-1); }
int imap_open_mailbox_append (CONTEXT *ctx){  CONNECTION *conn;  IMAP_DATA *idata;  char host[SHORT_STRING];  char buf[LONG_STRING], mbox[LONG_STRING];  char mailbox[LONG_STRING];  char seq[16];  char *pc;  int r;  int port;  if (imap_parse_path (ctx->path, host, sizeof (host), &port, &pc))    return (-1);  ctx->magic = M_IMAP;  conn = mutt_socket_select_connection (host, port, 0);  idata = CONN_DATA;  if (!idata || (idata->state == IMAP_DISCONNECTED))  {    if (!idata)    {      /* The current connection is a new connection */      idata = safe_calloc (1, sizeof (IMAP_DATA));      conn->data = idata;      idata->conn = conn;    }    if (imap_open_connection (idata, conn))      return (-1);  }  ctx->data = (void *) idata;  /* check mailbox existance */  imap_fix_path (idata, pc, mailbox, sizeof (mailbox));  imap_quote_string (mbox, sizeof (mbox), mailbox);  imap_make_sequence (seq, sizeof (seq));  snprintf (buf, sizeof (buf), "%s STATUS %s (UIDVALIDITY)\r\n", seq, mbox);        r = imap_exec (buf, sizeof (buf), idata, seq, buf, IMAP_OK_FAIL);  if (r == -2)  {    /* command failed cause folder doesn't exist */    if (option (OPTCONFIRMCREATE))    {      snprintf (buf, sizeof (buf), _("Create %s?"), mailbox);      if (mutt_yesorno (buf, 1) < 1)      {	return (-1);      }      if (imap_create_mailbox (idata, mailbox) < 0)      {	return (-1);      }    }  }  else if (r == -1)  {    /* Hmm, some other failure */    return (-1);  }  return 0;}