option (OPTIMAPLSUB) ? "LSUB" : "LIST", mbox); if (add_list_result(conn, seq, buf, host, port, state) != 0) return (-1);
list_cmd, mbox);  if (mbox[strlen (mbox) - 1] == idata->delim) prune_path = mbox; if (add_list_result(conn, seq, buf, host, port, state, 0) != 0) return -1;
int imap_init_browse (char *path, struct browser_state *state){  CONNECTION *conn;  IMAP_DATA *idata;  char buf[LONG_STRING];  char nsbuf[LONG_STRING];  char mbox[LONG_STRING];  char host[SHORT_STRING];  char seq[16];  char *ipath = NULL;  int n;  int i;  int nsup;  int port;  IMAP_NAMESPACE_INFO nsi[16];  int nns;  int home_namespace = 0;  if (imap_parse_path (path, host, sizeof (host), &port, &ipath))    return (-1);  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);  }  if (ipath[0] == '\0')  {    home_namespace = 1;    mbox[0] = 0;		/* Do not replace "" with "INBOX" here */    ipath = ImapHomeNamespace;    nns = 0;    if (mutt_bit_isset(idata->capabilities,NAMESPACE))    {      if (get_namespace (idata, nsbuf, sizeof (nsbuf), 			 nsi, sizeof (nsi),  &nns) != 0)	return (-1);      if (verify_namespace (conn, nsi, nns) != 0)	return (-1);    }    if (!ipath)		/* Any explicitly set imap_home_namespace wins */    {       for (i = 0; i < nns; i++)	if (nsi[i].listable &&	    (nsi[i].type == IMAP_NS_PERSONAL || nsi[i].type == IMAP_NS_SHARED))	{	  ipath = nsi->prefix;	  nsi->home_namespace = 1;	  break;	}    }  }  if (ipath && ipath[0] != '\0')  {    imap_fix_path (idata, ipath, mbox, sizeof (mbox));    n = mutt_strlen (mbox);    /* Find superiors to list */    for (n--; n >= 0 && mbox[n] != idata->delim ; n--);    if (n > 0)			/* "aaaa/bbbb/" -> add "aaaa" */    {      mbox[n] = '\0';      /* List it to see if it can be selected */      dprint (2, (debugfile, "imap_init_browse: listing %s\n", mbox));      imap_make_sequence (seq, sizeof (seq));      snprintf (buf, sizeof (buf), "%s %s \"\" \"%s%%\"\r\n", seq, 	  option (OPTIMAPLSUB) ? "LSUB" : "LIST", mbox);      if (add_list_result (conn, seq, buf, host, port, state) != 0)	return (-1);      mbox[n] = idata->delim;    }     else  /* "/bbbb/" -> add  "/", "aaaa/" -> add "" */    {      snprintf (buf, sizeof (buf), "%c" , n<0 ? '\0' :idata->delim);      add_folder (idata->delim, buf, host, port, 1, 0, state);     }  }  if (home_namespace && mbox[0] != '\0')  {    /* Listing the home namespace, so INBOX should be included. Home      * namespace is not "", so we have to list it explicitly. We ask the      * server to see if it has descendants. */    imap_make_sequence (seq, sizeof (seq));    snprintf (buf, sizeof (buf), "%s LIST \"\" \"INBOX\"\r\n", seq);    if (add_list_result(conn, seq, buf, host, port, state) != 0)      return (-1);  }  nsup = state->entrylen;  imap_make_sequence (seq, sizeof (seq));  mutt_message _("Contacted server, getting folder list...");  snprintf (buf, sizeof (buf), "%s %s \"\" \"%s%%\"\r\n", seq,       option (OPTIMAPLSUB) ? "LSUB" : "LIST", mbox);  if (add_list_result(conn, seq, buf, host, port, state) != 0)    return (-1);  qsort(&(state->entry[nsup]),state->entrylen-nsup,sizeof(state->entry[0]),	(int (*)(const void*,const void*)) compare_names);  if (home_namespace)  {				/* List additional namespaces */    for (i = 0; i < nns; i++)      if (nsi[i].listable && !nsi[i].home_namespace)	add_folder(nsi[i].delim, nsi[i].prefix, host, port, 		   nsi[i].noselect, nsi[i].noinferiors, state);  }  mutt_clear_error ();  return 0;}