mutt_pretty_mailbox(buffer, sizeof(buffer));
#ifdef USE_IMAP
- if (mx_is_imap(np->b->path))
+ if (imap_path_probe(np->b->path, NULL) == MUTT_IMAP)
{
add_folder(menu, state, buffer, NULL, NULL, np->b, NULL);
continue;
char TargetDir[PATH_MAX] = "";
#ifdef USE_IMAP
- /* Use mx_is_imap to check what kind of dir is OldLastDir.
- */
- if (mx_is_imap(OldLastDir))
+ /* Check what kind of dir OldLastDir is. */
+ if (imap_path_probe(OldLastDir, NULL) == MUTT_IMAP)
{
mutt_str_strfcpy(TargetDir, OldLastDir, sizeof(TargetDir));
imap_clean_path(TargetDir, sizeof(TargetDir));
{
mutt_expand_path(file, filelen);
#ifdef USE_IMAP
- if (mx_is_imap(file))
+ if (imap_path_probe(file, NULL) == MUTT_IMAP)
{
init_state(&state, NULL);
state.imap_browse = true;
}
#ifdef USE_IMAP
- if (!mailbox && mx_is_imap(LastDir))
+ if (!mailbox && (imap_path_probe(LastDir, NULL) == MUTT_IMAP))
{
init_state(&state, NULL);
state.imap_browse = true;
mailbox = 0;
mutt_expand_path(buf, sizeof(buf));
#ifdef USE_IMAP
- if (mx_is_imap(buf))
+ if (imap_path_probe(buf, NULL) == MUTT_IMAP)
{
mutt_str_strfcpy(LastDir, buf, sizeof(LastDir));
destroy_state(&state);
examine_mailboxes(menu, &state);
}
#ifdef USE_IMAP
- else if (mx_is_imap(LastDir))
+ else if (imap_path_probe(LastDir, NULL) == MUTT_IMAP)
{
init_state(&state, NULL);
state.imap_browse = true;
mutt_message(_("Copying to %s..."), buf);
#ifdef USE_IMAP
- if (Context->magic == MUTT_IMAP && !(decode || decrypt) && mx_is_imap(buf))
+ if ((Context->magic == MUTT_IMAP) && !(decode || decrypt) && (imap_path_probe(buf, NULL) == MUTT_IMAP))
{
switch (imap_copy_messages(Context, h, buf, delete))
{
else
mutt_str_strfcpy(imap_path, buf, sizeof(imap_path));
- if (mx_is_imap(imap_path))
+ if (imap_path_probe(imap_path, NULL) == MUTT_IMAP)
return imap_complete(buf, buflen, imap_path);
#endif
#ifdef USE_POP
#include "pop/pop.h"
#endif
+#ifdef USE_IMAP
+#include "imap/imap.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
#endif
mutt_expand_path(fname, sizeof(fname));
#ifdef USE_IMAP
- if (!mx_is_imap(fname))
+ if (imap_path_probe(fname, NULL) != MUTT_IMAP)
#endif
#ifdef USE_POP
if (pop_path_probe(fname, NULL) != MUTT_POP)
/* Init newly-added mailboxes */
if (np->b->magic == MUTT_UNKNOWN)
{
- if (mx_is_imap(np->b->path))
+ if (imap_path_probe(np->b->path, NULL) == MUTT_IMAP)
np->b->magic = MUTT_IMAP;
}
struct ImapMbox mx;
size_t len = 0;
- if (!mx_is_imap(path) || imap_parse_path(path, &mx) || !mx.mbox)
+ if ((imap_path_probe(path, NULL) != MUTT_IMAP) || imap_parse_path(path, &mx) || !mx.mbox)
{
mutt_error(_("Bad mailbox name"));
return -1;
}
/* pipeline the postponed count if possible */
pmx.mbox = NULL;
- if (mx_is_imap(Postponed) && !imap_parse_path(Postponed, &pmx) &&
+ if ((imap_path_probe(Postponed, NULL) == MUTT_IMAP) && !imap_parse_path(Postponed, &pmx) &&
mutt_account_match(&pmx.account, &mx.account))
{
imap_status(Postponed, true);
if (!path)
return MUTT_UNKNOWN;
- enum UrlScheme scheme = url_check_scheme(path);
- if ((scheme == U_IMAP) || (scheme == U_IMAPS))
- return MUTT_IMAP;
+ if (mutt_str_strncasecmp(path, "imap://", 7) == 0)
+ return MUTT_NOTMUCH;
+
+ if (mutt_str_strncasecmp(path, "imaps://", 8) == 0)
+ return MUTT_NOTMUCH;
return MUTT_UNKNOWN;
}
tlen = mutt_str_strlen(target.mbox);
/* check whether we can do '=' substitution */
- if (mx_is_imap(folder) && !imap_parse_path(folder, &home))
+ if ((imap_path_probe(folder, NULL) == MUTT_IMAP) && !imap_parse_path(folder, &home))
{
hlen = mutt_str_strlen(home.mbox);
if (tlen && mutt_account_match(&home.account, &target.account) &&
bool skip = false;
#ifdef USE_IMAP
/* we're not connected yet - skip mail folder creation */
- skip |= mx_is_imap(fpath);
+ skip |= (imap_path_probe(fpath, NULL) == MUTT_IMAP);
#endif
#ifdef USE_NNTP
skip |= (nntp_path_probe(fpath, NULL) == MUTT_NNTP);
{
#ifdef USE_IMAP
/* if folder = {host} or imap[s]://host/: don't append slash */
- if (mx_is_imap(Folder) &&
+ if ((imap_path_probe(Folder, NULL) == MUTT_IMAP) &&
(Folder[strlen(Folder) - 1] == '}' || Folder[strlen(Folder) - 1] == '/'))
{
mutt_str_strfcpy(p, Folder, sizeof(p));
#ifdef USE_IMAP
/* Rewrite IMAP path in canonical form - aids in string comparisons of
* folders. May possibly fail, in which case buf should be the same. */
- if (mx_is_imap(buf))
+ if (imap_path_probe(buf, NULL) == MUTT_IMAP)
imap_expand_path(buf, buflen);
#endif
void mutt_get_parent_path(char *path, char *buf, size_t buflen)
{
#ifdef USE_IMAP
- if (mx_is_imap(path))
+ if (imap_path_probe(path, NULL) == MUTT_IMAP)
imap_get_parent_path(path, buf, buflen);
else
#endif
return mutt_str_strcmp(Spoolfile, str) == 0;
}
-#ifdef USE_IMAP
-/**
- * mx_is_imap - Is this an IMAP mailbox
- * @param p Mailbox string to test
- * @retval true It is an IMAP mailbox
- */
-bool mx_is_imap(const char *p)
-{
- enum UrlScheme scheme;
-
- if (!p)
- return false;
-
- if (*p == '{')
- return true;
-
- scheme = url_check_scheme(p);
- if (scheme == U_IMAP || scheme == U_IMAPS)
- return true;
-
- return false;
-}
-#endif
-
/**
* mx_access - Wrapper for access, checks permissions on a given mailbox
* @param path Path of mailbox
int mx_access(const char *path, int flags)
{
#ifdef USE_IMAP
- if (mx_is_imap(path))
+ if (imap_path_probe(path, NULL) == MUTT_IMAP)
return imap_access(path);
#endif
}
#ifdef USE_IMAP
- if (Context->magic == MUTT_IMAP && mx_is_imap(Trash))
+ if (Context->magic == MUTT_IMAP && (imap_path_probe(Trash, NULL) == MUTT_IMAP))
{
if (imap_fast_trash(Context, Trash) == 0)
return 0;
/* try to use server-side copy first */
i = 1;
- if (ctx->magic == MUTT_IMAP && mx_is_imap(mbox))
+ if ((ctx->magic == MUTT_IMAP) && (imap_path_probe(mbox, NULL) == MUTT_IMAP))
{
/* tag messages for moving, and clear old tags, if any */
for (i = 0; i < ctx->msgcount; i++)
void mx_update_context(struct Context *ctx, int new_messages);
void mx_update_tables(struct Context *ctx, bool committing);
-#ifdef USE_IMAP
-bool mx_is_imap(const char *p);
-#endif
-
#endif /* _MUTT_MX_H */
#ifdef USE_IMAP
/* LastModify is useless for IMAP */
- if (mx_is_imap(Postponed))
+ if (imap_path_probe(Postponed, NULL) == MUTT_IMAP)
{
if (force)
{
#ifdef USE_NOTMUCH
#include "notmuch/mutt_notmuch.h"
#endif
+#ifdef USE_IMAP
+#include "imap/imap.h"
+#endif
/* These Config Variables are only used in send.c */
unsigned char AbortNoattach; ///< Config: Abort sending the email if attachments are missing
*/
#ifdef USE_IMAP
- if ((flags & SEND_BATCH) && fcc[0] && mx_is_imap(fcc))
+ if ((flags & SEND_BATCH) && fcc[0] && (imap_path_probe(fcc, NULL) == MUTT_IMAP))
fcc[0] = '\0';
#endif