From: Richard Russon Date: Sat, 25 Aug 2018 16:46:41 +0000 (+0100) Subject: probe pop X-Git-Tag: 2019-10-25~682^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0ded4b24259649e852dff4bb55392d35f923f859;p=neomutt probe pop --- diff --git a/browser.c b/browser.c index c0bf670eb..a793194ec 100644 --- a/browser.c +++ b/browser.c @@ -66,6 +66,9 @@ #ifdef USE_NOTMUCH #include "notmuch/mutt_notmuch.h" #endif +#ifdef USE_POP +#include "pop/pop.h" +#endif /* These Config Variables are only used in browser.c */ bool BrowserAbbreviateMailboxes; ///< Config: Abbreviate mailboxes using '~' and '=' in the browser @@ -987,7 +990,7 @@ static int examine_mailboxes(struct Menu *menu, struct BrowserState *state) } #endif #ifdef USE_POP - if (mx_is_pop(np->b->path)) + if (pop_path_probe(np->b->path, NULL) == MUTT_POP) { add_folder(menu, state, buffer, NULL, NULL, np->b, NULL); continue; diff --git a/compose.c b/compose.c index 5563e7e83..d0749cf40 100644 --- a/compose.c +++ b/compose.c @@ -70,6 +70,9 @@ #ifdef USE_NNTP #include "nntp/nntp.h" #endif +#ifdef USE_POP +#include "pop/pop.h" +#endif /* These Config Variables are only used in compose.c */ char *ComposeFormat; ///< Config: printf-like format string for the Compose panel's status bar @@ -1431,7 +1434,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen, if (!mx_is_imap(fname)) #endif #ifdef USE_POP - if (!mx_is_pop(fname)) + if (pop_path_probe(fname, NULL) != MUTT_POP) #endif #ifdef USE_NNTP if (!OptNews && (nntp_path_probe(fname, NULL) != MUTT_NNTP)) diff --git a/mailbox.c b/mailbox.c index 2d35ca093..19927a720 100644 --- a/mailbox.c +++ b/mailbox.c @@ -55,6 +55,9 @@ #ifdef USE_NNTP #include "nntp/nntp.h" #endif +#ifdef USE_POP +#include "pop/pop.h" +#endif /* These Config Variables are only used in mailbox.c */ short MailCheck; ///< Config: Number of seconds before NeoMutt checks for new mail @@ -397,7 +400,7 @@ static void mailbox_check(struct Mailbox *tmp, struct stat *contex_sb, bool chec { tmp->new = false; #ifdef USE_POP - if (mx_is_pop(tmp->path)) + if (pop_path_probe(tmp->path, NULL) == MUTT_POP) tmp->magic = MUTT_POP; else #endif diff --git a/mx.c b/mx.c index 745c1859c..1c7ecd205 100644 --- a/mx.c +++ b/mx.c @@ -171,27 +171,6 @@ bool mx_is_imap(const char *p) } #endif -#ifdef USE_POP -/** - * mx_is_pop - Is this a POP mailbox - * @param p Mailbox string to test - * @retval true It is a POP mailbox - */ -bool mx_is_pop(const char *p) -{ - enum UrlScheme scheme; - - if (!p) - return false; - - scheme = url_check_scheme(p); - if (scheme == U_POP || scheme == U_POPS) - return true; - - return false; -} -#endif - /** * mx_access - Wrapper for access, checks permissions on a given mailbox * @param path Path of mailbox diff --git a/mx.h b/mx.h index d81d09990..ebc3f92a9 100644 --- a/mx.h +++ b/mx.h @@ -255,8 +255,5 @@ void mx_update_tables(struct Context *ctx, bool committing); #ifdef USE_IMAP bool mx_is_imap(const char *p); #endif -#ifdef USE_POP -bool mx_is_pop(const char *p); -#endif #endif /* _MUTT_MX_H */ diff --git a/pop/pop.c b/pop/pop.c index d4a86217e..e25da70b9 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -1064,9 +1064,11 @@ int pop_path_probe(const char *path, const struct stat *st) if (!path) return MUTT_UNKNOWN; - enum UrlScheme scheme = url_check_scheme(path); - if ((scheme == U_POP) || (scheme == U_POPS)) - return MUTT_POP; + if (mutt_str_strncasecmp(path, "pop://", 6) == 0) + return MUTT_NOTMUCH; + + if (mutt_str_strncasecmp(path, "pops://", 7) == 0) + return MUTT_NOTMUCH; return MUTT_UNKNOWN; } diff --git a/pop/pop_private.h b/pop/pop_private.h index 65fda85b0..d054bdadf 100644 --- a/pop/pop_private.h +++ b/pop/pop_private.h @@ -124,5 +124,4 @@ int pop_fetch_data(struct PopData *pop_data, char *query, struct Progress *progr int pop_reconnect(struct Context *ctx); void pop_logout(struct Context *ctx); - #endif /* _POP_PRIVATE_H */