###############################################################################
# neomutt
NEOMUTT= neomutt$(EXEEXT)
-NEOMUTTOBJS= addrbook.o alias.o attach.o bcache.o body.o browser.o buffy.o \
+NEOMUTTOBJS= addrbook.o alias.o attach.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 \
+ main.o mbox.o menu.o mh.o muttlib.o mutt_account.o mutt_body.o \
mutt_logging.o mutt_signal.o mutt_socket.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 \
###############################################################################
# libmutt
LIBMUTT= libmutt.a
-LIBMUTTOBJS= mutt/address.o mutt/base64.o mutt/buffer.o mutt/charset.o \
+LIBMUTTOBJS= mutt/address.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/mbyte.o mutt/md5.o mutt/memory.o mutt/mime.o \
hcache/hcversion.h: $(SRCDIR)/mutt.h $(SRCDIR)/mutt/address.h \
$(SRCDIR)/mutt/list.h $(SRCDIR)/mutt/buffer.h \
- $(SRCDIR)/mutt/parameter.h $(SRCDIR)/body.h \
+ $(SRCDIR)/mutt/parameter.h $(SRCDIR)/mutt/body.h \
$(SRCDIR)/mutt/envelope.h $(SRCDIR)/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 "body.h"'; echo '#include "mutt/envelope.h"'; \
echo '#include "header.h"';) | $(CPP) $(CFLAGS) - | \
sh $(SRCDIR)/hcache/hcachever.sh hcache/hcversion.h
#include "mutt/mutt.h"
#include "mutt.h"
#include "attach.h"
-#include "body.h"
#include "context.h"
#include "copy.h"
#include "filter.h"
#include "mutt.h"
#include "browser.h"
#include "attach.h"
-#include "body.h"
#include "buffy.h"
#include "context.h"
#include "format_flags.h"
#include "conn/conn.h"
#include "mutt.h"
#include "alias.h"
-#include "body.h"
#include "buffy.h"
#include "context.h"
#include "copy.h"
#include "mutt.h"
#include "alias.h"
#include "attach.h"
-#include "body.h"
#include "context.h"
#include "format_flags.h"
#include "globals.h"
#include "mutt/mutt.h"
#include "mutt.h"
#include "copy.h"
-#include "body.h"
#include "context.h"
#include "globals.h"
#include "handler.h"
#include "conn/conn.h"
#include "mutt.h"
#include "alias.h"
-#include "body.h"
#include "buffy.h"
#include "context.h"
#include "format_flags.h"
#include <sys/stat.h>
#include "mutt/mutt.h"
#include "alias.h"
-#include "body.h"
#include "context.h"
#include "globals.h"
#include "header.h"
#include <wchar.h>
#include <wctype.h>
#include "mutt/mutt.h"
-#include "body.h"
#include "mutt_window.h"
#include "state.h"
#include "mutt/mutt.h"
#include "mutt.h"
#include "handler.h"
-#include "body.h"
#include "copy.h"
#include "enriched.h"
#include "filter.h"
#include <unistd.h>
#include "mutt/mutt.h"
#include "backend.h"
-#include "body.h"
#include "globals.h"
#include "hcache.h"
#include "hcache/hcversion.h"
#include <time.h>
#include "mutt/mutt.h"
#include "mutt.h"
-#include "body.h"
#include "context.h"
#include "format_flags.h"
#include "globals.h"
#include "mutt.h"
#include "header.h"
#include "alias.h"
-#include "body.h"
#include "context.h"
#include "globals.h"
#include "ncrypt/ncrypt.h"
#include "imap.h"
#include "auth.h"
#include "bcache.h"
-#include "body.h"
#include "buffy.h"
#include "context.h"
#include "globals.h"
#include "mutt.h"
#include "message.h"
#include "bcache.h"
-#include "body.h"
#include "context.h"
#include "globals.h"
#include "header.h"
#include "conn/conn.h"
#include "mutt.h"
#include "alias.h"
-#include "body.h"
#include "buffy.h"
#include "globals.h"
#include "header.h"
#include <utime.h>
#include "mutt/mutt.h"
#include "mutt.h"
-#include "body.h"
#include "buffy.h"
#include "context.h"
#include "copy.h"
return 0;
}
-/**
- * strict_cmp_bodies - Strictly compare two email Body's
- * @param b1 First Body
- * @param b2 Second Body
- * @retval true Body's are strictly identical
- */
-static bool strict_cmp_bodies(const struct Body *b1, const struct Body *b2)
-{
- if ((b1->type != b2->type) || (b1->encoding != b2->encoding) ||
- (mutt_str_strcmp(b1->subtype, b2->subtype) != 0) ||
- (mutt_str_strcmp(b1->description, b2->description) != 0) ||
- !mutt_param_cmp_strict(&b1->parameter, &b2->parameter) || (b1->length != b2->length))
- {
- return false;
- }
- return true;
-}
-
/**
* mbox_strict_cmp_headers - Strictly compare message headers
* @param h1 First Header
(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) ||
- !strict_cmp_bodies(h1->content, h2->content))
+ !mutt_body_cmp_strict(h1->content, h2->content))
{
return false;
}
#include <utime.h>
#include "mutt/mutt.h"
#include "mutt.h"
-#include "body.h"
#include "buffy.h"
#include "context.h"
#include "copy.h"
--- /dev/null
+/**
+ * @file
+ * Representation of the body of an email
+ *
+ * @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/>.
+ */
+
+/**
+ * @page body Representation of the body of an email
+ *
+ * Representation of the body of an email
+ */
+
+#include "config.h"
+#include <limits.h>
+#include <string.h>
+#include <unistd.h>
+#include "body.h"
+#include "header.h"
+#include "logging.h"
+#include "memory.h"
+#include "mime.h"
+#include "string2.h"
+
+/**
+ * mutt_body_new - Create a new Body
+ * @retval ptr Newly allocated Body
+ */
+struct Body *mutt_body_new(void)
+{
+ struct Body *p = mutt_mem_calloc(1, sizeof(struct Body));
+
+ p->disposition = DISPATTACH;
+ p->use_disp = true;
+ TAILQ_INIT(&p->parameter);
+ return p;
+}
+
+/**
+ * mutt_body_free - Free a Body
+ * @param p Body to free
+ */
+void mutt_body_free(struct Body **p)
+{
+ struct Body *a = *p, *b = NULL;
+
+ while (a)
+ {
+ b = a;
+ a = a->next;
+
+ mutt_param_free(&b->parameter);
+ if (b->filename)
+ {
+ if (b->unlink)
+ unlink(b->filename);
+ mutt_debug(1, "%sunlinking %s.\n", b->unlink ? "" : "not ", b->filename);
+ }
+
+ FREE(&b->filename);
+ FREE(&b->d_filename);
+ FREE(&b->charset);
+ FREE(&b->content);
+ FREE(&b->xtype);
+ FREE(&b->subtype);
+ FREE(&b->description);
+ FREE(&b->form_name);
+
+ if (b->hdr)
+ {
+ /* Don't free twice (b->hdr->content = b->parts) */
+ b->hdr->content = NULL;
+ mutt_header_free(&b->hdr);
+ }
+
+ if (b->parts)
+ mutt_body_free(&b->parts);
+
+ FREE(&b);
+ }
+
+ *p = 0;
+}
+
+/**
+ * mutt_body_cmp_strict - Strictly compare two email Body's
+ * @param b1 First Body
+ * @param b2 Second Body
+ * @retval true Body's are strictly identical
+ */
+bool mutt_body_cmp_strict(const struct Body *b1, const struct Body *b2)
+{
+ if ((b1->type != b2->type) || (b1->encoding != b2->encoding) ||
+ (mutt_str_strcmp(b1->subtype, b2->subtype) != 0) ||
+ (mutt_str_strcmp(b1->description, b2->description) != 0) ||
+ !mutt_param_cmp_strict(&b1->parameter, &b2->parameter) || (b1->length != b2->length))
+ {
+ return false;
+ }
+ return true;
+}
#include <stdbool.h>
#include <stdio.h>
#include <time.h>
-#include "mutt/mutt.h"
+#include "parameter.h"
/**
* struct Body - The body of an email
};
-int mutt_body_copy(FILE *fp, struct Body **tgt, struct Body *src);
+bool mutt_body_cmp_strict(const struct Body *b1, const struct Body *b2);
void mutt_body_free(struct Body **p);
struct Body *mutt_body_new(void);
--- /dev/null
+/**
+ * @file
+ * Representation of the email's header
+ *
+ * @authors
+ * Copyright (C) 1996-2009,2012 Michael R. Elkins <me@mutt.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/>.
+ */
+
+/**
+ * @page header Representation of the email's header
+ *
+ * Representation of the email's header
+ */
+
+#include "config.h"
+#include <limits.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <time.h>
+#include "header.h"
+#include "body.h"
+#include "envelope.h"
+#include "file.h"
+#include "hash.h"
+#include "logging.h"
+#include "memory.h"
+#include "string2.h"
+
+/**
+ * mutt_header_free - Free an email Header
+ * @param h Header to free
+ */
+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);
+}
+
+/**
+ * mutt_header_new - Create a new email Header
+ * @retval ptr Newly created Header
+ */
+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;
+}
+
+/**
+ * mutt_header_cmp_strict - Strictly compare message headers
+ * @param h1 First Header
+ * @param h2 Second Header
+ * @retval true Headers are strictly identical
+ */
+bool mutt_header_cmp_strict(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;
+ }
+}
* | :--------------- | :----------------- |
* | mutt/address.c | @subpage address |
* | mutt/base64.c | @subpage base64 |
+ * | mutt/body.c | @subpage base64 |
* | mutt/buffer.c | @subpage buffer |
* | mutt/charset.c | @subpage charset |
* | mutt/date.c | @subpage date |
#include "address.h"
#include "base64.h"
+#include "body.h"
#include "buffer.h"
#include "charset.h"
#include "content.h"
#include <limits.h>
#include <string.h>
#include <unistd.h>
-#include "mutt/mutt.h"
-#include "body.h"
-#include "header.h"
#include "protos.h"
-/**
- * mutt_body_new - Create a new Body
- * @retval ptr Newly allocated Body
- */
-struct Body *mutt_body_new(void)
-{
- struct Body *p = mutt_mem_calloc(1, sizeof(struct Body));
-
- p->disposition = DISPATTACH;
- p->use_disp = true;
- TAILQ_INIT(&p->parameter);
- return p;
-}
-
/**
* mutt_body_copy - Create a send-mode duplicate from a receive-mode body
* @param[in] fp FILE pointer to attachments
return 0;
}
-
-/**
- * mutt_body_free - Free a Body
- * @param p Body to free
- */
-void mutt_body_free(struct Body **p)
-{
- struct Body *a = *p, *b = NULL;
-
- while (a)
- {
- b = a;
- a = a->next;
-
- mutt_param_free(&b->parameter);
- if (b->filename)
- {
- if (b->unlink)
- unlink(b->filename);
- mutt_debug(1, "%sunlinking %s.\n", b->unlink ? "" : "not ", b->filename);
- }
-
- FREE(&b->filename);
- FREE(&b->d_filename);
- FREE(&b->charset);
- FREE(&b->content);
- FREE(&b->xtype);
- FREE(&b->subtype);
- FREE(&b->description);
- FREE(&b->form_name);
-
- if (b->hdr)
- {
- /* Don't free twice (b->hdr->content = b->parts) */
- b->hdr->content = NULL;
- mutt_header_free(&b->hdr);
- }
-
- if (b->parts)
- mutt_body_free(&b->parts);
-
- FREE(&b);
- }
-
- *p = 0;
-}
--- /dev/null
+/**
+ * @file
+ * Representation of the body of an email
+ *
+ * @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_BODY2_H
+#define _MUTT_BODY2_H
+
+#include <stdio.h>
+
+struct Body;
+
+int mutt_body_copy(FILE *fp, struct Body **tgt, struct Body *src);
+
+#endif /* _MUTT_BODY2_H */
#include "mutt/mutt.h"
#include "mutt.h"
#include "mutt_notmuch.h"
-#include "body.h"
#include "buffy.h"
#include "context.h"
#include "globals.h"
#include "mutt/mutt.h"
#include "mutt.h"
#include "alias.h"
-#include "body.h"
#include "filter.h"
#include "format_flags.h"
#include "globals.h"
#include "mutt/mutt.h"
#include "mutt.h"
#include "mx.h"
-#include "body.h"
#include "buffy.h"
#include "context.h"
#include "copy.h"
#include "mutt/mutt.h"
#include "mutt.h"
#include "alias.h"
-#include "body.h"
#include "context.h"
#include "copy.h"
#include "cryptglue.h"
#include "mutt/mutt.h"
#include "mutt.h"
#include "alias.h"
-#include "body.h"
#include "crypt.h"
#include "format_flags.h"
#include "globals.h"
#include "mutt/mutt.h"
#include "mutt.h"
#include "pgp.h"
-#include "body.h"
#include "crypt.h"
#include "cryptglue.h"
#include "filter.h"
#include "mutt/mutt.h"
#include "mutt.h"
#include "pgpkey.h"
-#include "body.h"
#include "crypt.h"
#include "filter.h"
#include "format_flags.h"
#include "mutt.h"
#include "smime.h"
#include "alias.h"
-#include "body.h"
#include "copy.h"
#include "crypt.h"
#include "cryptglue.h"
#include "mutt.h"
#include "nntp.h"
#include "bcache.h"
-#include "body.h"
#include "context.h"
#include "globals.h"
#include "header.h"
#include "pager.h"
#include "alias.h"
#include "attach.h"
-#include "body.h"
#include "context.h"
#include "format_flags.h"
#include "globals.h"
#include <time.h>
#include "mutt/mutt.h"
#include "mutt.h"
-#include "body.h"
#include "globals.h"
#include "header.h"
#include "mailbox.h"
#include "conn/conn.h"
#include "mutt.h"
#include "pattern.h"
-#include "body.h"
#include "context.h"
#include "copy.h"
#include "globals.h"
alias.c
attach.c
bcache.c
-body.c
browser.c
buffy.c
color.c
mh.c
mutt/address.c
mutt/base64.c
+mutt/body.c
mutt/buffer.c
mutt/charset.c
mutt/date.c
mutt/signal.c
mutt/string.c
mutt_account.c
+mutt_body.c
mutt_logging.c
mutt_lua.c
mutt_notmuch.c
#include "mutt.h"
#include "pop.h"
#include "bcache.h"
-#include "body.h"
#include "context.h"
#include "globals.h"
#include "header.h"
#include "mutt/mutt.h"
#include "conn/conn.h"
#include "mutt.h"
-#include "body.h"
#include "context.h"
#include "format_flags.h"
#include "globals.h"
#include "mutt/mutt.h"
#include "mutt.h"
#include "attach.h"
-#include "body.h"
#include "context.h"
#include "filter.h"
#include "format_flags.h"
#include "mutt.h"
#include "alias.h"
#include "attach.h"
-#include "body.h"
#include "copy.h"
#include "globals.h"
#include "handler.h"
#include "header.h"
+#include "mutt_body.h"
#include "mutt_curses.h"
#include "mutt_window.h"
#include "options.h"
#include "mutt/mutt.h"
#include "mutt.h"
#include "rfc1524.h"
-#include "body.h"
#include "globals.h"
#include "options.h"
#include "protos.h"
#include <string.h>
#include <unistd.h>
#include "mutt/mutt.h"
-#include "body.h"
#include "globals.h"
#include "header.h"
#include "mutt_curses.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
+#include "config.h"
#include "mutt/mutt.h"
#ifdef HAVE_VASPRINTF
#include "mutt/mutt.h"
#include "mutt.h"
#include "alias.h"
-#include "body.h"
#include "context.h"
#include "copy.h"
#include "filter.h"
#include <unistd.h>
#include "mutt/mutt.h"
#include "mutt.h"
-#include "body.h"
#include "buffy.h"
#include "context.h"
#include "copy.h"
#include <string.h>
#include "mutt/mutt.h"
#include "sort.h"
-#include "body.h"
#include "context.h"
#include "globals.h"
#include "header.h"
#include "mutt/mutt.h"
#include "mutt.h"
#include "thread.h"
-#include "body.h"
#include "context.h"
#include "globals.h"
#include "header.h"