]> granicus.if.org Git - neomutt/commitdiff
mxapi: find an Account when necessary
authorRichard Russon <rich@flatcap.org>
Mon, 5 Nov 2018 11:33:50 +0000 (11:33 +0000)
committerRichard Russon <rich@flatcap.org>
Mon, 5 Nov 2018 11:34:27 +0000 (11:34 +0000)
mx.c

diff --git a/mx.c b/mx.c
index 037e11ed3b889d3a4d42ce684f9076b56d417587..6b394fbabac75a1a6cccc2b396548eb882d38f33 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -264,6 +264,18 @@ struct Context *mx_mbox_open(struct Mailbox *m, const char *path, int flags)
     /* int rc = */ mx_path_canon2(ctx->mailbox, Folder);
   }
 
+  if (!ctx->mailbox->account)
+    ctx->mailbox->account = mx_ac_find(ctx->mailbox);
+
+  if (!ctx->mailbox->account)
+  {
+    struct Account *a = account_create();
+    ctx->mailbox->account = a;
+    a->magic = ctx->mailbox->magic;
+    TAILQ_INSERT_TAIL(&AllAccounts, a, entries);
+    mx_ac_add(a, ctx->mailbox);
+  }
+
 #if 0
   if (!realpath(ctx->mailbox->path, ctx->mailbox->realpath))
   {