]> granicus.if.org Git - neomutt/commitdiff
move Header to library
authorRichard Russon <rich@flatcap.org>
Tue, 3 Jul 2018 22:54:25 +0000 (23:54 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 16 Jul 2018 21:24:00 +0000 (22:24 +0100)
54 files changed:
Makefile.autosetup
buffy.c
color.c
commands.c
compose.c
copy.c
curs_lib.c
curs_main.c
edit.c
editmsg.c
flags.c
hcache/hcache.c
hdrline.c
hook.c
imap/command.c
imap/imap.c
imap/message.c
imap/util.c
init.c
main.c
mbox.c
mh.c
mutt/header.h [moved from header.h with 96% similarity]
mutt/mutt.h
mutt/thread.c
mutt_attach.c
mutt_header.c [moved from header.c with 92% similarity]
mutt_header.h [new file with mode: 0644]
mutt_notmuch.c
mutt_thread.c
muttlib.c
mx.c
ncrypt/crypt.c
ncrypt/crypt_gpgme.c
ncrypt/pgp.c
ncrypt/smime.c
newsrc.c
nntp.c
pager.c
parse.c
pattern.c
po/POTFILES.in
pop.c
pop_lib.c
postpone.c
query.c
recvattach.c
recvcmd.c
remailer.c
rfc3676.c
score.c
send.c
sendlib.c
sort.c

index e62029ffadd2fbc22dc88de27395b6b2eacbb467..5c355517027f7d491f7770b58d0f2a968a5c3bcd 100644 (file)
@@ -65,8 +65,8 @@ NEOMUTTOBJS=  addrbook.o alias.o bcache.o browser.o buffy.o \
                color.o commands.o complete.o compose.o compress.o \
                conststrings.o copy.o curs_lib.o curs_main.o edit.o editmsg.o \
                enriched.o enter.o filter.o flags.o from.o group.o handler.o \
-               hdrline.o header.o help.o history.o hook.o init.o keymap.o \
-               main.o mbox.o menu.o mh.o muttlib.o mutt_account.o mutt_attach.o mutt_body.o \
+               hdrline.o help.o history.o hook.o init.o keymap.o \
+               main.o mbox.o menu.o mh.o muttlib.o mutt_account.o mutt_attach.o mutt_body.o mutt_header.o \
                mutt_logging.o mutt_signal.o mutt_socket.o mutt_thread.o mutt_window.o mx.o newsrc.o \
                nntp.o pager.o parse.o pattern.o pop.o pop_auth.o pop_lib.o \
                postpone.o progress.o query.o recvattach.o recvcmd.o resize.o rfc1524.o \
@@ -94,7 +94,7 @@ ALLOBJS+=     $(NEOMUTTOBJS)
 LIBMUTT=       libmutt.a
 LIBMUTTOBJS=   mutt/address.o mutt/attach.o mutt/base64.o mutt/body.o mutt/buffer.o mutt/charset.o \
                mutt/date.o mutt/envelope.o mutt/envlist.o mutt/exit.o mutt/file.o mutt/hash.o \
-               mutt/idna.o mutt/list.o mutt/logging.o mutt/mapping.o \
+               mutt/header.o mutt/idna.o mutt/list.o mutt/logging.o mutt/mapping.o \
                mutt/mbyte.o mutt/md5.o mutt/memory.o mutt/mime.o \
                mutt/parameter.o mutt/regex.o mutt/rfc2047.o mutt/sha1.o \
                mutt/signal.o mutt/string.o mutt/tags.o mutt/thread.o
@@ -265,13 +265,13 @@ git_ver.h: $(ALL_FILES)
 hcache/hcversion.h:    $(SRCDIR)/mutt.h $(SRCDIR)/mutt/address.h \
                        $(SRCDIR)/mutt/list.h $(SRCDIR)/mutt/buffer.h \
                        $(SRCDIR)/mutt/parameter.h $(SRCDIR)/mutt/body.h \
-                       $(SRCDIR)/mutt/envelope.h $(SRCDIR)/header.h \
+                       $(SRCDIR)/mutt/envelope.h $(SRCDIR)/mutt/header.h \
                        $(SRCDIR)/hcache/hcachever.sh
        $(MKDIR_P) $(PWD)/hcache
        ( echo '#include "config.h"'; echo '#include "mutt.h"'; \
        echo '#include "mutt/address.h"'; echo '#include "mutt/list.h"'; \
        echo '#include "mutt/buffer.h"'; echo '#include "mutt/parameter.h"'; \
-       echo '#include "header.h"';) | $(CPP) $(CFLAGS) - | \
+       echo '#include "mutt/header.h"';) | $(CPP) $(CFLAGS) - | \
        sh $(SRCDIR)/hcache/hcachever.sh hcache/hcversion.h
 
 # clean
diff --git a/buffy.c b/buffy.c
index 8eb209e2dad7306b5c376c8e981199d8af427d87..9378fd29489ae45509b323683e33826a91802e29 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -34,7 +34,6 @@
 #include "buffy.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
diff --git a/color.c b/color.c
index 8269e5bfa6f123e2cee435c3752fd9929a75b1d9..defd6d1b1749e58eadd664062dccb646308eb516 100644 (file)
--- a/color.c
+++ b/color.c
@@ -30,7 +30,6 @@
 #include "mutt.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "keymap.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
index 3bf6a3ec2e41e26169782e508b24b533cf6d69b1..98639cbb50ed9d4e15d13eff773c2a62255c460d 100644 (file)
@@ -39,7 +39,6 @@
 #include "filter.h"
 #include "format_flags.h"
 #include "globals.h"
-#include "header.h"
 #include "keymap.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
index 42990b37986fa306948346efb17980ce9d06a78a..8126479e82f3f1691f9fb343ccf56ed417feeb71 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -36,7 +36,6 @@
 #include "context.h"
 #include "format_flags.h"
 #include "globals.h"
-#include "header.h"
 #include "keymap.h"
 #include "mailbox.h"
 #include "mutt_attach.h"
diff --git a/copy.c b/copy.c
index d37349ae2de9b54354981db98382cb0403726d90..b70f00289af7e9b08ecee50f4f11ccace5ae6c31 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -37,7 +37,6 @@
 #include "context.h"
 #include "globals.h"
 #include "handler.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mutt_window.h"
index 8faada1df748f15823b397f64d21ee0f7df1c835..2d4a48c20e19ddef4925cbaa7d7dd8b8c9b77a22 100644 (file)
@@ -43,7 +43,6 @@
 #include "context.h"
 #include "enter_state.h"
 #include "globals.h"
-#include "header.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
 #include "mutt_window.h"
index 4718086d99549ce9b78450ccd86d2263966a74ee..e81a15e908a9ffafde630ccc528d16194f825189 100644 (file)
@@ -36,7 +36,6 @@
 #include "context.h"
 #include "format_flags.h"
 #include "globals.h"
-#include "header.h"
 #include "keymap.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
diff --git a/edit.c b/edit.c
index 1c7ba70afc4520035846206d6427d1a0e3271cbe..4f285594756bc5281cadaec8eb05228752d3c192 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -34,7 +34,6 @@
 #include "alias.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "mutt_curses.h"
 #include "mutt_window.h"
 #include "options.h"
index f169fc07d706d1835b45da0fa999091a135cffc9..18c81c5679deb10fb8028f7678ca70ba3da141f6 100644 (file)
--- a/editmsg.c
+++ b/editmsg.c
@@ -40,7 +40,6 @@
 #include "context.h"
 #include "copy.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mx.h"
 #include "options.h"
diff --git a/flags.c b/flags.c
index b54a3dcc5b4499d1b493d35a0bb52b204d3055dd..3f0a324724e41f441a743bd6049c6ff56d7a819f 100644 (file)
--- a/flags.c
+++ b/flags.c
@@ -33,7 +33,6 @@
 #include "mutt.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
 #include "mutt_window.h"
index 5c3505a0c7e6e1e7c145e0e7d9d002b09ba44c38..fd237be38a7dbdee237d8104f4ea5e1b854fe276 100644 (file)
@@ -52,7 +52,6 @@
 #include "globals.h"
 #include "hcache.h"
 #include "hcache/hcversion.h"
-#include "header.h"
 #include "protos.h"
 
 static unsigned int hcachever = 0x0;
index 8dc0a2099efdf5e08b40422bdebf0dc303394cd5..00361bce4f4bc9d203e115f4d020d9ebcfd02f90 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -34,7 +34,6 @@
 #include "context.h"
 #include "format_flags.h"
 #include "globals.h"
-#include "header.h"
 #include "mbtable.h"
 #include "mutt_curses.h"
 #include "mutt_thread.h"
diff --git a/hook.c b/hook.c
index 9646cd2170b8f5ae468d048b69c4560a105d9a1c..7d1b547e2a8faa01c08204ec18e731441d3c8e9a 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -36,7 +36,6 @@
 #include "mutt/mutt.h"
 #include "mutt.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "ncrypt/ncrypt.h"
 #include "options.h"
index 13be77a79d24ec0de90403bcb447954759ca8c14..7eb42e2c468f68056e8b38f86151f7bfb6de13ba 100644 (file)
@@ -42,7 +42,6 @@
 #include "buffy.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "imap/imap.h"
 #include "mailbox.h"
 #include "message.h"
index 4f423856e4431ecf3d1c3f47b5264aed6f9cdf45..839583cb4f108edd28f97d8a442a62316049e9f9 100644 (file)
@@ -47,7 +47,6 @@
 #include "buffy.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "message.h"
 #include "mutt_account.h"
index 33a189fc1bbafe0539b0b78154aede29e5d7a5c5..10ce5a837bcd942abf4ece256eba35b30057586f 100644 (file)
@@ -42,7 +42,6 @@
 #include "bcache.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "imap/imap.h"
 #include "mailbox.h"
 #include "mutt_account.h"
index fccfdbf453f68e69369939dbfc9b8d7d02635129..d73ddf757be4b58230273dff848a39b9eba86f95 100644 (file)
@@ -47,7 +47,6 @@
 #include "bcache.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "imap/imap.h"
 #include "mailbox.h"
 #include "message.h"
diff --git a/init.c b/init.c
index 3829bd19a23ba0d8add88d35987f3960c3e6a13a..298113d656ef934c5a9114ae706fc0135975df3d 100644 (file)
--- a/init.c
+++ b/init.c
@@ -42,7 +42,6 @@
 #include "filter.h"
 #include "group.h"
 #include "hcache/hcache.h"
-#include "header.h"
 #include "history.h"
 #include "keymap.h"
 #include "mailbox.h"
diff --git a/main.c b/main.c
index 969d339b28a3c37d88b48047387bacc475d726dc..410708c856a46a4b0056ff809826b01d9b23d3fc 100644 (file)
--- a/main.c
+++ b/main.c
@@ -47,7 +47,6 @@
 #include "alias.h"
 #include "buffy.h"
 #include "globals.h"
-#include "header.h"
 #include "keymap.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
diff --git a/mbox.c b/mbox.c
index cb032c80f831d4486149153b4c3bd55e382b8e9f..d8ccaa5cbc7efdc2f6e6f1eaa993e4587f928a04 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -38,7 +38,6 @@
 #include "context.h"
 #include "copy.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mutt_thread.h"
@@ -595,37 +594,6 @@ static int mbox_msg_open_new(struct Context *ctx, struct Message *msg, struct He
   return 0;
 }
 
-/**
- * mbox_strict_cmp_headers - Strictly compare message headers
- * @param h1 First Header
- * @param h2 Second Header
- * @retval true Headers are strictly identical
- */
-bool mbox_strict_cmp_headers(const struct Header *h1, const struct Header *h2)
-{
-  if (h1 && h2)
-  {
-    if ((h1->received != h2->received) || (h1->date_sent != h2->date_sent) ||
-        (h1->content->length != h2->content->length) ||
-        (h1->lines != h2->lines) || (h1->zhours != h2->zhours) ||
-        (h1->zminutes != h2->zminutes) || (h1->zoccident != h2->zoccident) ||
-        (h1->mime != h2->mime) || !mutt_env_cmp_strict(h1->env, h2->env) ||
-        !mutt_body_cmp_strict(h1->content, h2->content))
-    {
-      return false;
-    }
-    else
-      return true;
-  }
-  else
-  {
-    if (!h1 && !h2)
-      return true;
-    else
-      return false;
-  }
-}
-
 /**
  * reopen_mailbox - Close and reopen a mailbox
  * @param ctx        Mailbox
@@ -702,7 +670,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint)
   {
     case MUTT_MBOX:
     case MUTT_MMDF:
-      cmp_headers = mbox_strict_cmp_headers;
+      cmp_headers = mutt_header_cmp_strict;
       mutt_file_fclose(&ctx->fp);
       ctx->fp = mutt_file_fopen(ctx->path, "r");
       if (!ctx->fp)
diff --git a/mh.c b/mh.c
index 9a89ea663f4334c78020ba8ddd43dcd08937dd49..7dca50e21067e3b06a588d17e620d5a73fbf35f7 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -44,7 +44,6 @@
 #include "context.h"
 #include "copy.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mutt_thread.h"
@@ -2529,7 +2528,7 @@ static int mh_mbox_check(struct Context *ctx, int *index_hint)
     ctx->hdrs[i]->active = false;
 
     p = mutt_hash_find(fnames, ctx->hdrs[i]->path);
-    if (p && p->h && mbox_strict_cmp_headers(ctx->hdrs[i], p->h))
+    if (p && p->h && mutt_header_cmp_strict(ctx->hdrs[i], p->h))
     {
       ctx->hdrs[i]->active = true;
       /* found the right message */
similarity index 96%
rename from header.h
rename to mutt/header.h
index 0645765dd04bc1de99615882c169172c387eec12..31029c156840354d7c3e134a5fbe28819d35ae91 100644 (file)
--- a/header.h
@@ -26,7 +26,8 @@
 #include <stddef.h>
 #include <stdbool.h>
 #include <time.h>
-#include "mutt/mutt.h"
+#include "list.h"
+#include "tags.h"
 
 /**
  * struct Header - The header/envelope of an email
@@ -55,9 +56,7 @@ struct Header
   bool recip_valid     : 1; /**< is_recipient is valid */
   bool active          : 1; /**< message is not to be removed */
   bool trash           : 1; /**< message is marked as trashed on disk.
-                             * This flag is used by the maildir_trash
-                             * option.
-                             */
+                             * This flag is used by the maildir_trash option. */
   bool xlabel_changed  : 1; /**< editable - used for syncing */
 
   /* timezone of the sender of this message */
@@ -117,9 +116,8 @@ struct Header
   char *maildir_flags; /**< unknown maildir flags */
 };
 
+bool           mutt_header_cmp_strict(const struct Header *h1, const struct Header *h2);
 void           mutt_header_free(struct Header **h);
 struct Header *mutt_header_new(void);
 
-bool mbox_strict_cmp_headers(const struct Header *h1, const struct Header *h2);
-
 #endif /* _MUTT_HEADER_H */
index fb4e8c794c2fa3cca3f7b5edc945aa5bddcdfed8..20361571d39993b5e2f0504c9c80b5aec3c9383c 100644 (file)
@@ -39,6 +39,7 @@
  * | mutt/exit.c      | @subpage exit      |
  * | mutt/file.c      | @subpage file      |
  * | mutt/hash.c      | @subpage hash      |
+ * | mutt/header.c    | @subpage header    |
  * | mutt/idna.c      | @subpage idna      |
  * | mutt/list.c      | @subpage list      |
  * | mutt/logging.c   | @subpage logging   |
@@ -76,6 +77,7 @@
 #include "exit.h"
 #include "file.h"
 #include "hash.h"
+#include "header.h"
 #include "idna2.h"
 #include "list.h"
 #include "logging.h"
index 260f7ae763518eb6d39f1f83d81b878b9435e90d..9caeb25294c57ed06eb19c2e99d5ef7c21fbc38f 100644 (file)
@@ -32,7 +32,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include "header.h"
+#include "thread.h"
 
 /**
  * is_descendant - Is one thread a descendant of another
index 349d238b96e26015641d090f129aba3235bafddd..0991ad471abca457c5419f8741dcdc6ab4e2caf3 100644 (file)
@@ -33,7 +33,6 @@
 #include "filter.h"
 #include "globals.h"
 #include "handler.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mx.h"
similarity index 92%
rename from header.c
rename to mutt_header.c
index fe16ef61396e7e362febc7679b057853f144c1cc..2910efe6507f89341a4820b01c4a7633bbedc866 100644 (file)
--- a/header.c
 #include <sys/stat.h>
 #include <time.h>
 #include "mutt/mutt.h"
-#include "mutt.h"
-#include "header.h"
 #include "alias.h"
 #include "context.h"
 #include "globals.h"
 #include "ncrypt/ncrypt.h"
-#include "options.h"
 #include "protos.h"
 
+static void label_ref_dec(struct Context *ctx, char *label)
+{
+  struct HashElem *elem = mutt_hash_find_elem(ctx->label_hash, label);
+  if (!elem)
+    return;
+
+  uintptr_t count = (uintptr_t) elem->data;
+  if (count <= 1)
+  {
+    mutt_hash_delete(ctx->label_hash, label, NULL);
+    return;
+  }
+
+  count--;
+  elem->data = (void *) count;
+}
+
+static void label_ref_inc(struct Context *ctx, char *label)
+{
+  uintptr_t count;
+
+  struct HashElem *elem = mutt_hash_find_elem(ctx->label_hash, label);
+  if (!elem)
+  {
+    count = 1;
+    mutt_hash_insert(ctx->label_hash, label, (void *) count);
+    return;
+  }
+
+  count = (uintptr_t) elem->data;
+  count++;
+  elem->data = (void *) count;
+}
+
+/**
+ * label_message - add an X-Label: field
+ */
+static bool label_message(struct Context *ctx, struct Header *hdr, char *new)
+{
+  if (!hdr)
+    return false;
+  if (mutt_str_strcmp(hdr->env->x_label, new) == 0)
+    return false;
+
+  if (hdr->env->x_label)
+    label_ref_dec(ctx, hdr->env->x_label);
+  mutt_str_replace(&hdr->env->x_label, new);
+  if (hdr->env->x_label)
+    label_ref_inc(ctx, hdr->env->x_label);
+
+  hdr->changed = true;
+  hdr->xlabel_changed = true;
+  return true;
+}
+
+int mutt_label_message(struct Header *hdr)
+{
+  char buf[LONG_STRING], *new = NULL;
+  int changed;
+
+  if (!Context || !Context->label_hash)
+    return 0;
+
+  *buf = '\0';
+  if (hdr != NULL && hdr->env->x_label != NULL)
+  {
+    mutt_str_strfcpy(buf, hdr->env->x_label, sizeof(buf));
+  }
+
+  if (mutt_get_field("Label: ", buf, sizeof(buf), MUTT_LABEL /* | MUTT_CLEAR */) != 0)
+    return 0;
+
+  new = buf;
+  SKIPWS(new);
+  if (*new == '\0')
+    new = NULL;
+
+  changed = 0;
+  if (hdr)
+  {
+    if (label_message(Context, hdr, new))
+    {
+      changed++;
+      mutt_set_header_color(Context, hdr);
+    }
+  }
+  else
+  {
+    for (int i = 0; i < Context->msgcount; ++i)
+    {
+      if (!message_is_tagged(Context, i))
+        continue;
+
+      struct Header *h = Context->hdrs[i];
+      if (label_message(Context, h, new))
+      {
+        changed++;
+        mutt_set_flag(Context, h, MUTT_TAG, 0);
+        /* mutt_set_flag re-evals the header color */
+      }
+    }
+  }
+
+  return changed;
+}
+
 void mutt_edit_headers(const char *editor, const char *body, struct Header *msg,
                        char *fcc, size_t fcclen)
 {
@@ -223,112 +326,6 @@ void mutt_edit_headers(const char *editor, const char *body, struct Header *msg,
   }
 }
 
-static void label_ref_dec(struct Context *ctx, char *label)
-{
-  struct HashElem *elem = mutt_hash_find_elem(ctx->label_hash, label);
-  if (!elem)
-    return;
-
-  uintptr_t count = (uintptr_t) elem->data;
-  if (count <= 1)
-  {
-    mutt_hash_delete(ctx->label_hash, label, NULL);
-    return;
-  }
-
-  count--;
-  elem->data = (void *) count;
-}
-
-static void label_ref_inc(struct Context *ctx, char *label)
-{
-  uintptr_t count;
-
-  struct HashElem *elem = mutt_hash_find_elem(ctx->label_hash, label);
-  if (!elem)
-  {
-    count = 1;
-    mutt_hash_insert(ctx->label_hash, label, (void *) count);
-    return;
-  }
-
-  count = (uintptr_t) elem->data;
-  count++;
-  elem->data = (void *) count;
-}
-
-/**
- * label_message - add an X-Label: field
- */
-static bool label_message(struct Context *ctx, struct Header *hdr, char *new)
-{
-  if (!hdr)
-    return false;
-  if (mutt_str_strcmp(hdr->env->x_label, new) == 0)
-    return false;
-
-  if (hdr->env->x_label)
-    label_ref_dec(ctx, hdr->env->x_label);
-  mutt_str_replace(&hdr->env->x_label, new);
-  if (hdr->env->x_label)
-    label_ref_inc(ctx, hdr->env->x_label);
-
-  hdr->changed = true;
-  hdr->xlabel_changed = true;
-  return true;
-}
-
-int mutt_label_message(struct Header *hdr)
-{
-  char buf[LONG_STRING], *new = NULL;
-  int changed;
-
-  if (!Context || !Context->label_hash)
-    return 0;
-
-  *buf = '\0';
-  if (hdr != NULL && hdr->env->x_label != NULL)
-  {
-    mutt_str_strfcpy(buf, hdr->env->x_label, sizeof(buf));
-  }
-
-  if (mutt_get_field("Label: ", buf, sizeof(buf), MUTT_LABEL /* | MUTT_CLEAR */) != 0)
-    return 0;
-
-  new = buf;
-  SKIPWS(new);
-  if (*new == '\0')
-    new = NULL;
-
-  changed = 0;
-  if (hdr)
-  {
-    if (label_message(Context, hdr, new))
-    {
-      changed++;
-      mutt_set_header_color(Context, hdr);
-    }
-  }
-  else
-  {
-    for (int i = 0; i < Context->msgcount; ++i)
-    {
-      if (!message_is_tagged(Context, i))
-        continue;
-
-      struct Header *h = Context->hdrs[i];
-      if (label_message(Context, h, new))
-      {
-        changed++;
-        mutt_set_flag(Context, h, MUTT_TAG, 0);
-        /* mutt_set_flag re-evals the header color */
-      }
-    }
-  }
-
-  return changed;
-}
-
 void mutt_make_label_hash(struct Context *ctx)
 {
   /* 131 is just a rough prime estimate of how many distinct
@@ -352,34 +349,3 @@ void mutt_label_hash_remove(struct Context *ctx, struct Header *hdr)
   if (hdr->env->x_label)
     label_ref_dec(ctx, hdr->env->x_label);
 }
-
-void mutt_header_free(struct Header **h)
-{
-  if (!h || !*h)
-    return;
-  mutt_env_free(&(*h)->env);
-  mutt_body_free(&(*h)->content);
-  FREE(&(*h)->maildir_flags);
-  FREE(&(*h)->tree);
-  FREE(&(*h)->path);
-#ifdef MIXMASTER
-  mutt_list_free(&(*h)->chain);
-#endif
-  driver_tags_free(&(*h)->tags);
-#if defined(USE_POP) || defined(USE_IMAP) || defined(USE_NNTP) || defined(USE_NOTMUCH)
-  if ((*h)->free_cb)
-    (*h)->free_cb(*h);
-  FREE(&(*h)->data);
-#endif
-  FREE(h);
-}
-
-struct Header *mutt_header_new(void)
-{
-  struct Header *h = mutt_mem_calloc(1, sizeof(struct Header));
-#ifdef MIXMASTER
-  STAILQ_INIT(&h->chain);
-#endif
-  STAILQ_INIT(&h->tags);
-  return h;
-}
diff --git a/mutt_header.h b/mutt_header.h
new file mode 100644 (file)
index 0000000..ab21735
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * @file
+ * Representation of the email's header
+ *
+ * @authors
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_HEADER_H
+#define _MUTT_HEADER_H
+
+#include <stddef.h>
+#include <stdbool.h>
+#include <time.h>
+
+#endif /* _MUTT_HEADER_H */
index 86e5945d2c9bf5b0852604e7486be0fbef686c36..6075bbc0c3846be981101da9b44ec2db97efdd68 100644 (file)
@@ -53,7 +53,6 @@
 #include "buffy.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mutt_thread.h"
index 247321217cd711639e9452cfcf79f6e3b085ff78..97827e1d56ea98ac1e0ede35040c3d583150e429 100644 (file)
@@ -31,7 +31,6 @@
 #include "mutt_thread.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "options.h"
 #include "protos.h"
 #include "sort.h"
index 2e55fefb825958b90331562eeb7c43b62f12644e..5d3e439a627074a0b9afd8848b812ed0e32c1211 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -46,7 +46,6 @@
 #include "filter.h"
 #include "format_flags.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mutt_window.h"
diff --git a/mx.c b/mx.c
index 18510989719f37a7eac3113112fbff8e4130e3b7..b0fcfc00a2191084debcb36d2fb9fad64ad5fc3e 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -43,7 +43,6 @@
 #include "context.h"
 #include "copy.h"
 #include "globals.h"
-#include "header.h"
 #include "keymap.h"
 #include "mailbox.h"
 #include "mutt_thread.h"
index 92bc91028a4b40a558d88b57f15257cc6e0cffd5..5d18f727c9dc0b35a771ebf0abcdcc3d44fc2f80 100644 (file)
@@ -46,7 +46,6 @@
 #include "cryptglue.h"
 #include "globals.h"
 #include "handler.h"
-#include "header.h"
 #include "mutt_curses.h"
 #include "ncrypt.h"
 #include "options.h"
index ae0caa82decb9d00bc15dcd51b872ef1ac50452c..3f89cf49f288a08c85aa593ac28861e659a8d255 100644 (file)
@@ -55,7 +55,6 @@
 #include "format_flags.h"
 #include "globals.h"
 #include "handler.h"
-#include "header.h"
 #include "keymap.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
index b57fe47420a495fa4ece57319ef8eab3743117c2..9bf889e92e8a97b56e1872a92e841fc9b5bacd19 100644 (file)
@@ -49,7 +49,6 @@
 #include "filter.h"
 #include "globals.h"
 #include "handler.h"
-#include "header.h"
 #include "mutt_curses.h"
 #include "ncrypt.h"
 #include "options.h"
index ff9428794787dfcab7f3c69b0da4aae79359e374..f4fe7de2cb82d930d5b01197e091072b648c4d1b 100644 (file)
@@ -46,7 +46,6 @@
 #include "format_flags.h"
 #include "globals.h"
 #include "handler.h"
-#include "header.h"
 #include "keymap.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
index 990d7f6cc37657c0d0209c23bc489ab2ccb18a84..a4e9e3f908e3405702534a6b9fc5725f11c08666 100644 (file)
--- a/newsrc.c
+++ b/newsrc.c
@@ -45,7 +45,6 @@
 #include "context.h"
 #include "format_flags.h"
 #include "globals.h"
-#include "header.h"
 #include "mutt_account.h"
 #include "mutt_curses.h"
 #include "mutt_socket.h"
diff --git a/nntp.c b/nntp.c
index fdc2e05efa5125b96d2015c46ce40f6ea7c703b4..c0df76533fa428aeaa3357228f8ff7d584e8a7a9 100644 (file)
--- a/nntp.c
+++ b/nntp.c
@@ -41,7 +41,6 @@
 #include "bcache.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_account.h"
 #include "mutt_curses.h"
diff --git a/pager.c b/pager.c
index c6eda5ed2a1ea78ed29ae214b8a1953168e908c1..8ed1dc8dae457864f1d8af6cc355b9baa1d71aae 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -39,7 +39,6 @@
 #include "context.h"
 #include "format_flags.h"
 #include "globals.h"
-#include "header.h"
 #include "keymap.h"
 #include "mailbox.h"
 #include "mutt_attach.h"
diff --git a/parse.c b/parse.c
index 53b3e90da1482ce93fc3796c0050efd5ecd96e52..00f660d1b3bd32db2b1af69094f7dbbf3129af17 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -31,7 +31,6 @@
 #include "mutt/mutt.h"
 #include "mutt.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "ncrypt/ncrypt.h"
 #include "options.h"
index a19d6b66ff4c0e5b1800be7f33edb7db905d4161..75bbf3ae69d642967a04f2683a7d41ca77df99ec 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -42,7 +42,6 @@
 #include "globals.h"
 #include "group.h"
 #include "handler.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
index 97a9f3a1a8ead9ab63b2311f0bc6f2f2c26d1024..ec271c3230d5ed69b052c233b737ab840d54347c 100644 (file)
@@ -37,7 +37,6 @@ hcache/lmdb.c
 hcache/qdbm.c
 hcache/tc.c
 hdrline.c
-header.c
 help.c
 history.c
 hook.c
@@ -72,6 +71,7 @@ mutt/envlist.c
 mutt/exit.c
 mutt/file.c
 mutt/hash.c
+mutt/header.c
 mutt/idna.c
 mutt/list.c
 mutt/logging.c
@@ -91,6 +91,7 @@ mutt/thread.c
 mutt_account.c
 mutt_attach.c
 mutt_body.c
+mutt_header.c
 mutt_logging.c
 mutt_lua.c
 mutt_notmuch.c
@@ -149,7 +150,6 @@ state.c
 status.c
 system.c
 terminal.c
-thread.c
 url.c
 version.c
 wcscasecmp.c
diff --git a/pop.c b/pop.c
index b2557b65a49bafd838a3d9d0bea4431d991f0c99..ac87aa7d7ee7271f3b39ba807f5ab3532f3d453a 100644 (file)
--- a/pop.c
+++ b/pop.c
@@ -41,7 +41,6 @@
 #include "bcache.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_account.h"
 #include "mutt_curses.h"
index 47d0507d7f6866a3310422bec94dc0adc70babd4..455b1edaa05fcb774842ccdd082ce403d2d7e569 100644 (file)
--- a/pop_lib.c
+++ b/pop_lib.c
@@ -33,7 +33,6 @@
 #include "mutt.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "mutt_account.h"
 #include "mutt_curses.h"
 #include "mutt_socket.h"
index d3ea06aaec33d2d3295f2b142723514c1f8b86ac..47c826a08cf4dbacabf09c558ea79d52a527bb77 100644 (file)
@@ -42,7 +42,6 @@
 #include "format_flags.h"
 #include "globals.h"
 #include "handler.h"
-#include "header.h"
 #include "keymap.h"
 #include "mailbox.h"
 #include "mutt_menu.h"
diff --git a/query.c b/query.c
index ffc90126cb6c3a811ac1dad93a0f063541f6ee56..4699ae32bd0315240892de1702b937ed41059471 100644 (file)
--- a/query.c
+++ b/query.c
@@ -33,7 +33,6 @@
 #include "filter.h"
 #include "format_flags.h"
 #include "globals.h"
-#include "header.h"
 #include "keymap.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
index 6fa766047c8f28ae1e728718621e4b1cdd2d86d8..ef1f424b3f539f9de80063d5f110652de25d2b65 100644 (file)
@@ -35,7 +35,6 @@
 #include "format_flags.h"
 #include "globals.h"
 #include "handler.h"
-#include "header.h"
 #include "keymap.h"
 #include "mailbox.h"
 #include "mutt_attach.h"
index 94f70c16b22f2ae54a65813bfc10065d9af28b39..5d1d6500456a3279e785b55c5f8da48837c043ff 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -31,7 +31,6 @@
 #include "copy.h"
 #include "globals.h"
 #include "handler.h"
-#include "header.h"
 #include "mutt_body.h"
 #include "mutt_curses.h"
 #include "mutt_window.h"
index daaddcdc6ac465849471bea6639895392e2d96f8..dbae0c4e19e0c3efafb494ffd31f3aa35e8e8a4c 100644 (file)
@@ -34,7 +34,6 @@
 #include "format_flags.h"
 #include "globals.h"
 #include "handler.h"
-#include "header.h"
 #include "keymap.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
index 302d6203594c6a3f41526cf249f9b8e874f88a01..47f7243179936ad3f446b4a215397c746192ab1d 100644 (file)
--- a/rfc3676.c
+++ b/rfc3676.c
@@ -31,7 +31,6 @@
 #include <unistd.h>
 #include "mutt/mutt.h"
 #include "globals.h"
-#include "header.h"
 #include "mutt_curses.h"
 #include "mutt_window.h"
 #include "options.h"
diff --git a/score.c b/score.c
index eaa17f2d9a9fc3e573775593050627f232f66264..007872cc5a787705318b5bd636639579e4494314 100644 (file)
--- a/score.c
+++ b/score.c
@@ -28,7 +28,6 @@
 #include "mutt.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "keymap.h"
 #include "mutt_menu.h"
 #include "options.h"
diff --git a/send.c b/send.c
index 0c9bf07dd05c0852b0990a97e3b0ae5b0cae173e..880f4868e55ad507c8db119f655fe3c50a7dce86 100644 (file)
--- a/send.c
+++ b/send.c
@@ -38,7 +38,6 @@
 #include "copy.h"
 #include "filter.h"
 #include "globals.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "ncrypt/ncrypt.h"
index c48063df71848efa3545114accef9e3e9e62d1b7..97c39c8a183555902e0d8362ffe16e1d99984019 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -44,7 +44,6 @@
 #include "format_flags.h"
 #include "globals.h"
 #include "handler.h"
-#include "header.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mutt_window.h"
diff --git a/sort.c b/sort.c
index 54629b2f8c41e652c2f6797ce31c3300bf24ddb5..9e6c773f08a0e955972d7fc98cdfe4d1373c424c 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -28,7 +28,6 @@
 #include "sort.h"
 #include "context.h"
 #include "globals.h"
-#include "header.h"
 #include "mutt_thread.h"
 #include "options.h"
 #include "protos.h"