X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=imap%2Fbrowse.c;h=85a64b19acfc34cf77f44db30ad022a559a91270;hp=2cc16f8fa926f1bd5ca58068efa8d64d1e405480;hb=819c071fa7efc8dffb4dd92f36f0111227ff692f;hpb=ac813896ca32d850febc2d95065ac4fa040f11f9 diff --git a/imap/browse.c b/imap/browse.c index 2cc16f8..85a64b1 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -10,21 +10,7 @@ /* Mutt browser support routines */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include -#include -#include -#include -#include - -#include - +#include #include "mutt.h" #include "imap_private.h" @@ -75,7 +61,7 @@ int imap_browse (char *path, struct browser_state *state) save_lsub = option (OPTIMAPCHECKSUBSCRIBED); unset_option (OPTIMAPCHECKSUBSCRIBED); m_strcpy(list_cmd, sizeof(list_cmd), - option(OPTIMAPLSUB) ? "LSUB" : "string_list_t"); + option(OPTIMAPLSUB) ? "LSUB" : "LIST"); if (!(idata = imap_conn_find (&(mx.account), 0))) goto fail; @@ -83,7 +69,6 @@ int imap_browse (char *path, struct browser_state *state) if (!mx.mbox) { home_namespace = 1; mbox[0] = '\0'; /* Do not replace "" with "INBOX" here */ - mx.mbox = m_strdup(ImapHomeNamespace); if (mutt_bit_isset (idata->capabilities, NAMESPACE)) { mutt_message _("Getting namespaces..."); @@ -105,8 +90,6 @@ int imap_browse (char *path, struct browser_state *state) m_strcpy(mbox, sizeof(mbox), buf); n = m_strlen(mbox); - debug_print (3, ("mbox: %s\n", mbox)); - /* if our target exists and has inferiors, enter it if we * aren't already going to */ if (mbox[n - 1] != idata->delim) { @@ -126,8 +109,7 @@ int imap_browse (char *path, struct browser_state *state) mbox[n] = '\0'; } } - } - while (ascii_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN)); + } while (m_strncmp(idata->cmd.buf.data, idata->cmd.seq, SEQLEN)); } /* if we're descending a folder, mark it as current in browser_state */ @@ -154,7 +136,6 @@ int imap_browse (char *path, struct browser_state *state) mbox[n] = '\0'; if (showparents) { - debug_print (3, ("adding parent %s\n", mbox)); imap_add_folder (idata->delim, mbox, 1, 0, state, 1); } @@ -194,17 +175,14 @@ int imap_browse (char *path, struct browser_state *state) /* 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. */ - debug_print (3, ("adding INBOX\n")); - if (browse_add_list_result (idata, "string_list_t \"\" \"INBOX\"", state, 0)) + if (browse_add_list_result (idata, "LIST \"\" \"INBOX\"", state, 0)) goto fail; } nsup = state->entrylen; - debug_print (3, ("Quoting mailbox scan: %s:\n", mbox)); snprintf (buf, sizeof (buf), "%s%%", mbox); imap_quote_string (buf2, sizeof (buf2), buf); - debug_print (3, ("%s\n", buf2)); snprintf (buf, sizeof (buf), "%s \"\" %s", list_cmd, buf2); if (browse_add_list_result (idata, buf, state, 0)) goto fail; @@ -225,7 +203,6 @@ int imap_browse (char *path, struct browser_state *state) if (nsi[i].listable && !nsi[i].home_namespace) { imap_add_folder (nsi[i].delim, nsi[i].prefix, nsi[i].noselect, nsi[i].noinferiors, state, 0); - debug_print (3, ("adding namespace: %s\n", nsi[i].prefix)); } } @@ -251,12 +228,10 @@ int imap_mailbox_create (const char *folder) short n; if (imap_parse_path (folder, &mx) < 0) { - debug_print (1, ("Bad starting path %s\n", folder)); return -1; } if (!(idata = imap_conn_find (&mx.account, M_IMAP_CONN_NONEW))) { - debug_print (1, ("Couldn't find open connection to %s\n", mx.account.host)); goto fail; } @@ -298,15 +273,13 @@ int imap_mailbox_rename (const char *mailbox) IMAP_DATA *idata; IMAP_MBOX mx; char buf[LONG_STRING]; - char newname[SHORT_STRING]; + char newname[STRING]; if (imap_parse_path (mailbox, &mx) < 0) { - debug_print (1, ("Bad source mailbox %s\n", mailbox)); return -1; } if (!(idata = imap_conn_find (&mx.account, M_IMAP_CONN_NONEW))) { - debug_print (1, ("Couldn't find open connection to %s\n", mx.account.host)); goto fail; } @@ -322,7 +295,8 @@ int imap_mailbox_rename (const char *mailbox) } if (imap_rename_mailbox (idata, &mx, newname) < 0) { - mutt_error (_("Rename failed: %s"), imap_get_qualifier (idata->cmd.buf)); + mutt_error (_("Rename failed: %s"), + imap_get_qualifier(idata->cmd.buf.data)); mutt_sleep (1); goto fail; } @@ -348,7 +322,6 @@ static int browse_add_list_result (IMAP_DATA * idata, const char *cmd, IMAP_MBOX mx; if (imap_parse_path (state->folder, &mx)) { - debug_print (2, ("current folder %s makes no sense\n", state->folder)); return -1; } @@ -370,8 +343,7 @@ static int browse_add_list_result (IMAP_DATA * idata, const char *cmd, imap_add_folder (idata->delim, name, noselect, noinferiors, state, isparent); } - } - while ((ascii_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0)); + } while ((m_strncmp(idata->cmd.buf.data, idata->cmd.seq, SEQLEN) != 0)); p_delete(&mx.mbox); return 0; @@ -410,7 +382,7 @@ static void imap_add_folder (char delim, char *folder, int noselect, /* apply filemask filter. This should really be done at menu setup rather * than at scan, since it's so expensive to scan. But that's big changes * to browser.c */ - if (!((regexec (Mask.rx, relpath, 0, NULL, 0) == 0) ^ Mask.not)) { + if (!((regexec (Mask.rx, relpath, 0, NULL, 0) == 0) ^ Mask.neg)) { p_delete(&mx.mbox); return; } @@ -464,7 +436,7 @@ static int browse_get_namespace (IMAP_DATA * idata, char *nsbuf, int nsblen, if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE) break; - s = imap_next_word (idata->cmd.buf); + s = imap_next_word (idata->cmd.buf.data); if (ascii_strncasecmp ("NAMESPACE", s, 9) == 0) { /* There are three sections to the response, User, Other, Shared, * and maybe more by extension */ @@ -507,7 +479,6 @@ static int browse_get_namespace (IMAP_DATA * idata, char *nsbuf, int nsblen, } /* skip "" namespaces, they are already listed at the root */ if ((ns[0] != '\0') && (nsbused < nsblen) && (*nns < nsilen)) { - debug_print (3, ("adding %s\n", ns)); nsi->type = type; /* Cyrus doesn't append the delimiter to the namespace, * but UW-IMAP does. We'll strip it here and add it back @@ -553,11 +524,11 @@ static int browse_verify_namespace (IMAP_DATA * idata, * than invisible namespaces */ if (nsi->delim) snprintf (buf, sizeof (buf), "%s \"\" \"%s%c%%\"", - option (OPTIMAPLSUB) ? "LSUB" : "string_list_t", nsi->prefix, + option (OPTIMAPLSUB) ? "LSUB" : "LIST", nsi->prefix, nsi->delim); else snprintf (buf, sizeof (buf), "%s \"\" \"%s%%\"", - option (OPTIMAPLSUB) ? "LSUB" : "string_list_t", nsi->prefix); + option (OPTIMAPLSUB) ? "LSUB" : "LIST", nsi->prefix); imap_cmd_start (idata, buf); @@ -568,8 +539,7 @@ static int browse_verify_namespace (IMAP_DATA * idata, &nsi->noinferiors, &delim) != 0) return -1; nsi->listable |= (name != NULL); - } - while ((ascii_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0)); + } while ((m_strncmp(idata->cmd.buf.data, idata->cmd.seq, SEQLEN) != 0)); } return 0;