]> granicus.if.org Git - neomutt/commitdiff
factor out Context from maildir_update_flags()
authorRichard Russon <rich@flatcap.org>
Thu, 22 Nov 2018 12:44:03 +0000 (12:44 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 22 Nov 2018 13:45:24 +0000 (13:45 +0000)
maildir/maildir.h
maildir/mh.c
notmuch/mutt_notmuch.c

index d2c97d3575409c6d70bf91b5ae7ea16a25ed9580..9df02cd3ad2c6a286dbc8ae3dab3ec94e261b220 100644 (file)
@@ -61,7 +61,7 @@ FILE *        maildir_open_find_message(const char *folder, const char *msg, cha
 void          maildir_parse_flags(struct Email *e, const char *path);
 struct Email *maildir_parse_message(enum MailboxType magic, const char *fname, bool is_old, struct Email *e);
 struct Email *maildir_parse_stream(enum MailboxType magic, FILE *f, const char *fname, bool is_old, struct Email *e);
-bool          maildir_update_flags(struct Context *ctx, struct Email *o, struct Email *n);
+bool          maildir_update_flags(struct Mailbox *m, struct Email *o, struct Email *n);
 
 bool          mh_mailbox(struct Mailbox *m, bool check_stats);
 int           mh_check_empty(const char *path);
index 31bf277a028c581c256e9d9f5c03a1fb2a061b18..54472ffe764736d2c1b7a938db1835164d3234d8 100644 (file)
@@ -2181,19 +2181,17 @@ int mh_sync_mailbox_message(struct Context *ctx, int msgno)
 
 /**
  * maildir_update_flags - Update the mailbox flags
- * @param ctx Mailbox
+ * @param m   Mailbox
  * @param o   Old email Header
  * @param n   New email Header
  * @retval true  If the flags changed
  * @retval false Otherwise
  */
-bool maildir_update_flags(struct Context *ctx, struct Email *o, struct Email *n)
+bool maildir_update_flags(struct Mailbox *m, struct Email *o, struct Email *n)
 {
-  if (!ctx || !ctx->mailbox)
+  if (!m)
     return -1;
 
-  struct Mailbox *m = ctx->mailbox;
-
   /* save the global state here so we can reset it at the
    * end of list block if required.
    */
@@ -2560,7 +2558,7 @@ static int maildir_mbox_check(struct Context *ctx, int *index_hint)
        * the flags we just detected.
        */
       if (!m->hdrs[i]->changed)
-        if (maildir_update_flags(ctx, m->hdrs[i], p->email))
+        if (maildir_update_flags(ctx->mailbox, m->hdrs[i], p->email))
           flags_changed = true;
 
       if (m->hdrs[i]->deleted == m->hdrs[i]->trash)
@@ -2939,7 +2937,7 @@ static int mh_mbox_check(struct Context *ctx, int *index_hint)
       m->hdrs[i]->active = true;
       /* found the right message */
       if (!m->hdrs[i]->changed)
-        if (maildir_update_flags(ctx, m->hdrs[i], p->email))
+        if (maildir_update_flags(ctx->mailbox, m->hdrs[i], p->email))
           flags_changed = true;
 
       mutt_email_free(&p->email);
index cd16ac054986496a5b1820e6bb45319f87197e79..6d52a3ac7c826b22a145b697fd4f7d5fcea756e2 100644 (file)
@@ -2280,7 +2280,7 @@ static int nm_mbox_check(struct Context *ctx, int *index_hint)
        */
       struct Email tmp = { 0 };
       maildir_parse_flags(&tmp, new);
-      maildir_update_flags(ctx, e, &tmp);
+      maildir_update_flags(ctx->mailbox, e, &tmp);
     }
 
     if (update_email_tags(e, msg) == 0)