#endif
struct Mailbox *m_save = mx_path_resolve(buf);
- savectx = mx_mbox_open(m_save, NULL, MUTT_APPEND);
+ savectx = mx_mbox_open(m_save, MUTT_APPEND);
if (!savectx)
{
mailbox_free(&m_save);
menu->redraw = REDRAW_FULL;
struct Mailbox *m = mx_path_resolve(fname);
- ctx = mx_mbox_open(m, NULL, MUTT_READONLY);
+ ctx = mx_mbox_open(m, MUTT_READONLY);
if (!ctx)
{
mutt_error(_("Unable to open mailbox %s"), fname);
enum MailboxType omagic = MboxType;
MboxType = MUTT_MBOX;
+
struct Mailbox *m_fname = mx_path_resolve(fname);
- struct Context *tmpctx = mx_mbox_open(m_fname, NULL, MUTT_NEWFOLDER);
+ struct Context *tmpctx = mx_mbox_open(m_fname, MUTT_NEWFOLDER);
+
MboxType = omagic;
if (!tmpctx)
goto bail;
}
- tmpctx = mx_mbox_open(m, NULL, MUTT_APPEND);
+ tmpctx = mx_mbox_open(m, MUTT_APPEND);
if (!tmpctx)
{
rc = -1;
m = mx_path_resolve(buf);
free_m = true;
}
- Context = mx_mbox_open(m, NULL, flags);
+ Context = mx_mbox_open(m, flags);
if (Context)
{
menu->current = ci_first_message();
repeat_error = true;
struct Mailbox *m = mx_path_resolve(folder);
- Context = mx_mbox_open(m, NULL, ((flags & MUTT_RO) || ReadOnly) ? MUTT_READONLY : 0);
+ Context = mx_mbox_open(m, ((flags & MUTT_RO) || ReadOnly) ? MUTT_READONLY : 0);
if (!Context)
{
mailbox_free(&m);
if (mutt_file_stat_timespec_compare(&sb, MUTT_STAT_MTIME, &m->stats_last_checked) > 0)
{
- struct Context *ctx = mx_mbox_open(m, NULL, MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK);
+ struct Context *ctx = mx_mbox_open(m, MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK);
if (ctx)
{
m->msg_count = ctx->mailbox->msg_count;
if (!fgets(buf, sizeof(buf), fp))
return -1;
struct Mailbox *m_att = mx_path_resolve(path);
- struct Context *ctx = mx_mbox_open(m_att, NULL, MUTT_APPEND | MUTT_QUIET);
+ struct Context *ctx = mx_mbox_open(m_att, MUTT_APPEND | MUTT_QUIET);
if (!ctx)
{
mailbox_free(&m_att);
/**
* mx_mbox_open - Open a mailbox and parse it
* @param m Mailbox to open
- * @param path Path to the mailbox
* @param flags See below
* @retval ptr Mailbox context
* @retval NULL Error
* * #MUTT_QUIET only print error messages
* * #MUTT_PEEK revert atime where applicable
*/
-struct Context *mx_mbox_open(struct Mailbox *m, const char *path, int flags)
+struct Context *mx_mbox_open(struct Mailbox *m, int flags)
{
- if (!m && (!path || !path[0]))
+ if (!m)
return NULL;
struct Context *ctx = mutt_mem_calloc(1, sizeof(*ctx));
ctx->mailbox = m;
- if (!m)
- {
- m = mx_mbox_find2(path);
- ctx->mailbox = m;
- }
-
- if (!m)
- {
- m = mailbox_new();
- ctx->mailbox = m;
- m->flags = MB_HIDDEN;
- mutt_str_strfcpy(m->path, path, sizeof(m->path));
- /* int rc = */ mx_path_canon2(m, Folder);
- }
m->notify = ctx_mailbox_changed;
m->ndata = ctx;
if (!m->magic)
{
- m->magic = mx_path_probe(path, NULL);
+ m->magic = mx_path_probe(m->path, NULL);
m->mx_ops = mx_get_ops(m->magic);
}
if ((m->magic == MUTT_UNKNOWN) || (m->magic == MUTT_MAILBOX_ERROR) || !m->mx_ops)
{
if (m->magic == MUTT_MAILBOX_ERROR)
- mutt_perror(path);
+ mutt_perror(m->path);
else if (m->magic == MUTT_UNKNOWN || !m->mx_ops)
- mutt_error(_("%s is not a mailbox"), path);
+ mutt_error(_("%s is not a mailbox"), m->path);
mx_fastclose_mailbox(m);
ctx_free(&ctx);
#endif
struct Mailbox *m_trash = mx_path_resolve(Trash);
- struct Context *ctx_trash = mx_mbox_open(m_trash, NULL, MUTT_APPEND);
+ struct Context *ctx_trash = mx_mbox_open(m_trash, MUTT_APPEND);
if (ctx_trash)
{
/* continue from initial scan above */
#endif
{
struct Mailbox *m_read = mx_path_resolve(mbox);
- struct Context *ctx_read = mx_mbox_open(m_read, NULL, MUTT_APPEND);
+ struct Context *ctx_read = mx_mbox_open(m_read, MUTT_APPEND);
if (!ctx_read)
{
mailbox_free(&m_read);
int mx_mbox_check (struct Mailbox *m, int *index_hint);
int mx_mbox_check_stats(struct Mailbox *m, int flags);
int mx_mbox_close (struct Context **pctx);
-struct Context *mx_mbox_open (struct Mailbox *m, const char *path, int flags);
+struct Context *mx_mbox_open (struct Mailbox *m, int flags);
int mx_mbox_sync (struct Mailbox *m, int *index_hint);
int mx_msg_close (struct Mailbox *m, struct Message **msg);
int mx_msg_commit (struct Mailbox *m, struct Message *msg);
}
struct Mailbox *m_spool = mx_path_resolve(Spoolfile);
- struct Context *ctx = mx_mbox_open(m_spool, NULL, MUTT_APPEND);
+ struct Context *ctx = mx_mbox_open(m_spool, MUTT_APPEND);
if (!ctx)
{
mailbox_free(&m_spool);
OptNews = false;
#endif
struct Mailbox *m_post = mx_path_resolve(Postponed);
- struct Context *ctx = mx_mbox_open(m_post, NULL, MUTT_NOSORT | MUTT_QUIET);
+ struct Context *ctx = mx_mbox_open(m_post, MUTT_NOSORT | MUTT_QUIET);
if (!ctx)
{
mailbox_free(&m_post);
if (ctx->mailbox == m)
PostContext = ctx;
else
- PostContext = mx_mbox_open(m, NULL, MUTT_NOSORT);
+ PostContext = mx_mbox_open(m, MUTT_NOSORT);
if (!PostContext)
{
mutt_folder_hook(path, NULL);
#endif
struct Mailbox *m_fcc = mx_path_resolve(path);
- struct Context *ctx_fcc = mx_mbox_open(m_fcc, NULL, MUTT_APPEND | MUTT_QUIET);
+ struct Context *ctx_fcc = mx_mbox_open(m_fcc, MUTT_APPEND | MUTT_QUIET);
if (!ctx_fcc)
{
mutt_debug(1, "unable to open mailbox %s in append-mode, aborting.\n", path);