From: Brendan Cully Date: Mon, 28 Aug 2000 09:39:35 +0000 (+0000) Subject: The attached small patch adjusts mutt_pretty_mailbox to handle X-Git-Tag: mutt-1-3-8-rel~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=889e715d11e2364d92da3bdfa2e560e342fb4c2b;p=mutt The attached small patch adjusts mutt_pretty_mailbox to handle URLs. --- diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index b628d8fc..d1c5c904 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -101,7 +101,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata) irc = imap_cmd_step (idata); while (irc == IMAP_CMD_CONTINUE); - if (irc == IMAP_CMD_FAIL) + if (irc == IMAP_CMD_FAIL || irc == IMAP_CMD_NO) goto bail; if (irc == IMAP_CMD_RESPOND) diff --git a/imap/command.c b/imap/command.c index babde98e..bc8df994 100644 --- a/imap/command.c +++ b/imap/command.c @@ -146,7 +146,7 @@ int imap_cmd_step (IMAP_DATA* idata) if (!mutt_strncmp (idata->buf, idata->seq, SEQLEN)) { cmd_finish (idata); - return IMAP_CMD_DONE; + return imap_code (idata->buf) ? IMAP_CMD_DONE : IMAP_CMD_NO; } return IMAP_CMD_CONTINUE; diff --git a/imap/imap_private.h b/imap/imap_private.h index 9611890e..0c980925 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -35,6 +35,7 @@ /* IMAP command responses */ #define IMAP_CMD_DONE (0) #define IMAP_CMD_FAIL (-1) +#define IMAP_CMD_NO (-2) #define IMAP_CMD_CONTINUE (1) #define IMAP_CMD_RESPOND (2) diff --git a/muttlib.c b/muttlib.c index 0b930a64..365e9327 100644 --- a/muttlib.c +++ b/muttlib.c @@ -22,6 +22,7 @@ #include "mime.h" #include "mailbox.h" #include "mx.h" +#include "url.h" #ifdef HAVE_PGP #include "pgp.h" @@ -663,6 +664,18 @@ void mutt_pretty_mailbox (char *s) char *p = s, *q = s; size_t len; + /* if s is an url, only collapse path component */ + if (url_check_scheme (s) != U_UNKNOWN) + { + p = strchr(s, ':')+1; + if (!strncmp (p, "//", 2)) + q = strchr (p+2, '/'); + if (!q) + q = p; + else + p = q; + } + /* first attempt to collapse the pathname */ while (*p) {