From: Richard Russon Date: Wed, 12 Sep 2018 20:05:46 +0000 (+0100) Subject: rename Header to Email X-Git-Tag: 2019-10-25~648^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d2a96bf66488aead86185f02ae4b0feba671c067;p=neomutt rename Header to Email --- diff --git a/Makefile.autosetup b/Makefile.autosetup index 44cd14753..697134f1c 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -238,7 +238,7 @@ ALLOBJS+= $(LIBCONFIGOBJS) LIBEMAIL= libemail.a LIBEMAILOBJS= email/address.o email/attach.o email/body.o \ email/email_globals.o email/envelope.o email/from.o \ - email/header.o email/idna.o email/mime.o email/parameter.o \ + email/email.o email/idna.o email/mime.o email/parameter.o \ email/parse.o email/rfc2047.o email/rfc2231.o email/tags.o \ email/thread.o email/url.o CLEANFILES+= $(LIBEMAIL) $(LIBEMAILOBJS) @@ -377,8 +377,8 @@ git_ver.h: $(ALL_FILES) hcache/hcversion.h: $(SRCDIR)/email/address.h \ $(SRCDIR)/email/body.h \ + $(SRCDIR)/email/email.h \ $(SRCDIR)/email/envelope.h \ - $(SRCDIR)/email/header.h \ $(SRCDIR)/email/parameter.h \ $(SRCDIR)/mutt/buffer.h \ $(SRCDIR)/mutt/list.h \ @@ -387,8 +387,8 @@ hcache/hcversion.h: $(SRCDIR)/email/address.h \ ( echo '#include "config.h"'; \ echo '#include "email/address.h"'; \ echo '#include "email/body.h"'; \ + echo '#include "email/email.h"'; \ echo '#include "email/envelope.h"'; \ - echo '#include "email/header.h"'; \ echo '#include "email/parameter.h"'; \ echo '#include "mutt/buffer.h"'; \ echo '#include "mutt/list.h"';) | $(CPP) $(CFLAGS) - | \ diff --git a/commands.c b/commands.c index f6580a172..ea7418b8c 100644 --- a/commands.c +++ b/commands.c @@ -89,7 +89,7 @@ static char LastSaveFolder[PATH_MAX] = ""; * @retval 0 Success * @retval -1 Error */ -int mutt_display_message(struct Header *cur) +int mutt_display_message(struct Email *cur) { char tempfile[PATH_MAX], buf[LONG_STRING]; int rc = 0; @@ -279,7 +279,7 @@ int mutt_display_message(struct Header *cur) * ci_bounce_message - Bounce an email * @param h Header of email to bounce */ -void ci_bounce_message(struct Header *h) +void ci_bounce_message(struct Email *h) { char prompt[SHORT_STRING]; char scratch[SHORT_STRING]; @@ -409,7 +409,7 @@ static void pipe_set_flags(bool decode, bool print, int *cmflags, int *chflags) * @param decode If true, decode the message * @param print If true, message is for printing */ -static void pipe_msg(struct Header *h, FILE *fp, bool decode, bool print) +static void pipe_msg(struct Email *h, FILE *fp, bool decode, bool print) { int cmflags = 0; int chflags = CH_FROM; @@ -442,7 +442,7 @@ static void pipe_msg(struct Header *h, FILE *fp, bool decode, bool print) * * The following code is shared between printing and piping. */ -static int pipe_message(struct Header *h, char *cmd, bool decode, bool print, +static int pipe_message(struct Email *h, char *cmd, bool decode, bool print, bool split, const char *sep) { int rc = 0; @@ -557,7 +557,7 @@ static int pipe_message(struct Header *h, char *cmd, bool decode, bool print, * mutt_pipe_message - Pipe a message * @param h Header of message to pipe */ -void mutt_pipe_message(struct Header *h) +void mutt_pipe_message(struct Email *h) { char buffer[LONG_STRING]; @@ -576,7 +576,7 @@ void mutt_pipe_message(struct Header *h) * mutt_print_message - Print a message * @param h Header of message to print */ -void mutt_print_message(struct Header *h) +void mutt_print_message(struct Email *h) { int i; int msgcount; // for L10N with ngettext @@ -781,7 +781,7 @@ void mutt_display_address(struct Envelope *env) * @param[out] cmflags Copy message flags, e.g. MUTT_CM_DECODE * @param[out] chflags Copy header flags, e.g. CH_DECODE */ -static void set_copy_flags(struct Header *hdr, bool decode, bool decrypt, +static void set_copy_flags(struct Email *hdr, bool decode, bool decrypt, int *cmflags, int *chflags) { *cmflags = 0; @@ -835,7 +835,7 @@ static void set_copy_flags(struct Header *hdr, bool decode, bool decrypt, * @retval 0 Success * @retval -1 Error */ -int mutt_save_message_ctx(struct Header *h, bool delete, bool decode, +int mutt_save_message_ctx(struct Email *h, bool delete, bool decode, bool decrypt, struct Context *ctx) { int cmflags, chflags; @@ -870,7 +870,7 @@ int mutt_save_message_ctx(struct Header *h, bool delete, bool decode, * @retval 0 Copy/save was successful * @retval -1 Error/abort */ -int mutt_save_message(struct Header *h, bool delete, bool decode, bool decrypt) +int mutt_save_message(struct Email *h, bool delete, bool decode, bool decrypt) { bool need_passphrase = false; int app = 0; @@ -1040,7 +1040,7 @@ int mutt_save_message(struct Header *h, bool delete, bool decode, bool decrypt) #ifdef USE_COMPRESSED if (cm) { - struct Header *h2 = Context->mailbox->hdrs[i]; + struct Email *h2 = Context->mailbox->hdrs[i]; cm->msg_count++; if (!h2->read) cm->msg_unread++; @@ -1085,7 +1085,7 @@ int mutt_save_message(struct Header *h, bool delete, bool decode, bool decrypt) * * recvattach requires the return code to know when to regenerate the actx. */ -int mutt_edit_content_type(struct Header *h, struct Body *b, FILE *fp) +int mutt_edit_content_type(struct Email *h, struct Body *b, FILE *fp) { char buf[LONG_STRING]; char obuf[LONG_STRING]; @@ -1163,7 +1163,7 @@ int mutt_edit_content_type(struct Header *h, struct Body *b, FILE *fp) { structure_changed = 1; b->hdr->content = NULL; - mutt_header_free(&b->hdr); + mutt_email_free(&b->hdr); } if (fp && !b->parts && (is_multipart(b) || mutt_is_message_type(b->type, b->subtype))) @@ -1189,7 +1189,7 @@ int mutt_edit_content_type(struct Header *h, struct Body *b, FILE *fp) * @param[out] redraw Set of #REDRAW_FULL if the screen may need redrawing * @retval true If message contains inline PGP content */ -static bool check_traditional_pgp(struct Header *h, int *redraw) +static bool check_traditional_pgp(struct Email *h, int *redraw) { bool rc = false; @@ -1217,7 +1217,7 @@ static bool check_traditional_pgp(struct Header *h, int *redraw) * @param[out] redraw Set of #REDRAW_FULL if the screen may need redrawing * @retval true If message contains inline PGP content */ -bool mutt_check_traditional_pgp(struct Header *h, int *redraw) +bool mutt_check_traditional_pgp(struct Email *h, int *redraw) { bool rc = false; if (h && !(h->security & PGP_TRADITIONAL_CHECKED)) diff --git a/commands.h b/commands.h index d1018949b..2f701eee6 100644 --- a/commands.h +++ b/commands.h @@ -29,7 +29,7 @@ struct Body; struct Context; struct Envelope; -struct Header; +struct Email; /* These Config Variables are only used in commands.c */ extern unsigned char CryptVerifySig; /* verify PGP signatures */ @@ -41,17 +41,17 @@ extern bool PrintDecode; extern bool PrintSplit; extern bool PromptAfter; -void ci_bounce_message(struct Header *h); +void ci_bounce_message(struct Email *h); void mutt_check_stats(void); -bool mutt_check_traditional_pgp(struct Header *h, int *redraw); +bool mutt_check_traditional_pgp(struct Email *h, int *redraw); void mutt_display_address(struct Envelope *env); -int mutt_display_message(struct Header *cur); -int mutt_edit_content_type(struct Header *h, struct Body *b, FILE *fp); +int mutt_display_message(struct Email *cur); +int mutt_edit_content_type(struct Email *h, struct Body *b, FILE *fp); void mutt_enter_command(void); -void mutt_pipe_message(struct Header *h); -void mutt_print_message(struct Header *h); -int mutt_save_message_ctx(struct Header *h, bool delete, bool decode, bool decrypt, struct Context *ctx); -int mutt_save_message(struct Header *h, bool delete, bool decode, bool decrypt); +void mutt_pipe_message(struct Email *h); +void mutt_print_message(struct Email *h); +int mutt_save_message_ctx(struct Email *h, bool delete, bool decode, bool decrypt, struct Context *ctx); +int mutt_save_message(struct Email *h, bool delete, bool decode, bool decrypt); int mutt_select_sort(int reverse); void mutt_shell_escape(void); diff --git a/compose.c b/compose.c index f4349a652..012991630 100644 --- a/compose.c +++ b/compose.c @@ -267,7 +267,7 @@ static void snd_entry(char *buf, size_t buflen, struct Menu *menu, int num) * redraw_crypt_lines - Update the encryption info in the compose window * @param msg Header of message */ -static void redraw_crypt_lines(struct Header *msg) +static void redraw_crypt_lines(struct Email *msg) { SETCOLOR(MT_COLOR_COMPOSE_HEADER); mutt_window_mvprintw(MuttIndexWindow, HDR_CRYPT, 0, "%*s", @@ -455,7 +455,7 @@ static void draw_envelope_addr(int line, struct Address *addr) * @param msg Header of the message * @param fcc Fcc field */ -static void draw_envelope(struct Header *msg, char *fcc) +static void draw_envelope(struct Email *msg, char *fcc) { draw_envelope_addr(HDR_FROM, msg->env->from); #ifdef USE_NNTP @@ -670,7 +670,7 @@ static void update_idx(struct Menu *menu, struct AttachCtx *actx, struct AttachP */ struct ComposeRedrawData { - struct Header *msg; + struct Email *msg; char *fcc; }; @@ -887,8 +887,7 @@ static void compose_status_line(char *buf, size_t buflen, size_t col, int cols, * @retval 0 Normal exit * @retval -1 Abort message */ -int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen, - struct Header *cur, int flags) +int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email *cur, int flags) { char helpstr[LONG_STRING]; char buf[LONG_STRING]; diff --git a/compose.h b/compose.h index af96dc3e5..866d83f65 100644 --- a/compose.h +++ b/compose.h @@ -25,7 +25,7 @@ #include -struct Header; +struct Email; /* These Config Variables are only used in compose.c */ extern char * ComposeFormat; @@ -35,6 +35,6 @@ extern unsigned char Postpone; /* flags for mutt_compose_menu() */ #define MUTT_COMPOSE_NOFREEHEADER (1 << 0) -int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen, struct Header *cur, int flags); +int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email *cur, int flags); #endif /* MUTT_COMPOSE_H */ diff --git a/compress.c b/compress.c index f8bff32ad..ed51ce118 100644 --- a/compress.c +++ b/compress.c @@ -48,7 +48,7 @@ #include "mx.h" #include "protos.h" -struct Header; +struct Email; /* Notes: * Any references to compressed files also apply to encrypted files. @@ -837,7 +837,7 @@ static int comp_msg_open(struct Context *ctx, struct Message *msg, int msgno) /** * comp_msg_open_new - Implements MxOps::msg_open_new() */ -static int comp_msg_open_new(struct Context *ctx, struct Message *msg, struct Header *hdr) +static int comp_msg_open_new(struct Context *ctx, struct Message *msg, struct Email *hdr) { if (!ctx) return -1; @@ -937,7 +937,7 @@ static int comp_tags_edit(struct Context *ctx, const char *tags, char *buf, size /** * comp_tags_commit - Implements MxOps::tags_commit() */ -static int comp_tags_commit(struct Context *ctx, struct Header *hdr, char *buf) +static int comp_tags_commit(struct Context *ctx, struct Email *hdr, char *buf) { if (!ctx) return 0; diff --git a/context.h b/context.h index 4f81fe1cd..f4525ca85 100644 --- a/context.h +++ b/context.h @@ -36,7 +36,7 @@ struct Context off_t vsize; char *pattern; /**< limit pattern string */ struct Pattern *limit_pattern; /**< compiled limit pattern */ - struct Header *last_tag; /**< last tagged msg. used to link threads */ + struct Email *last_tag; /**< last tagged msg. used to link threads */ struct MuttThread *tree; /**< top of thread tree */ struct Hash *thread_hash; /**< hash table for threading */ int tagged; /**< how many messages are tagged? */ diff --git a/copy.c b/copy.c index 4d30d1cea..21eb6361a 100644 --- a/copy.c +++ b/copy.c @@ -399,7 +399,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, * prefix * * string to use if CH_PREFIX is set */ -int mutt_copy_header(FILE *in, struct Header *h, FILE *out, int flags, const char *prefix) +int mutt_copy_header(FILE *in, struct Email *h, FILE *out, int flags, const char *prefix) { if (h->env) { @@ -577,7 +577,7 @@ static int count_delete_lines(FILE *fp, struct Body *b, LOFF_T *length, size_t d * * #MUTT_CM_DECODE_PGP used for decoding PGP messages * * #MUTT_CM_CHARCONV perform character set conversion */ -int mutt_copy_message_fp(FILE *fpout, FILE *fpin, struct Header *hdr, int flags, int chflags) +int mutt_copy_message_fp(FILE *fpout, FILE *fpin, struct Email *hdr, int flags, int chflags) { struct Body *body = hdr->content; char prefix[SHORT_STRING]; @@ -786,7 +786,7 @@ int mutt_copy_message_fp(FILE *fpout, FILE *fpin, struct Header *hdr, int flags, * should be made to return -1 on fatal errors, and 1 on non-fatal errors * like partial decode, where it is worth displaying as much as possible */ -int mutt_copy_message_ctx(FILE *fpout, struct Context *src, struct Header *hdr, +int mutt_copy_message_ctx(FILE *fpout, struct Context *src, struct Email *hdr, int flags, int chflags) { struct Message *msg = mx_msg_open(src, hdr->msgno); @@ -816,7 +816,7 @@ int mutt_copy_message_ctx(FILE *fpout, struct Context *src, struct Header *hdr, * @retval -1 Error */ static int append_message(struct Context *dest, FILE *fpin, struct Context *src, - struct Header *hdr, int flags, int chflags) + struct Email *hdr, int flags, int chflags) { char buf[STRING]; struct Message *msg = NULL; @@ -858,7 +858,7 @@ static int append_message(struct Context *dest, FILE *fpin, struct Context *src, * @retval -1 Failure */ int mutt_append_message(struct Context *dest, struct Context *src, - struct Header *hdr, int cmflags, int chflags) + struct Email *hdr, int cmflags, int chflags) { struct Message *msg = mx_msg_open(src, hdr->msgno); if (!msg) diff --git a/copy.h b/copy.h index 4f52bab82..38f939a0f 100644 --- a/copy.h +++ b/copy.h @@ -25,7 +25,7 @@ #include -struct Header; +struct Email; struct Context; /**< flags to mutt_copy_message */ @@ -69,11 +69,11 @@ struct Context; int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, const char *prefix); -int mutt_copy_header(FILE *in, struct Header *h, FILE *out, int flags, const char *prefix); +int mutt_copy_header(FILE *in, struct Email *h, FILE *out, int flags, const char *prefix); -int mutt_copy_message_fp (FILE *fpout, FILE *fpin, struct Header *hdr, int flags, int chflags); -int mutt_copy_message_ctx(FILE *fpout, struct Context *src, struct Header *hdr, int flags, int chflags); +int mutt_copy_message_fp (FILE *fpout, FILE *fpin, struct Email *hdr, int flags, int chflags); +int mutt_copy_message_ctx(FILE *fpout, struct Context *src, struct Email *hdr, int flags, int chflags); -int mutt_append_message(struct Context *dest, struct Context *src, struct Header *hdr, int cmflags, int chflags); +int mutt_append_message(struct Context *dest, struct Context *src, struct Email *hdr, int cmflags, int chflags); #endif /* MUTT_COPY_H */ diff --git a/curs_main.c b/curs_main.c index ee3b5dad8..1d73a7dc5 100644 --- a/curs_main.c +++ b/curs_main.c @@ -181,7 +181,7 @@ static const char *NoVisible = N_("No visible messages"); */ static void collapse_all(struct Menu *menu, int toggle) { - struct Header *h = NULL, *base = NULL; + struct Email *h = NULL, *base = NULL; struct MuttThread *thread = NULL, *top = NULL; int final; @@ -343,7 +343,7 @@ static int mx_toggle_write(struct Context *ctx) */ static void resort_index(struct Menu *menu) { - struct Header *current = CURHDR; + struct Email *current = CURHDR; menu->current = -1; mutt_sort_headers(Context, false); @@ -375,12 +375,12 @@ static void resort_index(struct Menu *menu) */ static void update_index_threaded(struct Context *ctx, int check, int oldcount) { - struct Header **save_new = NULL; + struct Email **save_new = NULL; /* save the list of new messages */ if ((check != MUTT_REOPENED) && oldcount && (ctx->pattern || UncollapseNew)) { - save_new = mutt_mem_malloc(sizeof(struct Header *) * (ctx->mailbox->msg_count - oldcount)); + save_new = mutt_mem_malloc(sizeof(struct Email *) * (ctx->mailbox->msg_count - oldcount)); for (int i = oldcount; i < ctx->mailbox->msg_count; i++) save_new[i - oldcount] = ctx->mailbox->hdrs[i]; } @@ -395,7 +395,7 @@ static void update_index_threaded(struct Context *ctx, int check, int oldcount) { for (int i = (check == MUTT_REOPENED) ? 0 : oldcount; i < ctx->mailbox->msg_count; i++) { - struct Header *h = NULL; + struct Email *h = NULL; if ((check != MUTT_REOPENED) && oldcount) h = save_new[i - oldcount]; @@ -652,7 +652,7 @@ void index_make_entry(char *buf, size_t buflen, struct Menu *menu, int num) if (!Context || !menu || (num < 0) || (num >= Context->mailbox->hdrmax)) return; - struct Header *h = Context->mailbox->hdrs[Context->mailbox->v2r[num]]; + struct Email *h = Context->mailbox->hdrs[Context->mailbox->v2r[num]]; if (!h) return; @@ -727,7 +727,7 @@ int index_color(int index_no) if (!Context || (index_no < 0)) return 0; - struct Header *h = Context->mailbox->hdrs[Context->mailbox->v2r[index_no]]; + struct Email *h = Context->mailbox->hdrs[Context->mailbox->v2r[index_no]]; if (h && h->pair) return h->pair; @@ -1310,7 +1310,7 @@ int mutt_index_menu(void) CHECK_ATTACH; if (Context->mailbox->magic == MUTT_NNTP) { - struct Header *hdr = NULL; + struct Email *hdr = NULL; if (op == OP_GET_MESSAGE) { @@ -1419,8 +1419,8 @@ int mutt_index_menu(void) /* at least one message has been loaded */ if (Context->mailbox->msg_count > oldmsgcount) { - struct Header *oldcur = CURHDR; - struct Header *hdr = NULL; + struct Email *oldcur = CURHDR; + struct Email *hdr = NULL; bool quiet = Context->mailbox->quiet; if (rc2 < 0) @@ -1495,7 +1495,7 @@ int mutt_index_menu(void) mutt_error(_("That message is not visible")); else { - struct Header *hdr = Context->mailbox->hdrs[i - 1]; + struct Email *hdr = Context->mailbox->hdrs[i - 1]; if (mutt_messages_in_thread(Context, hdr, 1) != 1) { @@ -1845,7 +1845,7 @@ int mutt_index_menu(void) int ovc = Context->mailbox->vcount; int oc = Context->mailbox->msg_count; int check; - struct Header *newhdr = NULL; + struct Email *newhdr = NULL; /* don't attempt to move the cursor if there are no visible messages in the current limit */ if (menu->current < Context->mailbox->vcount) @@ -1939,7 +1939,7 @@ int mutt_index_menu(void) } if (oc < Context->mailbox->msg_count) { - struct Header *oldcur = CURHDR; + struct Email *oldcur = CURHDR; if ((Sort & SORT_MASK) == SORT_THREADS) mutt_sort_headers(Context, false); @@ -2343,7 +2343,7 @@ int mutt_index_menu(void) !STAILQ_EMPTY(&CURHDR->env->references)) { { - struct Header *oldcur = CURHDR; + struct Email *oldcur = CURHDR; mutt_break_thread(CURHDR); mutt_sort_headers(Context, true); @@ -2385,7 +2385,7 @@ int mutt_index_menu(void) mutt_error(_("First, please tag a message to be linked here")); else { - struct Header *oldcur = CURHDR; + struct Email *oldcur = CURHDR; if (mutt_link_threads(CURHDR, tag ? NULL : Context->last_tag, Context)) { @@ -2588,7 +2588,7 @@ int mutt_index_menu(void) } } - struct Header *h = Context->mailbox->hdrs[Context->mailbox->v2r[i]]; + struct Email *h = Context->mailbox->hdrs[Context->mailbox->v2r[i]]; if (h->collapsed && (Sort & SORT_MASK) == SORT_THREADS) { if (UNREAD(h) && first_unread == -1) @@ -3519,7 +3519,7 @@ int mutt_index_menu(void) * @param ctx Mailbox * @param curhdr Header of message */ -void mutt_set_header_color(struct Context *ctx, struct Header *curhdr) +void mutt_set_header_color(struct Context *ctx, struct Email *curhdr) { struct ColorLine *color = NULL; struct PatternCache cache = { 0 }; diff --git a/curs_main.h b/curs_main.h index 839ccb630..e47d423ca 100644 --- a/curs_main.h +++ b/curs_main.h @@ -27,7 +27,7 @@ #include struct Context; -struct Header; +struct Email; struct Menu; /* These Config Variables are only used in curs_main.c */ @@ -44,7 +44,7 @@ int index_color(int index_no); void index_make_entry(char *buf, size_t buflen, struct Menu *menu, int num); void mutt_draw_statusline(int cols, const char *buf, size_t buflen); int mutt_index_menu(void); -void mutt_set_header_color(struct Context *ctx, struct Header *curhdr); +void mutt_set_header_color(struct Context *ctx, struct Email *curhdr); void update_index(struct Menu *menu, struct Context *ctx, int check, int oldcount, int index_hint); #endif /* MUTT_CURS_MAIN_H */ diff --git a/edit.c b/edit.c index 0ace0b78b..3c0d7c147 100644 --- a/edit.c +++ b/edit.c @@ -388,7 +388,7 @@ static void be_edit_header(struct Envelope *e, bool force) * @retval 0 Success * @retval -1 Error */ -int mutt_builtin_editor(const char *path, struct Header *msg, struct Header *cur) +int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur) { char **buf = NULL; int bufmax = 0, buflen = 0; diff --git a/edit.h b/edit.h index 934386095..72afa4214 100644 --- a/edit.h +++ b/edit.h @@ -23,11 +23,11 @@ #ifndef MUTT_EDIT_H #define MUTT_EDIT_H -struct Header; +struct Email; /* These Config Variables are only used in edit.c */ extern char *Escape; -int mutt_builtin_editor(const char *path, struct Header *msg, struct Header *cur); +int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur); #endif /* MUTT_EDIT_H */ diff --git a/editmsg.c b/editmsg.c index 6752092bf..c7efa48b0 100644 --- a/editmsg.c +++ b/editmsg.c @@ -58,7 +58,7 @@ * @retval 0 Message edited successfully * @retval -1 Error */ -static int edit_or_view_one_message(bool edit, struct Context *ctx, struct Header *cur) +static int edit_or_view_one_message(bool edit, struct Context *ctx, struct Email *cur) { char tmp[PATH_MAX]; char buf[STRING]; @@ -270,7 +270,7 @@ bail: * @retval 0 Message edited successfully * @retval -1 Error */ -int edit_or_view_message(bool edit, struct Context *ctx, struct Header *hdr) +int edit_or_view_message(bool edit, struct Context *ctx, struct Email *hdr) { if (hdr) return edit_or_view_one_message(edit, ctx, hdr); @@ -295,7 +295,7 @@ int edit_or_view_message(bool edit, struct Context *ctx, struct Header *hdr) * @retval 0 Message edited successfully * @retval -1 Error */ -int mutt_edit_message(struct Context *ctx, struct Header *hdr) +int mutt_edit_message(struct Context *ctx, struct Email *hdr) { return edit_or_view_message(true, ctx, hdr); /* true means edit */ } @@ -308,7 +308,7 @@ int mutt_edit_message(struct Context *ctx, struct Header *hdr) * @retval 0 Message edited successfully * @retval -1 Error */ -int mutt_view_message(struct Context *ctx, struct Header *hdr) +int mutt_view_message(struct Context *ctx, struct Email *hdr) { return edit_or_view_message(false, ctx, hdr); /* false means only view */ } diff --git a/email/attach.h b/email/attach.h index 2e2e99c36..84150815f 100644 --- a/email/attach.h +++ b/email/attach.h @@ -48,7 +48,7 @@ struct AttachPtr */ struct AttachCtx { - struct Header *hdr; /**< used by recvattach for updating */ + struct Email *hdr; /**< used by recvattach for updating */ FILE *root_fp; /**< used by recvattach for updating */ struct AttachPtr **idx; diff --git a/email/body.c b/email/body.c index a37b67a87..de0320efd 100644 --- a/email/body.c +++ b/email/body.c @@ -31,7 +31,7 @@ #include #include "mutt/mutt.h" #include "body.h" -#include "header.h" +#include "email.h" #include "mime.h" #include "parameter.h" @@ -83,7 +83,7 @@ void mutt_body_free(struct Body **p) { /* Don't free twice (b->hdr->content = b->parts) */ b->hdr->content = NULL; - mutt_header_free(&b->hdr); + mutt_email_free(&b->hdr); } if (b->parts) diff --git a/email/body.h b/email/body.h index 9bfb7f2d0..af7b05545 100644 --- a/email/body.h +++ b/email/body.h @@ -56,7 +56,7 @@ struct Body * is required when sending mail. */ struct Body *next; /**< next attachment in the list */ struct Body *parts; /**< parts of a multipart or message/rfc822 */ - struct Header *hdr; /**< header information for message/rfc822 */ + struct Email *hdr; /**< header information for message/rfc822 */ struct AttachPtr *aptr; /**< Menu information, used in recvattach.c */ diff --git a/email/header.c b/email/email.c similarity index 73% rename from email/header.c rename to email/email.c index a90677d95..94dada99a 100644 --- a/email/header.c +++ b/email/email.c @@ -1,6 +1,6 @@ /** * @file - * Representation of the email's header + * Representation of an email * * @authors * Copyright (C) 1996-2009,2012 Michael R. Elkins @@ -21,24 +21,24 @@ */ /** - * @page email_header Representation of the email's header + * @page email_email Representation of an email * - * Representation of the email's header + * Representation of an email */ #include "config.h" #include #include "mutt/mutt.h" -#include "header.h" +#include "email.h" #include "body.h" #include "envelope.h" #include "tags.h" /** - * mutt_header_free - Free an email Header - * @param h Header to free + * mutt_email_free - Free an Email + * @param h Email to free */ -void mutt_header_free(struct Header **h) +void mutt_email_free(struct Email **h) { if (!h || !*h) return; @@ -58,12 +58,12 @@ void mutt_header_free(struct Header **h) } /** - * mutt_header_new - Create a new email Header - * @retval ptr Newly created Header + * mutt_email_new - Create a new Email + * @retval ptr Newly created Email */ -struct Header *mutt_header_new(void) +struct Email *mutt_email_new(void) { - struct Header *h = mutt_mem_calloc(1, sizeof(struct Header)); + struct Email *h = mutt_mem_calloc(1, sizeof(struct Email)); #ifdef MIXMASTER STAILQ_INIT(&h->chain); #endif @@ -72,12 +72,12 @@ struct Header *mutt_header_new(void) } /** - * mutt_header_cmp_strict - Strictly compare message headers - * @param h1 First Header - * @param h2 Second Header - * @retval true Headers are strictly identical + * mutt_email_cmp_strict - Strictly compare message emails + * @param h1 First Email + * @param h2 Second Email + * @retval true Emails are strictly identical */ -bool mutt_header_cmp_strict(const struct Header *h1, const struct Header *h2) +bool mutt_email_cmp_strict(const struct Email *h1, const struct Email *h2) { if (h1 && h2) { diff --git a/email/header.h b/email/email.h similarity index 86% rename from email/header.h rename to email/email.h index 5b9913f66..c4776b30b 100644 --- a/email/header.h +++ b/email/email.h @@ -1,6 +1,6 @@ /** * @file - * Representation of the email's header + * Representation of an email * * @authors * Copyright (C) 2017 Richard Russon @@ -20,8 +20,8 @@ * this program. If not, see . */ -#ifndef MUTT_EMAIL_HEADER_H -#define MUTT_EMAIL_HEADER_H +#ifndef MUTT_EMAIL_EMAIL_H +#define MUTT_EMAIL_EMAIL_H #include #include @@ -30,14 +30,14 @@ #include "tags.h" /** - * struct Header - The header/envelope of an email + * struct Email - The email/envelope of an email */ -struct Header +struct Email { unsigned int security : 12; /**< bit 0-8: flags, bit 9,10: application. see: mutt_crypt.h pgplib.h, smime.h */ - bool mime : 1; /**< has a MIME-Version header? */ + bool mime : 1; /**< has a MIME-Version email? */ bool flagged : 1; /**< marked important? */ bool tagged : 1; bool deleted : 1; @@ -108,14 +108,14 @@ struct Header struct TagHead tags; /**< for drivers that support server tagging */ - void *data; /**< driver-specific data */ - void (*free_cb)(struct Header *); /**< driver-specific data free function */ + void *data; /**< driver-specific data */ + void (*free_cb)(struct Email *); /**< driver-specific data free function */ 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 mutt_email_cmp_strict(const struct Email *h1, const struct Email *h2); +void mutt_email_free(struct Email **h); +struct Email *mutt_email_new(void); -#endif /* MUTT_EMAIL_HEADER_H */ +#endif /* MUTT_EMAIL_EMAIL_H */ diff --git a/email/lib.h b/email/lib.h index 03f17e377..ef1a20a8a 100644 --- a/email/lib.h +++ b/email/lib.h @@ -33,7 +33,7 @@ * | email/email_globals.c | @subpage email_globals | * | email/envelope.c | @subpage email_envelope | * | email/from.c | @subpage email_from | - * | email/header.c | @subpage email_header | + * | email/email.c | @subpage email_email | * | email/idna.c | @subpage email_idna | * | email/mime.c | @subpage email_mime | * | email/parameter.c | @subpage email_parameter | @@ -52,10 +52,10 @@ #include "attach.h" #include "body.h" #include "content.h" +#include "email.h" #include "email_globals.h" #include "envelope.h" #include "from.h" -#include "header.h" #include "idna2.h" #include "mime.h" #include "parameter.h" diff --git a/email/parse.c b/email/parse.c index 1f01dd9a7..2a8d21a86 100644 --- a/email/parse.c +++ b/email/parse.c @@ -37,10 +37,10 @@ #include "parse.h" #include "address.h" #include "body.h" +#include "email.h" #include "email_globals.h" #include "envelope.h" #include "from.h" -#include "header.h" #include "mime.h" #include "parameter.h" #include "rfc2047.h" @@ -495,7 +495,7 @@ void mutt_parse_content_type(char *s, struct Body *ct) * Process a line from an email header. Each line that is recognised is parsed * and the information put in the Envelope or Header. */ -int mutt_rfc822_parse_line(struct Envelope *e, struct Header *hdr, char *line, +int mutt_rfc822_parse_line(struct Envelope *e, struct Email *hdr, char *line, char *p, bool user_hdrs, bool weed, bool do_2047) { bool matched = false; @@ -960,7 +960,7 @@ char *mutt_rfc822_read_line(FILE *f, char *line, size_t *linelen) * * Caller should free the Envelope using mutt_env_free(). */ -struct Envelope *mutt_rfc822_read_header(FILE *f, struct Header *hdr, bool user_hdrs, bool weed) +struct Envelope *mutt_rfc822_read_header(FILE *f, struct Email *hdr, bool user_hdrs, bool weed) { struct Envelope *e = mutt_env_new(); char *line = mutt_mem_malloc(LONG_STRING); @@ -1374,7 +1374,7 @@ struct Body *mutt_parse_multipart(FILE *fp, const char *boundary, LOFF_T end_off */ struct Body *mutt_rfc822_parse_message(FILE *fp, struct Body *parent) { - parent->hdr = mutt_header_new(); + parent->hdr = mutt_email_new(); parent->hdr->offset = ftello(fp); parent->hdr->env = mutt_rfc822_read_header(fp, parent->hdr, false, false); struct Body *msg = parent->hdr->content; diff --git a/email/parse.h b/email/parse.h index d317600a2..71c7a9f8e 100644 --- a/email/parse.h +++ b/email/parse.h @@ -28,7 +28,7 @@ struct Body; struct Envelope; -struct Header; +struct Email; int mutt_check_encoding(const char *c); int mutt_check_mime_type(const char *s); @@ -39,9 +39,9 @@ void mutt_parse_content_type(char *s, struct Body *ct); struct Body * mutt_parse_multipart(FILE *fp, const char *boundary, LOFF_T end_off, bool digest); void mutt_parse_part(FILE *fp, struct Body *b); struct Body * mutt_read_mime_header(FILE *fp, bool digest); -int mutt_rfc822_parse_line(struct Envelope *e, struct Header *hdr, char *line, char *p, bool user_hdrs, bool weed, bool do_2047); +int mutt_rfc822_parse_line(struct Envelope *e, struct Email *hdr, char *line, char *p, bool user_hdrs, bool weed, bool do_2047); struct Body * mutt_rfc822_parse_message(FILE *fp, struct Body *parent); -struct Envelope *mutt_rfc822_read_header(FILE *f, struct Header *hdr, bool user_hdrs, bool weed); +struct Envelope *mutt_rfc822_read_header(FILE *f, struct Email *hdr, bool user_hdrs, bool weed); char * mutt_rfc822_read_line(FILE *f, char *line, size_t *linelen); #endif /* MUTT_EMAIL_PARSE_H */ diff --git a/email/thread.c b/email/thread.c index cf72844ac..c6c5e6557 100644 --- a/email/thread.c +++ b/email/thread.c @@ -32,8 +32,8 @@ #include #include "mutt/mutt.h" #include "thread.h" +#include "email.h" #include "envelope.h" -#include "header.h" /** * is_descendant - Is one thread a descendant of another @@ -114,7 +114,7 @@ void thread_hash_destructor(int type, void *obj, intptr_t data) * @param reverse If true, reverse the direction of the search * @retval ptr Matching Header */ -struct Header *find_virtual(struct MuttThread *cur, int reverse) +struct Email *find_virtual(struct MuttThread *cur, int reverse) { struct MuttThread *top = NULL; @@ -193,7 +193,7 @@ void clean_references(struct MuttThread *brk, struct MuttThread *cur) if (done) { - struct Header *h = cur->message; + struct Email *h = cur->message; /* clearing the References: header from obsolete Message-ID(s) */ struct ListNode *np = NULL; @@ -214,7 +214,7 @@ void clean_references(struct MuttThread *brk, struct MuttThread *cur) * mutt_break_thread - Break the email Thread * @param hdr Email Header to break at */ -void mutt_break_thread(struct Header *hdr) +void mutt_break_thread(struct Email *hdr) { mutt_list_free(&hdr->env->in_reply_to); mutt_list_free(&hdr->env->references); diff --git a/email/thread.h b/email/thread.h index 5fa783151..cf312c110 100644 --- a/email/thread.h +++ b/email/thread.h @@ -26,7 +26,7 @@ #include #include -struct Header; +struct Email; /** * struct MuttThread - An email conversation @@ -45,15 +45,15 @@ struct MuttThread struct MuttThread *child; struct MuttThread *next; struct MuttThread *prev; - struct Header *message; - struct Header *sort_key; + struct Email *message; + struct Email *sort_key; }; void clean_references(struct MuttThread *brk, struct MuttThread *cur); -struct Header *find_virtual(struct MuttThread *cur, int reverse); +struct Email *find_virtual(struct MuttThread *cur, int reverse); void insert_message(struct MuttThread **new, struct MuttThread *newparent, struct MuttThread *cur); bool is_descendant(struct MuttThread *a, struct MuttThread *b); -void mutt_break_thread(struct Header *hdr); +void mutt_break_thread(struct Email *hdr); void thread_hash_destructor(int type, void *obj, intptr_t data); void unlink_message(struct MuttThread **old, struct MuttThread *cur); diff --git a/flags.c b/flags.c index 2e73aa8cd..22ca77f79 100644 --- a/flags.c +++ b/flags.c @@ -53,7 +53,7 @@ * @param bf true: set the flag; false: clear the flag * @param upd_ctx true: update the Context */ -void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool bf, bool upd_ctx) +void mutt_set_flag_update(struct Context *ctx, struct Email *h, int flag, bool bf, bool upd_ctx) { if (!ctx || !h) return; @@ -368,7 +368,7 @@ void mutt_tag_set_flag(int flag, int bf) * @retval 0 Success * @retval -1 Failure */ -int mutt_thread_set_flag(struct Header *hdr, int flag, int bf, int subthread) +int mutt_thread_set_flag(struct Email *hdr, int flag, int bf, int subthread) { struct MuttThread *start = NULL, *cur = hdr->thread; @@ -424,7 +424,7 @@ done: * @retval 0 Success * @retval -1 Failure */ -int mutt_change_flag(struct Header *h, int bf) +int mutt_change_flag(struct Email *h, int bf) { int i, flag; struct Event event; diff --git a/hcache/hcache.c b/hcache/hcache.c index 1fedbf755..11f328db9 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -397,7 +397,7 @@ void mutt_hcache_free(header_cache_t *h, void **data) * mutt_hcache_store - Multiplexor for HcacheOps::store */ int mutt_hcache_store(header_cache_t *h, const char *key, size_t keylen, - struct Header *header, unsigned int uidvalidity) + struct Email *header, unsigned int uidvalidity) { char *data = NULL; int dlen; diff --git a/hcache/hcache.h b/hcache/hcache.h index 3d14f8854..3fbdccab9 100644 --- a/hcache/hcache.h +++ b/hcache/hcache.h @@ -52,24 +52,24 @@ #include #include -struct Header; +struct Email; /** - * struct HeaderCache - header cache structure + * struct EmailCache - header cache structure * * This struct holds both the backend-agnostic and the backend-specific parts * of the header cache. Backend code MUST initialize the fetch, store, * delete and close function pointers in hcache_open, and MAY store * backend-specific context in the ctx pointer. */ -struct HeaderCache +struct EmailCache { char *folder; unsigned int crc; void *ctx; }; -typedef struct HeaderCache header_cache_t; +typedef struct EmailCache header_cache_t; /** * typedef hcache_namer_t - Prototype for function to compose hcache file names @@ -152,9 +152,9 @@ void mutt_hcache_free(header_cache_t *h, void **data); * @retval ptr Success, the restored header (cannot be NULL) * * @note The returned Header must be free'd by caller code with - * mutt_header_free(). + * mutt_email_free(). */ -struct Header *mutt_hcache_restore(const unsigned char *d); +struct Email *mutt_hcache_restore(const unsigned char *d); /** * mutt_hcache_store - store a Header along with a validity datum @@ -167,7 +167,7 @@ struct Header *mutt_hcache_restore(const unsigned char *d); * @retval num Generic or backend-specific error code otherwise */ int mutt_hcache_store(header_cache_t *h, const char *key, size_t keylen, - struct Header *header, unsigned int uidvalidity); + struct Email *header, unsigned int uidvalidity); /** * mutt_hcache_store_raw - store a key / data pair diff --git a/hcache/serialize.c b/hcache/serialize.c index 867b3eccc..9acf8638d 100644 --- a/hcache/serialize.c +++ b/hcache/serialize.c @@ -572,10 +572,10 @@ void serial_restore_envelope(struct Envelope *e, const unsigned char *d, int *of * This function transforms a header into a char so that it is useable by * db_store. */ -void *mutt_hcache_dump(header_cache_t *h, const struct Header *header, int *off, +void *mutt_hcache_dump(header_cache_t *h, const struct Email *header, int *off, unsigned int uidvalidity) { - struct Header nh; + struct Email nh; bool convert = !CharsetIsUtf8; *off = 0; @@ -593,8 +593,8 @@ void *mutt_hcache_dump(header_cache_t *h, const struct Header *header, int *off, d = serial_dump_int(h->crc, d, off); - lazy_realloc(&d, *off + sizeof(struct Header)); - memcpy(&nh, header, sizeof(struct Header)); + lazy_realloc(&d, *off + sizeof(struct Email)); + memcpy(&nh, header, sizeof(struct Email)); /* some fields are not safe to cache */ nh.tagged = false; @@ -618,8 +618,8 @@ void *mutt_hcache_dump(header_cache_t *h, const struct Header *header, int *off, #endif nh.data = NULL; - memcpy(d + *off, &nh, sizeof(struct Header)); - *off += sizeof(struct Header); + memcpy(d + *off, &nh, sizeof(struct Email)); + *off += sizeof(struct Email); d = serial_dump_envelope(nh.env, d, off, convert); d = serial_dump_body(nh.content, d, off, convert); @@ -633,10 +633,10 @@ void *mutt_hcache_dump(header_cache_t *h, const struct Header *header, int *off, * @param d Binary blob * @retval ptr Reconstructed Header */ -struct Header *mutt_hcache_restore(const unsigned char *d) +struct Email *mutt_hcache_restore(const unsigned char *d) { int off = 0; - struct Header *h = mutt_header_new(); + struct Email *h = mutt_email_new(); bool convert = !CharsetIsUtf8; /* skip validate */ @@ -645,8 +645,8 @@ struct Header *mutt_hcache_restore(const unsigned char *d) /* skip crc */ off += sizeof(unsigned int); - memcpy(h, d + off, sizeof(struct Header)); - off += sizeof(struct Header); + memcpy(h, d + off, sizeof(struct Email)); + off += sizeof(struct Email); STAILQ_INIT(&h->tags); #ifdef MIXMASTER diff --git a/hcache/serialize.h b/hcache/serialize.h index 96d775cca..800b45049 100644 --- a/hcache/serialize.h +++ b/hcache/serialize.h @@ -34,7 +34,7 @@ struct Address; struct Body; struct Buffer; struct Envelope; -struct Header; +struct Email; struct ListHead; struct ParameterList; @@ -57,7 +57,7 @@ void serial_restore_int(unsigned int *i, const unsigned char *d, int * void serial_restore_parameter(struct ParameterList *p, const unsigned char *d, int *off, bool convert); void serial_restore_stailq(struct ListHead *l, const unsigned char *d, int *off, bool convert); -void * mutt_hcache_dump(header_cache_t *h, const struct Header *header, int *off, unsigned int uidvalidity); -struct Header *mutt_hcache_restore(const unsigned char *d); +void * mutt_hcache_dump(header_cache_t *h, const struct Email *header, int *off, unsigned int uidvalidity); +struct Email *mutt_hcache_restore(const unsigned char *d); #endif /* MUTT_HCACHE_SERIALIZE_H */ diff --git a/hdrline.c b/hdrline.c index 3e3ba000a..2a46b7082 100644 --- a/hdrline.c +++ b/hdrline.c @@ -383,7 +383,7 @@ static bool user_in_addr(struct Address *a) * @retval 4 User is originator * @retval 5 Sent to a subscribed mailinglist */ -static int user_is_recipient(struct Header *h) +static int user_is_recipient(struct Email *h) { if (!h || !h->env) return 0; @@ -446,7 +446,7 @@ static char *apply_subject_mods(struct Envelope *env) * @param hdr Header of an email * @retval true If thread contains new mail */ -static bool thread_is_new(struct Context *ctx, struct Header *hdr) +static bool thread_is_new(struct Context *ctx, struct Email *hdr) { return hdr->collapsed && (hdr->num_hidden > 1) && (mutt_thread_contains_unread(ctx, hdr) == 1); @@ -458,7 +458,7 @@ static bool thread_is_new(struct Context *ctx, struct Header *hdr) * @param hdr Header of an email * @retval true If thread contains unread mail */ -static bool thread_is_old(struct Context *ctx, struct Header *hdr) +static bool thread_is_old(struct Context *ctx, struct Email *hdr) { return hdr->collapsed && (hdr->num_hidden > 1) && (mutt_thread_contains_unread(ctx, hdr) == 2); @@ -532,7 +532,7 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co int is_index = (flags & MUTT_FORMAT_INDEX); size_t colorlen; - struct Header *hdr = hfi->hdr; + struct Email *hdr = hfi->hdr; struct Context *ctx = hfi->ctx; if (!hdr || !hdr->env) @@ -1239,7 +1239,7 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co if (hdr->env->x_label) { i = 1; /* reduce reuse recycle */ - struct Header *htmp = NULL; + struct Email *htmp = NULL; if (flags & MUTT_FORMAT_TREE && (hdr->thread->prev && hdr->thread->prev->message && hdr->thread->prev->message->env->x_label)) { @@ -1425,7 +1425,7 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co * @param flags Format flags */ void mutt_make_string_flags(char *buf, size_t buflen, const char *s, - struct Context *ctx, struct Header *hdr, enum FormatFlag flags) + struct Context *ctx, struct Email *hdr, enum FormatFlag flags) { struct HdrFormatInfo hfi; diff --git a/hdrline.h b/hdrline.h index 3b7c70d2f..7e3313f19 100644 --- a/hdrline.h +++ b/hdrline.h @@ -29,7 +29,7 @@ struct Address; struct Context; -struct Header; +struct Email; /* These Config Variables are only used in hdrline.c */ extern struct MbTable *FlagChars; @@ -42,13 +42,13 @@ extern struct MbTable *ToChars; struct HdrFormatInfo { struct Context *ctx; - struct Header *hdr; + struct Email *hdr; const char *pager_progress; }; bool mutt_is_mail_list(struct Address *addr); bool mutt_is_subscribed_list(struct Address *addr); -void mutt_make_string_flags(char *buf, size_t buflen, const char *s, struct Context *ctx, struct Header *hdr, enum FormatFlag flags); +void mutt_make_string_flags(char *buf, size_t buflen, const char *s, struct Context *ctx, struct Email *hdr, enum FormatFlag flags); void mutt_make_string_info(char *buf, size_t buflen, int cols, const char *s, struct HdrFormatInfo *hfi, enum FormatFlag flags); #define mutt_make_string(A, B, C, D, E) mutt_make_string_flags(A, B, C, D, E, 0) diff --git a/hook.c b/hook.c index feb8f7e29..6440c7cea 100644 --- a/hook.c +++ b/hook.c @@ -444,7 +444,7 @@ char *mutt_find_hook(int type, const char *pat) * @param hdr Email Header * @param type Hook type, e.g. #MUTT_MESSAGE_HOOK */ -void mutt_message_hook(struct Context *ctx, struct Header *hdr, int type) +void mutt_message_hook(struct Context *ctx, struct Email *hdr, int type) { struct Buffer err, token; struct Hook *hook = NULL; @@ -498,7 +498,7 @@ void mutt_message_hook(struct Context *ctx, struct Header *hdr, int type) * @retval -1 Failure */ static int addr_hook(char *path, size_t pathlen, int type, struct Context *ctx, - struct Header *hdr) + struct Email *hdr) { struct Hook *hook = NULL; struct PatternCache cache = { 0 }; @@ -529,7 +529,7 @@ static int addr_hook(char *path, size_t pathlen, int type, struct Context *ctx, * @param pathlen Length of buffer * @param hdr Email Header */ -void mutt_default_save(char *path, size_t pathlen, struct Header *hdr) +void mutt_default_save(char *path, size_t pathlen, struct Email *hdr) { *path = '\0'; if (addr_hook(path, pathlen, MUTT_SAVE_HOOK, Context, hdr) == 0) @@ -563,7 +563,7 @@ void mutt_default_save(char *path, size_t pathlen, struct Header *hdr) * @param pathlen Length of the buffer * @param hdr Email Header */ -void mutt_select_fcc(char *path, size_t pathlen, struct Header *hdr) +void mutt_select_fcc(char *path, size_t pathlen, struct Email *hdr) { if (addr_hook(path, pathlen, MUTT_FCC_HOOK, NULL, hdr) != 0) { diff --git a/hook.h b/hook.h index 1a82e5b10..5b49f1e2f 100644 --- a/hook.h +++ b/hook.h @@ -29,7 +29,7 @@ struct Address; struct Buffer; struct Context; -struct Header; +struct Email; struct ListHead; /* These Config Variables are only used in hook.c */ @@ -62,14 +62,14 @@ extern bool SaveName; void mutt_account_hook(const char *url); void mutt_crypt_hook(struct ListHead *list, struct Address *addr); -void mutt_default_save(char *path, size_t pathlen, struct Header *hdr); +void mutt_default_save(char *path, size_t pathlen, struct Email *hdr); void mutt_delete_hooks(int type); char *mutt_find_hook(int type, const char *pat); void mutt_folder_hook(const char *path); -void mutt_message_hook(struct Context *ctx, struct Header *hdr, int type); +void mutt_message_hook(struct Context *ctx, struct Email *hdr, int type); int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err); int mutt_parse_unhook(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err); -void mutt_select_fcc(char *path, size_t pathlen, struct Header *hdr); +void mutt_select_fcc(char *path, size_t pathlen, struct Email *hdr); void mutt_startup_shutdown_hook(int type); void mutt_timeout_hook(void); diff --git a/imap/command.c b/imap/command.c index a99d934e4..dfdf38a2b 100644 --- a/imap/command.c +++ b/imap/command.c @@ -243,7 +243,7 @@ static int cmd_status(const char *s) static void cmd_parse_expunge(struct ImapData *idata, const char *s) { unsigned int exp_msn; - struct Header *h = NULL; + struct Email *h = NULL; mutt_debug(2, "Handling EXPUNGE\n"); @@ -317,7 +317,7 @@ static void cmd_parse_vanished(struct ImapData *idata, char *s) while ((rc = mutt_seqset_iterator_next(iter, &uid)) == 0) { - struct Header *h = mutt_hash_int_find(idata->uid_hash, uid); + struct Email *h = mutt_hash_int_find(idata->uid_hash, uid); if (!h) continue; @@ -378,7 +378,7 @@ static void cmd_parse_vanished(struct ImapData *idata, char *s) static void cmd_parse_fetch(struct ImapData *idata, char *s) { unsigned int msn, uid; - struct Header *h = NULL; + struct Email *h = NULL; char *flags = NULL; int uid_checked = 0; int server_changes = 0; @@ -744,7 +744,7 @@ static void cmd_parse_myrights(struct ImapData *idata, const char *s) static void cmd_parse_search(struct ImapData *idata, const char *s) { unsigned int uid; - struct Header *h = NULL; + struct Email *h = NULL; mutt_debug(2, "Handling SEARCH\n"); diff --git a/imap/imap.c b/imap/imap.c index 20756245a..13525a008 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -184,7 +184,7 @@ static int make_msg_set(struct ImapData *idata, struct Buffer *buf, int flag, unsigned int setstart = 0; /* start of current message range */ int n; bool started = false; - struct Header **hdrs = idata->ctx->mailbox->hdrs; + struct Email **hdrs = idata->ctx->mailbox->hdrs; for (n = *pos; n < idata->ctx->mailbox->msg_count && buf->dptr - buf->data < IMAP_MAX_CMDLEN; n++) @@ -267,7 +267,7 @@ static int make_msg_set(struct ImapData *idata, struct Buffer *buf, int flag, * * The comparison of flags EXCLUDES the deleted flag. */ -static bool compare_flags_for_copy(struct Header *h) +static bool compare_flags_for_copy(struct Email *h) { struct ImapHeaderData *hd = h->data; @@ -833,7 +833,7 @@ int imap_read_literal(FILE *fp, struct ImapData *idata, unsigned long bytes, */ void imap_expunge_mailbox(struct ImapData *idata) { - struct Header *h = NULL; + struct Email *h = NULL; int cacheno; short old_sort; @@ -1189,7 +1189,7 @@ bool imap_has_flag(struct ListHead *flag_list, const char *flag) int imap_exec_msgset(struct ImapData *idata, const char *pre, const char *post, int flag, bool changed, bool invert) { - struct Header **hdrs = NULL; + struct Email **hdrs = NULL; short oldsort; int pos; int rc; @@ -1205,13 +1205,13 @@ int imap_exec_msgset(struct ImapData *idata, const char *pre, const char *post, { hdrs = idata->ctx->mailbox->hdrs; idata->ctx->mailbox->hdrs = - mutt_mem_malloc(idata->ctx->mailbox->msg_count * sizeof(struct Header *)); + mutt_mem_malloc(idata->ctx->mailbox->msg_count * sizeof(struct Email *)); memcpy(idata->ctx->mailbox->hdrs, hdrs, - idata->ctx->mailbox->msg_count * sizeof(struct Header *)); + idata->ctx->mailbox->msg_count * sizeof(struct Email *)); Sort = SORT_ORDER; qsort(idata->ctx->mailbox->hdrs, idata->ctx->mailbox->msg_count, - sizeof(struct Header *), mutt_get_sort_func(SORT_ORDER)); + sizeof(struct Email *), mutt_get_sort_func(SORT_ORDER)); } pos = 0; @@ -1262,7 +1262,7 @@ out: * @note This does not sync the "deleted" flag state, because it is not * desirable to propagate that flag into the copy. */ -int imap_sync_message_for_copy(struct ImapData *idata, struct Header *hdr, +int imap_sync_message_for_copy(struct ImapData *idata, struct Email *hdr, struct Buffer *cmd, int *err_continue) { char flags[LONG_STRING]; @@ -2003,8 +2003,8 @@ out: int imap_sync_mailbox(struct Context *ctx, bool expunge) { struct Context *appendctx = NULL; - struct Header *h = NULL; - struct Header **hdrs = NULL; + struct Email *h = NULL; + struct Email **hdrs = NULL; int oldsort; int rc; @@ -2101,11 +2101,11 @@ int imap_sync_mailbox(struct Context *ctx, bool expunge) { hdrs = ctx->mailbox->hdrs; ctx->mailbox->hdrs = - mutt_mem_malloc(ctx->mailbox->msg_count * sizeof(struct Header *)); - memcpy(ctx->mailbox->hdrs, hdrs, ctx->mailbox->msg_count * sizeof(struct Header *)); + mutt_mem_malloc(ctx->mailbox->msg_count * sizeof(struct Email *)); + memcpy(ctx->mailbox->hdrs, hdrs, ctx->mailbox->msg_count * sizeof(struct Email *)); Sort = SORT_ORDER; - qsort(ctx->mailbox->hdrs, ctx->mailbox->msg_count, sizeof(struct Header *), + qsort(ctx->mailbox->hdrs, ctx->mailbox->msg_count, sizeof(struct Email *), mutt_get_sort_func(SORT_ORDER)); } @@ -2424,7 +2424,7 @@ static int imap_mbox_open(struct Context *ctx) } ctx->mailbox->hdrmax = count; - ctx->mailbox->hdrs = mutt_mem_calloc(count, sizeof(struct Header *)); + ctx->mailbox->hdrs = mutt_mem_calloc(count, sizeof(struct Email *)); ctx->mailbox->v2r = mutt_mem_calloc(count, sizeof(int)); ctx->mailbox->msg_count = 0; @@ -2579,7 +2579,7 @@ static int imap_mbox_close(struct Context *ctx) /** * imap_msg_open_new - Implements MxOps::msg_open_new() */ -static int imap_msg_open_new(struct Context *ctx, struct Message *msg, struct Header *hdr) +static int imap_msg_open_new(struct Context *ctx, struct Message *msg, struct Email *hdr) { char tmp[PATH_MAX]; @@ -2683,7 +2683,7 @@ static int imap_tags_edit(struct Context *ctx, const char *tags, char *buf, size * Also this method check that each flags is support by the server * first and remove unsupported one. */ -static int imap_tags_commit(struct Context *ctx, struct Header *hdr, char *buf) +static int imap_tags_commit(struct Context *ctx, struct Email *hdr, char *buf) { struct Buffer *cmd = NULL; char uid[11]; diff --git a/imap/imap.h b/imap/imap.h index d1650e54e..17491c20f 100644 --- a/imap/imap.h +++ b/imap/imap.h @@ -55,7 +55,7 @@ struct BrowserState; struct Context; -struct Header; +struct Email; struct Pattern; /* These Config Variables are only used in imap/auth.c */ @@ -104,7 +104,7 @@ int imap_mailbox_create(const char *folder); int imap_mailbox_rename(const char *mailbox); /* message.c */ -int imap_copy_messages(struct Context *ctx, struct Header *h, char *dest, bool delete); +int imap_copy_messages(struct Context *ctx, struct Email *h, char *dest, bool delete); /* socket.c */ void imap_logout_all(void); diff --git a/imap/imap_private.h b/imap/imap_private.h index 05738d038..288240f69 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -34,7 +34,7 @@ struct ConnAccount; struct Context; -struct Header; +struct Email; struct ImapHeaderData; struct ImapMbox; struct Message; @@ -260,7 +260,7 @@ struct ImapData unsigned int uid_validity; unsigned int uidnext; unsigned long long modseq; - struct Header **msn_index; /**< look up headers by (MSN-1) */ + struct Email **msn_index; /**< look up headers by (MSN-1) */ size_t msn_index_size; /**< allocation size */ unsigned int max_msn; /**< the largest MSN fetched so far */ struct BodyCache *bcache; @@ -302,7 +302,7 @@ struct ImapData *imap_conn_find(const struct ConnAccount *account, int flags); int imap_read_literal(FILE *fp, struct ImapData *idata, unsigned long bytes, struct Progress *pbar); void imap_expunge_mailbox(struct ImapData *idata); void imap_logout(struct ImapData **idata); -int imap_sync_message_for_copy(struct ImapData *idata, struct Header *hdr, struct Buffer *cmd, int *err_continue); +int imap_sync_message_for_copy(struct ImapData *idata, struct Email *hdr, struct Buffer *cmd, int *err_continue); bool imap_has_flag(struct ListHead *flag_list, const char *flag); /* auth.c */ @@ -320,8 +320,8 @@ int imap_cmd_idle(struct ImapData *idata); /* message.c */ void imap_free_header_data(struct ImapHeaderData **data); int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned int msn_end, bool initial_download); -char *imap_set_flags(struct ImapData *idata, struct Header *h, char *s, int *server_changes); -int imap_cache_del(struct ImapData *idata, struct Header *h); +char *imap_set_flags(struct ImapData *idata, struct Email *h, char *s, int *server_changes); +int imap_cache_del(struct ImapData *idata, struct Email *h); int imap_cache_clean(struct ImapData *idata); int imap_append_message(struct Context *ctx, struct Message *msg); @@ -333,8 +333,8 @@ int imap_msg_commit(struct Context *ctx, struct Message *msg); #ifdef USE_HCACHE header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path); void imap_hcache_close(struct ImapData *idata); -struct Header *imap_hcache_get(struct ImapData *idata, unsigned int uid); -int imap_hcache_put(struct ImapData *idata, struct Header *h); +struct Email *imap_hcache_get(struct ImapData *idata, unsigned int uid); +int imap_hcache_put(struct ImapData *idata, struct Email *h); int imap_hcache_del(struct ImapData *idata, unsigned int uid); int imap_hcache_store_uid_seqset(struct ImapData *idata); int imap_hcache_clear_uid_seqset(struct ImapData *idata); diff --git a/imap/message.c b/imap/message.c index 8ab10b6ef..098e28551 100644 --- a/imap/message.c +++ b/imap/message.c @@ -103,7 +103,7 @@ static struct BodyCache *msg_cache_open(struct ImapData *idata) * @retval ptr Success, handle of cache entry * @retval NULL Failure */ -static FILE *msg_cache_get(struct ImapData *idata, struct Header *h) +static FILE *msg_cache_get(struct ImapData *idata, struct Email *h) { if (!idata || !h) return NULL; @@ -121,7 +121,7 @@ static FILE *msg_cache_get(struct ImapData *idata, struct Header *h) * @retval ptr Success, handle of cache entry * @retval NULL Failure */ -static FILE *msg_cache_put(struct ImapData *idata, struct Header *h) +static FILE *msg_cache_put(struct ImapData *idata, struct Email *h) { if (!idata || !h) return NULL; @@ -139,7 +139,7 @@ static FILE *msg_cache_put(struct ImapData *idata, struct Header *h) * @retval 0 Success * @retval -1 Failure */ -static int msg_cache_commit(struct ImapData *idata, struct Header *h) +static int msg_cache_commit(struct ImapData *idata, struct Email *h) { if (!idata || !h) return -1; @@ -501,7 +501,7 @@ static void alloc_msn_index(struct ImapData *idata, size_t msn_count) /* This is a conservative check to protect against a malicious imap * server. Most likely size_t is bigger than an unsigned int, but * if msn_count is this big, we have a serious problem. */ - if (msn_count >= (UINT_MAX / sizeof(struct Header *))) + if (msn_count >= (UINT_MAX / sizeof(struct Email *))) { mutt_error(_("Out of memory")); mutt_exit(1); @@ -511,12 +511,12 @@ static void alloc_msn_index(struct ImapData *idata, size_t msn_count) new_size = msn_count + 25; if (!idata->msn_index) - idata->msn_index = mutt_mem_calloc(new_size, sizeof(struct Header *)); + idata->msn_index = mutt_mem_calloc(new_size, sizeof(struct Email *)); else { - mutt_mem_realloc(&idata->msn_index, sizeof(struct Header *) * new_size); + mutt_mem_realloc(&idata->msn_index, sizeof(struct Email *) * new_size); memset(idata->msn_index + idata->msn_index_size, 0, - sizeof(struct Header *) * (new_size - idata->msn_index_size)); + sizeof(struct Email *) * (new_size - idata->msn_index_size)); } idata->msn_index_size = new_size; @@ -614,7 +614,7 @@ static void imap_fetch_msn_seqset(struct Buffer *b, struct ImapData *idata, * case of local_changes, if a change to a flag _would_ have been * made. */ -static void set_changed_flag(struct Context *ctx, struct Header *h, +static void set_changed_flag(struct Context *ctx, struct Email *h, int local_changes, int *server_changes, int flag_name, int old_hd_flag, int new_hd_flag, int h_flag) { @@ -808,7 +808,7 @@ static int read_headers_qresync_eval_cache(struct ImapData *idata, char *uid_seq if (msn > idata->msn_index_size) alloc_msn_index(idata, msn); - struct Header *h = imap_hcache_get(idata, uid); + struct Email *h = imap_hcache_get(idata, uid); if (h) { idata->max_msn = MAX(idata->max_msn, msn); @@ -1055,7 +1055,7 @@ static int read_headers_fetch_new(struct ImapData *idata, unsigned int msn_begin continue; } - ctx->mailbox->hdrs[idx] = mutt_header_new(); + ctx->mailbox->hdrs[idx] = mutt_email_new(); idata->max_msn = MAX(idata->max_msn, h.data->msn); idata->msn_index[h.data->msn - 1] = ctx->mailbox->hdrs[idx]; @@ -1475,7 +1475,7 @@ fail: * @retval 0 Success * @retval 1 Non-fatal error - try fetch/append */ -int imap_copy_messages(struct Context *ctx, struct Header *h, char *dest, bool delete) +int imap_copy_messages(struct Context *ctx, struct Email *h, char *dest, bool delete) { struct Buffer cmd, sync_cmd; char mbox[PATH_MAX]; @@ -1662,7 +1662,7 @@ out: * @retval 0 Success * @retval -1 Failure */ -int imap_cache_del(struct ImapData *idata, struct Header *h) +int imap_cache_del(struct ImapData *idata, struct Email *h) { if (!idata || !h) return -1; @@ -1719,7 +1719,7 @@ void imap_free_header_data(struct ImapHeaderData **data) * case of h->changed, if a change to a flag _would_ have been * made. */ -char *imap_set_flags(struct ImapData *idata, struct Header *h, char *s, int *server_changes) +char *imap_set_flags(struct ImapData *idata, struct Email *h, char *s, int *server_changes) { struct Context *ctx = idata->ctx; struct ImapHeader newh = { 0 }; @@ -1797,7 +1797,7 @@ int imap_msg_open(struct Context *ctx, struct Message *msg, int msgno) int output_progress; struct ImapData *idata = ctx->mailbox->data; - struct Header *h = ctx->mailbox->hdrs[msgno]; + struct Email *h = ctx->mailbox->hdrs[msgno]; msg->fp = msg_cache_get(idata, h); if (msg->fp) diff --git a/imap/util.c b/imap/util.c index 4f11b7bb5..e092aa6d7 100644 --- a/imap/util.c +++ b/imap/util.c @@ -231,7 +231,7 @@ static void imap_msn_index_to_uid_seqset(struct Buffer *b, struct ImapData *idat match = false; if (msn <= idata->max_msn) { - struct Header *cur_header = idata->msn_index[msn - 1]; + struct Email *cur_header = idata->msn_index[msn - 1]; cur_uid = cur_header ? HEADER_DATA(cur_header)->uid : 0; if (!state || (cur_uid && ((cur_uid - 1) == last_uid))) match = true; @@ -338,11 +338,11 @@ void imap_hcache_close(struct ImapData *idata) * @retval ptr Email Header * @retval NULL Failure */ -struct Header *imap_hcache_get(struct ImapData *idata, unsigned int uid) +struct Email *imap_hcache_get(struct ImapData *idata, unsigned int uid) { char key[16]; void *uv = NULL; - struct Header *h = NULL; + struct Email *h = NULL; if (!idata->hcache) return NULL; @@ -368,7 +368,7 @@ struct Header *imap_hcache_get(struct ImapData *idata, unsigned int uid) * @retval 0 Success * @retval -1 Failure */ -int imap_hcache_put(struct ImapData *idata, struct Header *h) +int imap_hcache_put(struct ImapData *idata, struct Email *h) { char key[16]; diff --git a/mailbox.c b/mailbox.c index 37be703e3..4fb31f753 100644 --- a/mailbox.c +++ b/mailbox.c @@ -134,20 +134,20 @@ static int fseek_last_message(FILE *f) */ static bool test_last_status_new(FILE *f) { - struct Header *hdr = NULL; + struct Email *hdr = NULL; struct Envelope *tmp_envelope = NULL; bool result = false; if (fseek_last_message(f) == -1) return false; - hdr = mutt_header_new(); + hdr = mutt_email_new(); tmp_envelope = mutt_rfc822_read_header(f, hdr, false, false); if (!(hdr->read || hdr->old)) result = true; mutt_env_free(&tmp_envelope); - mutt_header_free(&hdr); + mutt_email_free(&hdr); return result; } diff --git a/mailbox.h b/mailbox.h index 29fdf6fd1..22efaa435 100644 --- a/mailbox.h +++ b/mailbox.h @@ -88,7 +88,7 @@ struct Mailbox int msg_unread; /**< number of unread messages */ int msg_flagged; /**< number of flagged messages */ - struct Header **hdrs; + struct Email **hdrs; int hdrmax; /**< number of pointers in hdrs */ int *v2r; /**< mapping from virtual to real msgno */ int vcount; /**< the number of virtual messages */ diff --git a/maildir/maildir.h b/maildir/maildir.h index 50a612bad..313149652 100644 --- a/maildir/maildir.h +++ b/maildir/maildir.h @@ -42,7 +42,7 @@ struct Mailbox; struct Context; -struct Header; +struct Email; /* These Config Variables are only used in maildir/mh.c */ extern bool CheckNew; @@ -56,12 +56,12 @@ extern struct MxOps mx_maildir_ops; extern struct MxOps mx_mh_ops; int maildir_check_empty(const char *path); -void maildir_gen_flags(char *dest, size_t destlen, struct Header *hdr); +void maildir_gen_flags(char *dest, size_t destlen, struct Email *hdr); FILE * maildir_open_find_message(const char *folder, const char *msg, char **newname); -void maildir_parse_flags(struct Header *h, const char *path); -struct Header *maildir_parse_message(enum MailboxType magic, const char *fname, bool is_old, struct Header *h); -struct Header *maildir_parse_stream(enum MailboxType magic, FILE *f, const char *fname, bool is_old, struct Header *h); -bool maildir_update_flags(struct Context *ctx, struct Header *o, struct Header *n); +void maildir_parse_flags(struct Email *h, const char *path); +struct Email *maildir_parse_message(enum MailboxType magic, const char *fname, bool is_old, struct Email *h); +struct Email *maildir_parse_stream(enum MailboxType magic, FILE *f, const char *fname, bool is_old, struct Email *h); +bool maildir_update_flags(struct Context *ctx, struct Email *o, struct Email *n); bool mh_mailbox(struct Mailbox *mailbox, bool check_stats); int mh_check_empty(const char *path); diff --git a/maildir/mh.c b/maildir/mh.c index 6706aabad..29c98d8fb 100644 --- a/maildir/mh.c +++ b/maildir/mh.c @@ -87,7 +87,7 @@ char *MhSeqUnseen; ///< Config: MH sequence for unseen messages */ struct Maildir { - struct Header *h; + struct Email *h; char *canon_fname; bool header_parsed : 1; ino_t inode; @@ -672,7 +672,7 @@ static void maildir_free_entry(struct Maildir **md) FREE(&(*md)->canon_fname); if ((*md)->h) - mutt_header_free(&(*md)->h); + mutt_email_free(&(*md)->h); FREE(md); } @@ -743,7 +743,7 @@ static int maildir_parse_dir(struct Mailbox *mailbox, struct Maildir ***last, char buf[PATH_MAX]; int is_old = 0; struct Maildir *entry = NULL; - struct Header *h = NULL; + struct Email *h = NULL; if (subdir) { @@ -768,7 +768,7 @@ static int maildir_parse_dir(struct Mailbox *mailbox, struct Maildir ***last, /* FOO - really ignore the return value? */ mutt_debug(2, "queueing %s\n", de->d_name); - h = mutt_header_new(); + h = mutt_email_new(); h->old = is_old; if (mailbox->magic == MUTT_MAILDIR) maildir_parse_flags(h, de->d_name); @@ -1160,10 +1160,10 @@ static void maildir_delayed_parsing(struct Mailbox *mailbox, struct Maildir **md if (data && !ret && lastchanged.st_mtime <= when->tv_sec) { - struct Header *h = mutt_hcache_restore((unsigned char *) data); + struct Email *h = mutt_hcache_restore((unsigned char *) data); h->old = p->h->old; h->path = mutt_str_strdup(p->h->path); - mutt_header_free(&p->h); + mutt_email_free(&p->h); p->h = h; if (mailbox->magic == MUTT_MAILDIR) maildir_parse_flags(p->h, fn); @@ -1190,7 +1190,7 @@ static void maildir_delayed_parsing(struct Mailbox *mailbox, struct Maildir **md #endif } else - mutt_header_free(&p->h); + mutt_email_free(&p->h); #ifdef USE_HCACHE } mutt_hcache_free(hc, &data); @@ -1308,7 +1308,7 @@ static int ch_compare(const void *a, const void *b) static int maildir_mh_open_message(struct Mailbox *mailbox, struct Message *msg, int msgno, int is_maildir) { - struct Header *cur = mailbox->hdrs[msgno]; + struct Email *cur = mailbox->hdrs[msgno]; char path[PATH_MAX]; snprintf(path, sizeof(path), "%s/%s", mailbox->path, cur->path); @@ -1337,7 +1337,7 @@ static int maildir_mh_open_message(struct Mailbox *mailbox, struct Message *msg, * @retval -1 Failure */ static int mh_commit_msg(struct Mailbox *mailbox, struct Message *msg, - struct Header *hdr, bool updseq) + struct Email *hdr, bool updseq) { struct dirent *de = NULL; char *cp = NULL, *dep = NULL; @@ -1436,7 +1436,7 @@ static int mh_commit_msg(struct Mailbox *mailbox, struct Message *msg, * * See also maildir_msg_open_new(). */ -static int md_commit_message(struct Mailbox *mailbox, struct Message *msg, struct Header *hdr) +static int md_commit_message(struct Mailbox *mailbox, struct Message *msg, struct Email *hdr) { char subdir[4]; char suffix[16]; @@ -1522,7 +1522,7 @@ static int md_commit_message(struct Mailbox *mailbox, struct Message *msg, struc */ static int mh_rewrite_message(struct Context *ctx, int msgno) { - struct Header *h = ctx->mailbox->hdrs[msgno]; + struct Email *h = ctx->mailbox->hdrs[msgno]; bool restore = true; long old_body_offset = h->content->offset; @@ -1600,7 +1600,7 @@ static int mh_rewrite_message(struct Context *ctx, int msgno) */ static int mh_sync_message(struct Context *ctx, int msgno) { - struct Header *h = ctx->mailbox->hdrs[msgno]; + struct Email *h = ctx->mailbox->hdrs[msgno]; if (h->attach_del || h->xlabel_changed || (h->env && (h->env->refs_changed || h->env->irt_changed))) @@ -1621,7 +1621,7 @@ static int mh_sync_message(struct Context *ctx, int msgno) */ static int maildir_sync_message(struct Context *ctx, int msgno) { - struct Header *h = ctx->mailbox->hdrs[msgno]; + struct Email *h = ctx->mailbox->hdrs[msgno]; if (h->attach_del || h->xlabel_changed || (h->env && (h->env->refs_changed || h->env->irt_changed))) @@ -1872,7 +1872,7 @@ bool mh_mailbox(struct Mailbox *mailbox, bool check_stats) * @param h Header of email * @param path Path to email file */ -void maildir_parse_flags(struct Header *h, const char *path) +void maildir_parse_flags(struct Email *h, const char *path) { char *q = NULL; @@ -1938,13 +1938,13 @@ void maildir_parse_flags(struct Header *h, const char *path) * Actually parse a maildir message. This may also be used to fill * out a fake header structure generated by lazy maildir parsing. */ -struct Header *maildir_parse_stream(enum MailboxType magic, FILE *f, - const char *fname, bool is_old, struct Header *h) +struct Email *maildir_parse_stream(enum MailboxType magic, FILE *f, + const char *fname, bool is_old, struct Email *h) { struct stat st; if (!h) - h = mutt_header_new(); + h = mutt_email_new(); h->env = mutt_rfc822_read_header(f, h, false, false); fstat(fileno(f), &st); @@ -1980,8 +1980,8 @@ struct Header *maildir_parse_stream(enum MailboxType magic, FILE *f, * This may also be used to fill out a fake header structure generated by lazy * maildir parsing. */ -struct Header *maildir_parse_message(enum MailboxType magic, const char *fname, - bool is_old, struct Header *h) +struct Email *maildir_parse_message(enum MailboxType magic, const char *fname, + bool is_old, struct Email *h) { FILE *f = fopen(fname, "r"); if (!f) @@ -1998,7 +1998,7 @@ struct Header *maildir_parse_message(enum MailboxType magic, const char *fname, * @param destlen Length of buffer * @param hdr Header of the email */ -void maildir_gen_flags(char *dest, size_t destlen, struct Header *hdr) +void maildir_gen_flags(char *dest, size_t destlen, struct Email *hdr) { *dest = '\0'; @@ -2036,7 +2036,7 @@ int mh_sync_mailbox_message(struct Context *ctx, int msgno, header_cache_t *hc) int mh_sync_mailbox_message(struct Context *ctx, int msgno) #endif { - struct Header *h = ctx->mailbox->hdrs[msgno]; + struct Email *h = ctx->mailbox->hdrs[msgno]; if (h->deleted && (ctx->mailbox->magic != MUTT_MAILDIR || !MaildirTrash)) { @@ -2122,7 +2122,7 @@ int mh_sync_mailbox_message(struct Context *ctx, int msgno) * @retval true If the flags changed * @retval false Otherwise */ -bool maildir_update_flags(struct Context *ctx, struct Header *o, struct Header *n) +bool maildir_update_flags(struct Context *ctx, struct Email *o, struct Email *n) { /* save the global state here so we can reset it at the * end of list block if required. @@ -2451,7 +2451,7 @@ static int maildir_mbox_check(struct Context *ctx, int *index_hint) ctx->mailbox->hdrs[i]->trash = p->h->trash; /* this is a duplicate of an existing header, so remove it */ - mutt_header_free(&p->h); + mutt_email_free(&p->h); } /* This message was not in the list of messages we just scanned. * Check to see if we have enough information to know if the @@ -2514,7 +2514,7 @@ static int maildir_msg_open(struct Context *ctx, struct Message *msg, int msgno) * @note This uses _almost_ the maildir file name format, * but with a {cur,new} prefix. */ -static int maildir_msg_open_new(struct Context *ctx, struct Message *msg, struct Header *hdr) +static int maildir_msg_open_new(struct Context *ctx, struct Message *msg, struct Email *hdr) { int fd; char path[PATH_MAX]; @@ -2803,7 +2803,7 @@ static int mh_mbox_check(struct Context *ctx, int *index_hint) ctx->mailbox->hdrs[i]->active = false; p = mutt_hash_find(fnames, ctx->mailbox->hdrs[i]->path); - if (p && p->h && mutt_header_cmp_strict(ctx->mailbox->hdrs[i], p->h)) + if (p && p->h && mutt_email_cmp_strict(ctx->mailbox->hdrs[i], p->h)) { ctx->mailbox->hdrs[i]->active = true; /* found the right message */ @@ -2811,7 +2811,7 @@ static int mh_mbox_check(struct Context *ctx, int *index_hint) if (maildir_update_flags(ctx, ctx->mailbox->hdrs[i], p->h)) flags_changed = true; - mutt_header_free(&p->h); + mutt_email_free(&p->h); } else /* message has disappeared */ occult = true; @@ -2940,7 +2940,7 @@ static int mh_msg_open(struct Context *ctx, struct Message *msg, int msgno) * * Open a new (temporary) message in an MH folder. */ -static int mh_msg_open_new(struct Context *ctx, struct Message *msg, struct Header *hdr) +static int mh_msg_open_new(struct Context *ctx, struct Message *msg, struct Email *hdr) { return mh_mkstemp(ctx->mailbox, &msg->fp, &msg->path); } diff --git a/main.c b/main.c index ee256bf05..40dd2074f 100644 --- a/main.c +++ b/main.c @@ -407,7 +407,7 @@ int main(int argc, char *argv[], char *envp[]) #ifdef USE_NNTP char *cli_nntp = NULL; #endif - struct Header *msg = NULL; + struct Email *msg = NULL; struct ListHead attach = STAILQ_HEAD_INITIALIZER(attach); struct ListHead commands = STAILQ_HEAD_INITIALIZER(commands); struct ListHead queries = STAILQ_HEAD_INITIALIZER(queries); @@ -636,7 +636,7 @@ int main(int argc, char *argv[], char *envp[]) if (!STAILQ_EMPTY(&cc_list) || !STAILQ_EMPTY(&bcc_list)) { - msg = mutt_header_new(); + msg = mutt_email_new(); msg->env = mutt_env_new(); struct ListNode *np = NULL; @@ -849,7 +849,7 @@ int main(int argc, char *argv[], char *envp[]) mutt_flushinp(); if (!msg) - msg = mutt_header_new(); + msg = mutt_email_new(); if (!msg->env) msg->env = mutt_env_new(); @@ -969,7 +969,7 @@ int main(int argc, char *argv[], char *envp[]) /* Set up a "context" header with just enough information so that * mutt_prepare_template() can parse the message in fin. */ - struct Header *context_hdr = mutt_header_new(); + struct Email *context_hdr = mutt_email_new(); context_hdr->offset = 0; context_hdr->content = mutt_body_new(); if (fstat(fileno(fin), &st) != 0) @@ -983,7 +983,7 @@ int main(int argc, char *argv[], char *envp[]) { mutt_error(_("Cannot parse message template: %s"), draft_file); mutt_env_free(&opts_env); - mutt_header_free(&context_hdr); + mutt_email_free(&context_hdr); goto main_curses; } @@ -1009,7 +1009,7 @@ int main(int argc, char *argv[], char *envp[]) mutt_str_replace(&msg->env->subject, opts_env->subject); mutt_env_free(&opts_env); - mutt_header_free(&context_hdr); + mutt_email_free(&context_hdr); } /* Editing the include_file: pass it directly in. * Note that SEND_NO_FREE_HEADER is set above so it isn't unlinked. @@ -1105,7 +1105,7 @@ int main(int argc, char *argv[], char *envp[]) mutt_file_fclose(&fout); } - mutt_header_free(&msg); + mutt_email_free(&msg); } /* !edit_infile && draft_file will leave the tempfile around */ diff --git a/mbox/mbox.c b/mbox/mbox.c index 99ae88751..f54fb1234 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -200,7 +200,7 @@ static int mmdf_parse_mailbox(struct Context *ctx) int lines; time_t t; LOFF_T loc, tmploc; - struct Header *hdr = NULL; + struct Email *hdr = NULL; struct stat sb; struct Progress progress; @@ -243,7 +243,7 @@ static int mmdf_parse_mailbox(struct Context *ctx) if (ctx->mailbox->msg_count == ctx->mailbox->hdrmax) mx_alloc_memory(ctx->mailbox); - hdr = mutt_header_new(); + hdr = mutt_email_new(); ctx->mailbox->hdrs[ctx->mailbox->msg_count] = hdr; hdr->offset = loc; hdr->index = ctx->mailbox->msg_count; @@ -362,7 +362,7 @@ static int mbox_parse_mailbox(struct Context *ctx) struct stat sb; char buf[HUGE_STRING], return_path[STRING]; - struct Header *curhdr = NULL; + struct Email *curhdr = NULL; time_t t; int count = 0, lines = 0; LOFF_T loc; @@ -397,7 +397,7 @@ static int mbox_parse_mailbox(struct Context *ctx) /* Save the Content-Length of the previous message */ if (count > 0) { - struct Header *h = ctx->mailbox->hdrs[ctx->mailbox->msg_count - 1]; + struct Email *h = ctx->mailbox->hdrs[ctx->mailbox->msg_count - 1]; if (h->content->length < 0) { h->content->length = loc - h->content->offset - 1; @@ -419,7 +419,7 @@ static int mbox_parse_mailbox(struct Context *ctx) if (ctx->mailbox->msg_count == ctx->mailbox->hdrmax) mx_alloc_memory(ctx->mailbox); - ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_header_new(); + ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_email_new(); curhdr = ctx->mailbox->hdrs[ctx->mailbox->msg_count]; curhdr->received = t - mutt_date_local_tz(t); curhdr->offset = loc; @@ -523,7 +523,7 @@ static int mbox_parse_mailbox(struct Context *ctx) */ if (count > 0) { - struct Header *h = ctx->mailbox->hdrs[ctx->mailbox->msg_count - 1]; + struct Email *h = ctx->mailbox->hdrs[ctx->mailbox->msg_count - 1]; if (h->content->length < 0) { h->content->length = ftello(mdata->fp) - h->content->offset - 1; @@ -559,8 +559,8 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) if (!mdata) return -1; - bool (*cmp_headers)(const struct Header *, const struct Header *) = NULL; - struct Header **old_hdrs = NULL; + bool (*cmp_headers)(const struct Email *, const struct Email *) = NULL; + struct Email **old_hdrs = NULL; int old_msgcount; bool msg_mod = false; bool index_hint_set; @@ -596,7 +596,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) if (ctx->mailbox->readonly) { for (i = 0; i < ctx->mailbox->msg_count; i++) - mutt_header_free(&(ctx->mailbox->hdrs[i])); /* nothing to do! */ + mutt_email_free(&(ctx->mailbox->hdrs[i])); /* nothing to do! */ FREE(&ctx->mailbox->hdrs); } else @@ -625,7 +625,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) { case MUTT_MBOX: case MUTT_MMDF: - cmp_headers = mutt_header_cmp_strict; + cmp_headers = mutt_email_cmp_strict; mutt_file_fclose(&mdata->fp); mdata->fp = mutt_file_fopen(ctx->mailbox->path, "r"); if (!mdata->fp) @@ -644,7 +644,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) { /* free the old headers */ for (j = 0; j < old_msgcount; j++) - mutt_header_free(&(old_hdrs[j])); + mutt_email_free(&(old_hdrs[j])); FREE(&old_hdrs); ctx->mailbox->quiet = false; @@ -714,7 +714,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_TAG, old_hdrs[j]->tagged); /* we don't need this header any more */ - mutt_header_free(&(old_hdrs[j])); + mutt_email_free(&(old_hdrs[j])); } } @@ -723,7 +723,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) { if (old_hdrs[j]) { - mutt_header_free(&(old_hdrs[j])); + mutt_email_free(&(old_hdrs[j])); msg_mod = true; } } @@ -1415,7 +1415,7 @@ static int mbox_msg_open(struct Context *ctx, struct Message *msg, int msgno) * mbox_msg_open_new - Implements MxOps::msg_open_new() * @retval 0 Always */ -static int mbox_msg_open_new(struct Context *ctx, struct Message *msg, struct Header *hdr) +static int mbox_msg_open_new(struct Context *ctx, struct Message *msg, struct Email *hdr) { struct MboxData *mdata = get_mboxdata(ctx->mailbox); if (!mdata) diff --git a/menu.c b/menu.c index 945b88a26..f14861009 100644 --- a/menu.c +++ b/menu.c @@ -79,7 +79,7 @@ static int get_color(int index, unsigned char *s) { struct ColorLineHead *color = NULL; struct ColorLine *np = NULL; - struct Header *hdr = Context->mailbox->hdrs[Context->mailbox->v2r[index]]; + struct Email *hdr = Context->mailbox->hdrs[Context->mailbox->v2r[index]]; int type = *s; switch (type) diff --git a/mutt_attach.c b/mutt_attach.c index 7d3183cca..d335e73c5 100644 --- a/mutt_attach.c +++ b/mutt_attach.c @@ -374,7 +374,7 @@ void mutt_check_lookup_list(struct Body *b, char *type, size_t len) * attachment this way will block the main neomutt process until the viewer process * exits. */ -int mutt_view_attachment(FILE *fp, struct Body *a, int flag, struct Header *hdr, +int mutt_view_attachment(FILE *fp, struct Body *a, int flag, struct Email *hdr, struct AttachCtx *actx) { char tempfile[PATH_MAX] = ""; @@ -777,7 +777,7 @@ static FILE *save_attachment_open(char *path, int flags) * @retval 0 Success * @retval -1 Error */ -int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct Header *hdr) +int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct Email *hdr) { if (!m) return -1; @@ -796,7 +796,7 @@ int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct int chflags = 0; int r = -1; - struct Header *hn = m->hdr; + struct Email *hn = m->hdr; hn->msgno = hdr->msgno; /* required for MH/maildir */ hn->read = true; @@ -907,7 +907,7 @@ int mutt_decode_save_attachment(FILE *fp, struct Body *m, char *path, int displa struct State s = { 0 }; unsigned int saved_encoding = 0; struct Body *saved_parts = NULL; - struct Header *saved_hdr = NULL; + struct Email *saved_hdr = NULL; int rc = 0; s.flags = displaying; @@ -977,7 +977,7 @@ int mutt_decode_save_attachment(FILE *fp, struct Body *m, char *path, int displa m->encoding = saved_encoding; if (saved_parts) { - mutt_header_free(&m->hdr); + mutt_email_free(&m->hdr); m->parts = saved_parts; m->hdr = saved_hdr; } diff --git a/mutt_attach.h b/mutt_attach.h index decae3717..1f4e277db 100644 --- a/mutt_attach.h +++ b/mutt_attach.h @@ -30,21 +30,21 @@ struct AttachCtx; struct Menu; -struct Header; +struct Email; struct Body; int mutt_tag_attach(struct Menu *menu, int n, int m); -int mutt_attach_display_loop(struct Menu *menu, int op, struct Header *hdr, +int mutt_attach_display_loop(struct Menu *menu, int op, struct Email *hdr, struct AttachCtx *actx, bool recv); void mutt_save_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, - struct Body *top, struct Header *hdr, struct Menu *menu); + struct Body *top, struct Email *hdr, struct Menu *menu); void mutt_pipe_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top, bool filter); void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top); -int mutt_view_attachment(FILE *fp, struct Body *a, int flag, struct Header *hdr, struct AttachCtx *actx); +int mutt_view_attachment(FILE *fp, struct Body *a, int flag, struct Email *hdr, struct AttachCtx *actx); void mutt_check_lookup_list(struct Body *b, char *type, size_t len); int mutt_compose_attachment(struct Body *a); @@ -53,6 +53,6 @@ int mutt_edit_attachment(struct Body *a); int mutt_get_tmp_attachment(struct Body *a); int mutt_pipe_attachment(FILE *fp, struct Body *b, const char *path, char *outfile); int mutt_print_attachment(FILE *fp, struct Body *a); -int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct Header *hdr); +int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct Email *hdr); #endif /* MUTT_MUTT_ATTACH_H */ diff --git a/mutt_header.c b/mutt_header.c index b39b64375..9c9e59650 100644 --- a/mutt_header.c +++ b/mutt_header.c @@ -93,7 +93,7 @@ static void label_ref_inc(struct Mailbox *mailbox, char *label) * @param[out] new Set to true if this is a new label * @retval true If the label was added */ -static bool label_message(struct Mailbox *mailbox, struct Header *hdr, char *new) +static bool label_message(struct Mailbox *mailbox, struct Email *hdr, char *new) { if (!hdr) return false; @@ -118,7 +118,7 @@ static bool label_message(struct Mailbox *mailbox, struct Header *hdr, char *new * * If hdr isn't given, then tagged messages will be labelled. */ -int mutt_label_message(struct Header *hdr) +int mutt_label_message(struct Email *hdr) { char buf[LONG_STRING], *new = NULL; int changed; @@ -156,7 +156,7 @@ int mutt_label_message(struct Header *hdr) if (!message_is_tagged(Context, i)) continue; - struct Header *h = Context->mailbox->hdrs[i]; + struct Email *h = Context->mailbox->hdrs[i]; if (label_message(Context->mailbox, h, new)) { changed++; @@ -177,7 +177,7 @@ int mutt_label_message(struct Header *hdr) * @param fcc Buffer for the fcc field * @param fcclen Length of buffer */ -void mutt_edit_headers(const char *editor, const char *body, struct Header *msg, +void mutt_edit_headers(const char *editor, const char *body, struct Email *msg, char *fcc, size_t fcclen) { char path[PATH_MAX]; /* tempfile used to edit headers + body */ @@ -380,7 +380,7 @@ void mutt_make_label_hash(struct Mailbox *mailbox) * @param mailbox Mailbox * @param hdr Header of message */ -void mutt_label_hash_add(struct Mailbox *mailbox, struct Header *hdr) +void mutt_label_hash_add(struct Mailbox *mailbox, struct Email *hdr) { if (!mailbox || !mailbox->label_hash) return; @@ -393,7 +393,7 @@ void mutt_label_hash_add(struct Mailbox *mailbox, struct Header *hdr) * @param mailbox Mailbox * @param hdr Header of message */ -void mutt_label_hash_remove(struct Mailbox *mailbox, struct Header *hdr) +void mutt_label_hash_remove(struct Mailbox *mailbox, struct Email *hdr) { if (!mailbox || !mailbox->label_hash) return; diff --git a/mutt_header.h b/mutt_header.h index 34356833b..32c842f85 100644 --- a/mutt_header.h +++ b/mutt_header.h @@ -26,12 +26,12 @@ #include struct Context; -struct Header; +struct Email; -void mutt_edit_headers(const char *editor, const char *body, struct Header *msg, char *fcc, size_t fcclen); -void mutt_label_hash_add(struct Mailbox *mailbox, struct Header *hdr); -void mutt_label_hash_remove(struct Mailbox *mailbox, struct Header *hdr); -int mutt_label_message(struct Header *hdr); +void mutt_edit_headers(const char *editor, const char *body, struct Email *msg, char *fcc, size_t fcclen); +void mutt_label_hash_add(struct Mailbox *mailbox, struct Email *hdr); +void mutt_label_hash_remove(struct Mailbox *mailbox, struct Email *hdr); +int mutt_label_message(struct Email *hdr); void mutt_make_label_hash(struct Mailbox *mailbox); #endif /* MUTT_MUTT_HEADER_H */ diff --git a/mutt_parse.c b/mutt_parse.c index f61e788c1..57c9ad413 100644 --- a/mutt_parse.c +++ b/mutt_parse.c @@ -41,7 +41,7 @@ struct Context; * @param ctx Mailbox * @param cur Header of email */ -void mutt_parse_mime_message(struct Context *ctx, struct Header *cur) +void mutt_parse_mime_message(struct Context *ctx, struct Email *cur) { struct Message *msg = NULL; @@ -211,7 +211,7 @@ static int count_body_parts(struct Body *body, int flags) * @param hdr Header of email * @retval num Number of MIME Body parts */ -int mutt_count_body_parts(struct Context *ctx, struct Header *hdr) +int mutt_count_body_parts(struct Context *ctx, struct Email *hdr) { bool keep_parts = false; diff --git a/mutt_parse.h b/mutt_parse.h index 509aaafa4..4e7c831b3 100644 --- a/mutt_parse.h +++ b/mutt_parse.h @@ -24,9 +24,9 @@ #define MUTT_MUTT_PARSE_H struct Context; -struct Header; +struct Email; -int mutt_count_body_parts(struct Context *ctx, struct Header *hdr); -void mutt_parse_mime_message(struct Context *ctx, struct Header *cur); +int mutt_count_body_parts(struct Context *ctx, struct Email *hdr); +void mutt_parse_mime_message(struct Context *ctx, struct Email *cur); #endif /* MUTT_MUTT_PARSE_H */ diff --git a/mutt_thread.c b/mutt_thread.c index f9d44f4b0..b2483b24d 100644 --- a/mutt_thread.c +++ b/mutt_thread.c @@ -56,7 +56,7 @@ bool ThreadReceived; ///< Config: Sort threaded messages by their received date * @param ctx Mailbox * @retval true If the message is not hidden in some way */ -static bool is_visible(struct Header *hdr, struct Context *ctx) +static bool is_visible(struct Email *hdr, struct Context *ctx) { return hdr->virtual >= 0 || (hdr->collapsed && (!ctx->pattern || hdr->limited)); } @@ -67,7 +67,7 @@ static bool is_visible(struct Header *hdr, struct Context *ctx) * @param hdr Header of email * @retval true If the subject should be displayed */ -bool need_display_subject(struct Context *ctx, struct Header *hdr) +bool need_display_subject(struct Context *ctx, struct Email *hdr) { struct MuttThread *tmp = NULL, *tree = hdr->thread; @@ -118,7 +118,7 @@ bool need_display_subject(struct Context *ctx, struct Header *hdr) static void linearize_tree(struct Context *ctx) { struct MuttThread *tree = ctx->tree; - struct Header **array = + struct Email **array = ctx->mailbox->hdrs + ((Sort & SORT_REVERSE) ? ctx->mailbox->msg_count - 1 : 0); while (tree) @@ -464,7 +464,7 @@ static struct MuttThread *find_subject(struct Context *ctx, struct MuttThread *c { for (ptr = mutt_hash_find_bucket(ctx->mailbox->subj_hash, np->data); ptr; ptr = ptr->next) { - tmp = ((struct Header *) ptr->data)->thread; + tmp = ((struct Email *) ptr->data)->thread; if (tmp != cur && /* don't match the same message */ !tmp->fake_thread && /* don't match pseudo threads */ tmp->message->subject_changed && /* only match interesting replies */ @@ -495,7 +495,7 @@ static struct Hash *make_subj_hash(struct Context *ctx) for (int i = 0; i < ctx->mailbox->msg_count; i++) { - struct Header *hdr = ctx->mailbox->hdrs[i]; + struct Email *hdr = ctx->mailbox->hdrs[i]; if (hdr->env->real_subj) mutt_hash_insert(hash, hdr->env->real_subj, hdr); } @@ -627,7 +627,7 @@ static int compare_threads(const void *a, const void *b) struct MuttThread *mutt_sort_subthreads(struct MuttThread *thread, bool init) { struct MuttThread **array = NULL, *sort_key = NULL, *top = NULL, *tmp = NULL; - struct Header *oldsort_key = NULL; + struct Email *oldsort_key = NULL; int i, array_size, sort_top = 0; /* we put things into the array backwards to save some cycles, @@ -762,7 +762,7 @@ struct MuttThread *mutt_sort_subthreads(struct MuttThread *thread, bool init) */ static void check_subjects(struct Context *ctx, bool init) { - struct Header *cur = NULL; + struct Email *cur = NULL; struct MuttThread *tmp = NULL; for (int i = 0; i < ctx->mailbox->msg_count; i++) { @@ -801,7 +801,7 @@ static void check_subjects(struct Context *ctx, bool init) */ void mutt_sort_threads(struct Context *ctx, bool init) { - struct Header *cur = NULL; + struct Email *cur = NULL; int i, oldsort, using_refs = 0; struct MuttThread *thread = NULL, *new = NULL, *tmp = NULL, top; memset(&top, 0, sizeof(top)); @@ -1040,10 +1040,10 @@ void mutt_sort_threads(struct Context *ctx, bool init) * @param subthreads Search subthreads: 'true' subthread, 'false' not * @retval num Index into the virtual email table */ -int mutt_aside_thread(struct Header *hdr, bool forwards, bool subthreads) +int mutt_aside_thread(struct Email *hdr, bool forwards, bool subthreads) { struct MuttThread *cur = NULL; - struct Header *tmp = NULL; + struct Email *tmp = NULL; if ((Sort & SORT_MASK) != SORT_THREADS) { @@ -1104,10 +1104,10 @@ int mutt_aside_thread(struct Header *hdr, bool forwards, bool subthreads) * @retval >=0 Virtual index number of parent/root message * @retval -1 Error */ -int mutt_parent_message(struct Context *ctx, struct Header *hdr, bool find_root) +int mutt_parent_message(struct Context *ctx, struct Email *hdr, bool find_root) { struct MuttThread *thread = NULL; - struct Header *parent = NULL; + struct Email *parent = NULL; if ((Sort & SORT_MASK) != SORT_THREADS) { @@ -1152,7 +1152,7 @@ int mutt_parent_message(struct Context *ctx, struct Header *hdr, bool find_root) */ void mutt_set_virtual(struct Context *ctx) { - struct Header *cur = NULL; + struct Email *cur = NULL; ctx->mailbox->vcount = 0; ctx->vsize = 0; @@ -1180,10 +1180,10 @@ void mutt_set_virtual(struct Context *ctx) * @param flag Flag to set, e.g. #MUTT_THREAD_NEXT_UNREAD * @retval num Number of matches */ -int mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag) +int mutt_traverse_thread(struct Context *ctx, struct Email *cur, int flag) { struct MuttThread *thread = NULL, *top = NULL; - struct Header *roothdr = NULL; + struct Email *roothdr = NULL; int final, reverse = (Sort & SORT_REVERSE), minmsgno; int num_hidden = 0, new = 0, old = 0; bool flagged = false; @@ -1355,7 +1355,7 @@ int mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag) * If flag is 0, we want to know how many messages are in the thread. * If flag is 1, we want to know our position in the thread. */ -int mutt_messages_in_thread(struct Context *ctx, struct Header *hdr, int flag) +int mutt_messages_in_thread(struct Context *ctx, struct Email *hdr, int flag) { struct MuttThread *threads[2]; int rc; @@ -1400,7 +1400,7 @@ struct Hash *mutt_make_id_hash(struct Mailbox *mailbox) for (int i = 0; i < mailbox->msg_count; i++) { - struct Header *hdr = mailbox->hdrs[i]; + struct Email *hdr = mailbox->hdrs[i]; if (hdr->env->message_id) mutt_hash_insert(hash, hdr->env->message_id, hdr); } @@ -1415,7 +1415,7 @@ struct Hash *mutt_make_id_hash(struct Mailbox *mailbox) * @param ctx Mailbox * @retval true On success */ -static bool link_threads(struct Header *parent, struct Header *child, struct Context *ctx) +static bool link_threads(struct Email *parent, struct Email *child, struct Context *ctx) { if (child == parent) return false; @@ -1438,7 +1438,7 @@ static bool link_threads(struct Header *parent, struct Header *child, struct Con * * if last is omitted, all the tagged threads will be used. */ -int mutt_link_threads(struct Header *cur, struct Header *last, struct Context *ctx) +int mutt_link_threads(struct Email *cur, struct Email *last, struct Context *ctx) { bool changed = false; diff --git a/mutt_thread.h b/mutt_thread.h index a4d953dd0..edb07c542 100644 --- a/mutt_thread.h +++ b/mutt_thread.h @@ -26,7 +26,7 @@ #include struct Context; -struct Header; +struct Email; struct Mailbox; struct MuttThread; @@ -49,13 +49,13 @@ extern bool ThreadReceived; #define MUTT_THREAD_NEXT_UNREAD (1 << 4) #define MUTT_THREAD_FLAGGED (1 << 5) -int mutt_aside_thread(struct Header *hdr, bool forwards, bool subthreads); +int mutt_aside_thread(struct Email *hdr, bool forwards, bool subthreads); #define mutt_next_thread(x) mutt_aside_thread(x, true, false) #define mutt_previous_thread(x) mutt_aside_thread(x, false, false) #define mutt_next_subthread(x) mutt_aside_thread(x, true, true) #define mutt_previous_subthread(x) mutt_aside_thread(x, false, true) -int mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag); +int mutt_traverse_thread(struct Context *ctx, struct Email *cur, int flag); #define mutt_collapse_thread(x, y) mutt_traverse_thread(x, y, MUTT_THREAD_COLLAPSE) #define mutt_uncollapse_thread(x, y) mutt_traverse_thread(x, y, MUTT_THREAD_UNCOLLAPSE) #define mutt_get_hidden(x, y) mutt_traverse_thread(x, y, MUTT_THREAD_GET_HIDDEN) @@ -63,14 +63,14 @@ int mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag); #define mutt_thread_contains_flagged(x, y) mutt_traverse_thread(x, y, MUTT_THREAD_FLAGGED) #define mutt_thread_next_unread(x, y) mutt_traverse_thread(x, y, MUTT_THREAD_NEXT_UNREAD) -int mutt_link_threads(struct Header *cur, struct Header *last, struct Context *ctx); -int mutt_messages_in_thread(struct Context *ctx, struct Header *hdr, int flag); +int mutt_link_threads(struct Email *cur, struct Email *last, struct Context *ctx); +int mutt_messages_in_thread(struct Context *ctx, struct Email *hdr, int flag); void mutt_draw_tree(struct Context *ctx); void mutt_clear_threads(struct Context *ctx); struct MuttThread *mutt_sort_subthreads(struct MuttThread *thread, bool init); void mutt_sort_threads(struct Context *ctx, bool init); -int mutt_parent_message(struct Context *ctx, struct Header *hdr, bool find_root); +int mutt_parent_message(struct Context *ctx, struct Email *hdr, bool find_root); void mutt_set_virtual(struct Context *ctx); struct Hash *mutt_make_id_hash(struct Mailbox *mailbox); diff --git a/muttlib.c b/muttlib.c index 9d0842653..08514d0ad 100644 --- a/muttlib.c +++ b/muttlib.c @@ -219,14 +219,14 @@ char *mutt_expand_path_regex(char *buf, size_t buflen, bool regex) struct Address *alias = mutt_alias_lookup(buf + 1); if (alias) { - struct Header *h = mutt_header_new(); + struct Email *h = mutt_email_new(); h->env = mutt_env_new(); h->env->from = alias; h->env->to = alias; mutt_default_save(p, sizeof(p), h); h->env->from = NULL; h->env->to = NULL; - mutt_header_free(&h); + mutt_email_free(&h); /* Avoid infinite recursion if the resulting folder starts with '@' */ if (*p != '@') recurse = true; diff --git a/mx.c b/mx.c index 41643e6f7..c5565a86f 100644 --- a/mx.c +++ b/mx.c @@ -359,7 +359,7 @@ void mx_fastclose_mailbox(struct Context *ctx) mutt_hash_destroy(&ctx->mailbox->label_hash); mutt_clear_threads(ctx); for (int i = 0; i < ctx->mailbox->msg_count; i++) - mutt_header_free(&ctx->mailbox->hdrs[i]); + mutt_email_free(&ctx->mailbox->hdrs[i]); FREE(&ctx->mailbox->hdrs); FREE(&ctx->mailbox->v2r); FREE(&ctx->pattern); @@ -856,7 +856,7 @@ void mx_update_tables(struct Context *ctx, bool committing) */ if (ctx->last_tag == ctx->mailbox->hdrs[i]) ctx->last_tag = NULL; - mutt_header_free(&ctx->mailbox->hdrs[i]); + mutt_email_free(&ctx->mailbox->hdrs[i]); } } ctx->mailbox->msg_count = j; @@ -999,7 +999,7 @@ int mx_mbox_sync(struct Context *ctx, int *index_hint) * @param flags Flags, e.g. #MUTT_SET_DRAFT * @retval ptr New Message */ -struct Message *mx_msg_open_new(struct Context *ctx, struct Header *hdr, int flags) +struct Message *mx_msg_open_new(struct Context *ctx, struct Email *hdr, int flags) { struct Address *p = NULL; struct Message *msg = NULL; @@ -1152,7 +1152,7 @@ int mx_msg_close(struct Context *ctx, struct Message **msg) */ void mx_alloc_memory(struct Mailbox *mailbox) { - size_t s = MAX(sizeof(struct Header *), sizeof(int)); + size_t s = MAX(sizeof(struct Email *), sizeof(int)); if ((mailbox->hdrmax + 25) * s < mailbox->hdrmax * s) { @@ -1162,12 +1162,12 @@ void mx_alloc_memory(struct Mailbox *mailbox) if (mailbox->hdrs) { - mutt_mem_realloc(&mailbox->hdrs, sizeof(struct Header *) * (mailbox->hdrmax += 25)); + mutt_mem_realloc(&mailbox->hdrs, sizeof(struct Email *) * (mailbox->hdrmax += 25)); mutt_mem_realloc(&mailbox->v2r, sizeof(int) * mailbox->hdrmax); } else { - mailbox->hdrs = mutt_mem_calloc((mailbox->hdrmax += 25), sizeof(struct Header *)); + mailbox->hdrs = mutt_mem_calloc((mailbox->hdrmax += 25), sizeof(struct Email *)); mailbox->v2r = mutt_mem_calloc(mailbox->hdrmax, sizeof(int)); } for (int i = mailbox->msg_count; i < mailbox->hdrmax; i++) @@ -1187,7 +1187,7 @@ void mx_alloc_memory(struct Mailbox *mailbox) */ void mx_update_context(struct Context *ctx, int new_messages) { - struct Header *h = NULL; + struct Email *h = NULL; for (int msgno = ctx->mailbox->msg_count - new_messages; msgno < ctx->mailbox->msg_count; msgno++) { @@ -1210,7 +1210,7 @@ void mx_update_context(struct Context *ctx, int new_messages) if (h->env->supersedes) { - struct Header *h2 = NULL; + struct Email *h2 = NULL; if (!ctx->mailbox->id_hash) ctx->mailbox->id_hash = mutt_make_id_hash(ctx->mailbox); @@ -1311,7 +1311,7 @@ int mx_tags_edit(struct Context *ctx, const char *tags, char *buf, size_t buflen * @retval 0 Success * @retval -1 Failure */ -int mx_tags_commit(struct Context *ctx, struct Header *hdr, char *tags) +int mx_tags_commit(struct Context *ctx, struct Email *hdr, char *tags) { if (ctx->mailbox->mx_ops->tags_commit) return ctx->mailbox->mx_ops->tags_commit(ctx, hdr, tags); @@ -1441,14 +1441,14 @@ int mx_path_canon(char *buf, size_t buflen, const char *folder) if (!alias) break; - struct Header *h = mutt_header_new(); + struct Email *h = mutt_email_new(); h->env = mutt_env_new(); h->env->from = alias; h->env->to = alias; mutt_default_save(buf, buflen, h); h->env->from = NULL; h->env->to = NULL; - mutt_header_free(&h); + mutt_email_free(&h); break; } else diff --git a/mx.h b/mx.h index d3fbae7e4..6e2244e1f 100644 --- a/mx.h +++ b/mx.h @@ -32,7 +32,7 @@ #include "hcache/hcache.h" #endif -struct Header; +struct Email; struct Context; struct Mailbox; struct stat; @@ -155,7 +155,7 @@ struct MxOps * @retval 0 Success * @retval -1 Failure */ - int (*msg_open_new) (struct Context *ctx, struct Message *msg, struct Header *hdr); + int (*msg_open_new) (struct Context *ctx, struct Message *msg, struct Email *hdr); /** * msg_commit - Save changes to an email * @param ctx Mailbox @@ -197,7 +197,7 @@ struct MxOps * @retval 0 Success * @retval -1 Failure */ - int (*tags_commit) (struct Context *ctx, struct Header *hdr, char *buf); + int (*tags_commit) (struct Context *ctx, struct Email *hdr, char *buf); /** * path_probe - Does this mailbox type recognise this path? * @param path Path to examine @@ -240,14 +240,14 @@ struct Context *mx_mbox_open (const char *path, int flags); int mx_mbox_sync (struct Context *ctx, int *index_hint); int mx_msg_close (struct Context *ctx, struct Message **msg); int mx_msg_commit (struct Context *ctx, struct Message *msg); -struct Message *mx_msg_open_new (struct Context *ctx, struct Header *hdr, int flags); +struct Message *mx_msg_open_new (struct Context *ctx, struct Email *hdr, int flags); struct Message *mx_msg_open (struct Context *ctx, int msgno); int mx_msg_padding_size(struct Context *ctx); int mx_path_canon (char *buf, size_t buflen, const char *folder); int mx_path_parent (char *buf, size_t buflen); int mx_path_pretty (char *buf, size_t buflen, const char *folder); int mx_path_probe (const char *path, const struct stat *st); -int mx_tags_commit (struct Context *ctx, struct Header *hdr, char *tags); +int mx_tags_commit (struct Context *ctx, struct Email *hdr, char *tags); int mx_tags_edit (struct Context *ctx, const char *tags, char *buf, size_t buflen); int mx_access(const char *path, int flags); diff --git a/ncrypt/crypt.c b/ncrypt/crypt.c index 3b2d04528..e515448ed 100644 --- a/ncrypt/crypt.c +++ b/ncrypt/crypt.c @@ -165,7 +165,7 @@ int crypt_valid_passphrase(int flags) * @retval 0 Success * @retval -1 Error */ -int mutt_protect(struct Header *msg, char *keylist) +int mutt_protect(struct Email *msg, char *keylist) { struct Body *pbody = NULL, *tmp_pbody = NULL; struct Body *tmp_smime_pbody = NULL; @@ -805,7 +805,7 @@ void crypt_convert_to_7bit(struct Body *a) * * The extracted keys will be added to the user's keyring. */ -void crypt_extract_keys_from_messages(struct Header *h) +void crypt_extract_keys_from_messages(struct Email *h) { char tempfname[PATH_MAX], *mbox = NULL; struct Address *tmp = NULL; @@ -832,7 +832,7 @@ void crypt_extract_keys_from_messages(struct Header *h) if (!message_is_tagged(Context, i)) continue; - struct Header *hi = Context->mailbox->hdrs[i]; + struct Email *hi = Context->mailbox->hdrs[i]; mutt_parse_mime_message(Context, hi); if (hi->security & ENCRYPT && !crypt_valid_passphrase(hi->security)) @@ -944,7 +944,7 @@ void crypt_extract_keys_from_messages(struct Header *h) * If oppenc_mode is true, only keys that can be determined without * prompting will be used. */ -int crypt_get_keys(struct Header *msg, char **keylist, bool oppenc_mode) +int crypt_get_keys(struct Email *msg, char **keylist, bool oppenc_mode) { struct Address *addrlist = NULL, *last = NULL; const char *fqdn = mutt_fqdn(true); @@ -1016,7 +1016,7 @@ int crypt_get_keys(struct Header *msg, char **keylist, bool oppenc_mode) * Check if all recipients keys can be automatically determined. * Enable encryption if they can, otherwise disable encryption. */ -void crypt_opportunistic_encrypt(struct Header *msg) +void crypt_opportunistic_encrypt(struct Email *msg) { char *pgpkeylist = NULL; diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 3a59d7916..7b064dfbe 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -5036,7 +5036,7 @@ void smime_gpgme_init(void) * @param is_smime True if an SMIME message * @retval num Flags, e.g. #APPLICATION_SMIME | #ENCRYPT */ -static int gpgme_send_menu(struct Header *msg, int is_smime) +static int gpgme_send_menu(struct Email *msg, int is_smime) { struct CryptKeyInfo *p = NULL; const char *prompt = NULL; @@ -5197,7 +5197,7 @@ static int gpgme_send_menu(struct Header *msg, int is_smime) /** * pgp_gpgme_send_menu - Implements CryptModuleSpecs::send_menu() */ -int pgp_gpgme_send_menu(struct Header *msg) +int pgp_gpgme_send_menu(struct Email *msg) { return gpgme_send_menu(msg, 0); } @@ -5205,7 +5205,7 @@ int pgp_gpgme_send_menu(struct Header *msg) /** * smime_gpgme_send_menu - Implements CryptModuleSpecs::send_menu() */ -int smime_gpgme_send_menu(struct Header *msg) +int smime_gpgme_send_menu(struct Email *msg) { return gpgme_send_menu(msg, 1); } @@ -5215,7 +5215,7 @@ int smime_gpgme_send_menu(struct Header *msg) * @param h Header of the email * @retval true If sender is verified */ -static bool verify_sender(struct Header *h) +static bool verify_sender(struct Email *h) { struct Address *sender = NULL; bool rc = true; @@ -5292,7 +5292,7 @@ static bool verify_sender(struct Header *h) /** * smime_gpgme_verify_sender - Implements CryptModuleSpecs::smime_verify_sender() */ -int smime_gpgme_verify_sender(struct Header *h) +int smime_gpgme_verify_sender(struct Email *h) { return verify_sender(h); } diff --git a/ncrypt/crypt_gpgme.h b/ncrypt/crypt_gpgme.h index 1ae26bce3..292ab8bcd 100644 --- a/ncrypt/crypt_gpgme.h +++ b/ncrypt/crypt_gpgme.h @@ -28,7 +28,7 @@ struct Address; struct Body; -struct Header; +struct Email; struct State; void pgp_gpgme_set_sender(const char *sender); @@ -42,7 +42,7 @@ char * pgp_gpgme_find_keys(struct Address *addrlist, bool oppenc_mode); void pgp_gpgme_init(void); void pgp_gpgme_invoke_import(const char *fname); struct Body *pgp_gpgme_make_key_attachment(void); -int pgp_gpgme_send_menu(struct Header *msg); +int pgp_gpgme_send_menu(struct Email *msg); struct Body *pgp_gpgme_sign_message(struct Body *a); int pgp_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile); @@ -51,10 +51,10 @@ struct Body *smime_gpgme_build_smime_entity(struct Body *a, char *keylist); int smime_gpgme_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur); char * smime_gpgme_find_keys(struct Address *addrlist, bool oppenc_mode); void smime_gpgme_init(void); -int smime_gpgme_send_menu(struct Header *msg); +int smime_gpgme_send_menu(struct Email *msg); struct Body *smime_gpgme_sign_message(struct Body *a); int smime_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile); -int smime_gpgme_verify_sender(struct Header *h); +int smime_gpgme_verify_sender(struct Email *h); const char *mutt_gpgme_print_version(void); diff --git a/ncrypt/crypt_mod.h b/ncrypt/crypt_mod.h index df962ff10..6a711bc0d 100644 --- a/ncrypt/crypt_mod.h +++ b/ncrypt/crypt_mod.h @@ -29,7 +29,7 @@ struct Address; struct Body; struct Envelope; -struct Header; +struct Email; struct State; /** @@ -116,7 +116,7 @@ struct CryptModuleSpecs * @param msg Header of the email * @retval num Flags, e.g. #APPLICATION_PGP | #ENCRYPT */ - int (*send_menu)(struct Header *msg); + int (*send_menu)(struct Email *msg); /** * set_sender - Set the sender of the email * @param sender Email address @@ -186,7 +186,7 @@ struct CryptModuleSpecs * @retval 0 Success * @retval 1 Failure */ - int (*smime_verify_sender)(struct Header *h); + int (*smime_verify_sender)(struct Email *h); /** * smime_build_smime_entity - Encrypt the email body to all recipients * @param a Body of email diff --git a/ncrypt/cryptglue.c b/ncrypt/cryptglue.c index 1e6ef6b82..2a3a745d5 100644 --- a/ncrypt/cryptglue.c +++ b/ncrypt/cryptglue.c @@ -46,7 +46,7 @@ struct Address; struct Body; struct Envelope; -struct Header; +struct Email; struct State; /* These Config Variables are only used in ncrypt/cryptglue.c */ @@ -321,7 +321,7 @@ int crypt_pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempf /** * crypt_pgp_send_menu - Wrapper for CryptModuleSpecs::send_menu() */ -int crypt_pgp_send_menu(struct Header *msg) +int crypt_pgp_send_menu(struct Email *msg) { if (CRYPT_MOD_CALL_CHECK(PGP, send_menu)) return CRYPT_MOD_CALL(PGP, send_menu)(msg); @@ -412,7 +412,7 @@ void crypt_smime_getkeys(struct Envelope *env) /** * crypt_smime_verify_sender - Wrapper for CryptModuleSpecs::smime_verify_sender() */ -int crypt_smime_verify_sender(struct Header *h) +int crypt_smime_verify_sender(struct Email *h) { if (CRYPT_MOD_CALL_CHECK(SMIME, smime_verify_sender)) return CRYPT_MOD_CALL(SMIME, smime_verify_sender)(h); @@ -476,7 +476,7 @@ int crypt_smime_verify_one(struct Body *sigbdy, struct State *s, const char *tem /** * crypt_smime_send_menu - Wrapper for CryptModuleSpecs::send_menu() */ -int crypt_smime_send_menu(struct Header *msg) +int crypt_smime_send_menu(struct Email *msg) { if (CRYPT_MOD_CALL_CHECK(SMIME, send_menu)) return CRYPT_MOD_CALL(SMIME, send_menu)(msg); diff --git a/ncrypt/ncrypt.h b/ncrypt/ncrypt.h index 92296336a..9b3a02f74 100644 --- a/ncrypt/ncrypt.h +++ b/ncrypt/ncrypt.h @@ -55,7 +55,7 @@ struct Address; struct Body; struct Envelope; -struct Header; +struct Email; struct State; /* These Config Variables are only used in ncrypt/crypt.c */ @@ -178,10 +178,10 @@ extern char *SmimeVerifyOpaqueCommand; #define KEYFLAG_ABILITIES (KEYFLAG_CANSIGN | KEYFLAG_CANENCRYPT | KEYFLAG_PREFER_ENCRYPTION | KEYFLAG_PREFER_SIGNING) /* crypt.c */ -void crypt_extract_keys_from_messages(struct Header *h); +void crypt_extract_keys_from_messages(struct Email *h); void crypt_forget_passphrase(void); -int crypt_get_keys(struct Header *msg, char **keylist, bool oppenc_mode); -void crypt_opportunistic_encrypt(struct Header *msg); +int crypt_get_keys(struct Email *msg, char **keylist, bool oppenc_mode); +void crypt_opportunistic_encrypt(struct Email *msg); int crypt_query(struct Body *m); int crypt_valid_passphrase(int flags); int mutt_is_application_pgp(struct Body *m); @@ -190,7 +190,7 @@ int mutt_is_malformed_multipart_pgp_encrypted(struct Body *b); int mutt_is_multipart_encrypted(struct Body *b); int mutt_is_multipart_signed(struct Body *b); int mutt_is_valid_multipart_pgp_encrypted(struct Body *b); -int mutt_protect(struct Header *msg, char *keylist); +int mutt_protect(struct Email *msg, char *keylist); int mutt_signed_handler(struct Body *a, struct State *s); /* cryptglue.c */ @@ -204,12 +204,12 @@ int crypt_pgp_encrypted_handler(struct Body *a, struct State *s); void crypt_pgp_extract_key_from_attachment(FILE *fp, struct Body *top); void crypt_pgp_invoke_getkeys(struct Address *addr); struct Body *crypt_pgp_make_key_attachment(void); -int crypt_pgp_send_menu(struct Header *msg); +int crypt_pgp_send_menu(struct Email *msg); int crypt_smime_application_handler(struct Body *m, struct State *s); int crypt_smime_decrypt_mime(FILE *a, FILE **b, struct Body *c, struct Body **d); void crypt_smime_getkeys(struct Envelope *env); -int crypt_smime_send_menu(struct Header *msg); -int crypt_smime_verify_sender(struct Header *h); +int crypt_smime_send_menu(struct Email *msg); +int crypt_smime_verify_sender(struct Email *h); /* crypt_mod.c */ void crypto_module_free(void); diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 2d5ae827e..b362bba40 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -1808,7 +1808,7 @@ struct Body *pgp_class_traditional_encryptsign(struct Body *a, int flags, char * /** * pgp_class_send_menu - Implements CryptModuleSpecs::send_menu() */ -int pgp_class_send_menu(struct Header *msg) +int pgp_class_send_menu(struct Email *msg) { struct PgpKeyInfo *p = NULL; const char *prompt = NULL; diff --git a/ncrypt/pgp.h b/ncrypt/pgp.h index eed48e77a..1956a4965 100644 --- a/ncrypt/pgp.h +++ b/ncrypt/pgp.h @@ -30,7 +30,7 @@ struct Address; struct Body; -struct Header; +struct Email; struct PgpKeyInfo; struct State; @@ -59,6 +59,6 @@ struct Body *pgp_class_traditional_encryptsign(struct Body *a, int flags, char * struct Body *pgp_class_encrypt_message(struct Body *a, char *keylist, bool sign); struct Body *pgp_class_sign_message(struct Body *a); -int pgp_class_send_menu(struct Header *msg); +int pgp_class_send_menu(struct Email *msg); #endif /* MUTT_NCRYPT_PGP_H */ diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 34fe05845..032c1a078 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -1427,7 +1427,7 @@ void smime_class_invoke_import(char *infile, char *mailbox) /** * smime_class_verify_sender - Implements CryptModuleSpecs::smime_verify_sender() */ -int smime_class_verify_sender(struct Header *h) +int smime_class_verify_sender(struct Email *h) { char *mbox = NULL, *certfile = NULL, tempfname[PATH_MAX]; int retval = 1; @@ -2285,7 +2285,7 @@ int smime_class_application_handler(struct Body *m, struct State *s) /** * smime_class_send_menu - Implements CryptModuleSpecs::send_menu() */ -int smime_class_send_menu(struct Header *msg) +int smime_class_send_menu(struct Email *msg) { struct SmimeKey *key = NULL; const char *prompt = NULL; diff --git a/ncrypt/smime.h b/ncrypt/smime.h index c2b9a2d8c..3af7c20a4 100644 --- a/ncrypt/smime.h +++ b/ncrypt/smime.h @@ -30,7 +30,7 @@ struct Address; struct Body; struct Envelope; -struct Header; +struct Email; struct State; /** @@ -53,11 +53,11 @@ int smime_class_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, char * smime_class_find_keys(struct Address *addrlist, bool oppenc_mode); void smime_class_getkeys(struct Envelope *env); void smime_class_invoke_import(char *infile, char *mailbox); -int smime_class_send_menu(struct Header *msg); +int smime_class_send_menu(struct Email *msg); struct Body *smime_class_sign_message(struct Body *a); int smime_class_valid_passphrase(void); int smime_class_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile); -int smime_class_verify_sender(struct Header *h); +int smime_class_verify_sender(struct Email *h); void smime_class_void_passphrase(void); #endif /* MUTT_NCRYPT_SMIME_H */ diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 2f8c3b8ad..3972f74e1 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -1215,7 +1215,7 @@ struct NntpServer *nntp_select_server(struct Mailbox *mailbox, char *server, boo * New = not read and not cached * Old = not read but cached */ -void nntp_article_status(struct Mailbox *mailbox, struct Header *hdr, char *group, anum_t anum) +void nntp_article_status(struct Mailbox *mailbox, struct Email *hdr, char *group, anum_t anum) { struct NntpData *nntp_data = mailbox->data; diff --git a/nntp/nntp.c b/nntp/nntp.c index 85909ed8c..351c0815f 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -890,7 +890,7 @@ static int get_description(struct NntpData *nntp_data, const char *wildmat, cons * * Update read flag and set article number if empty */ -static void nntp_parse_xref(struct Mailbox *mailbox, struct Header *hdr) +static void nntp_parse_xref(struct Mailbox *mailbox, struct Email *hdr) { struct NntpData *nntp_data = mailbox->data; @@ -975,7 +975,7 @@ static int parse_overview_line(char *line, void *data) struct FetchCtx *fc = data; struct Context *ctx = fc->ctx; struct NntpData *nntp_data = ctx->mailbox->data; - struct Header *hdr = NULL; + struct Email *hdr = NULL; char *header = NULL, *field = NULL; bool save = true; anum_t anum; @@ -1040,7 +1040,7 @@ static int parse_overview_line(char *line, void *data) mx_alloc_memory(ctx->mailbox); /* parse header */ - ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_header_new(); + ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_email_new(); hdr = ctx->mailbox->hdrs[ctx->mailbox->msg_count]; hdr->env = mutt_rfc822_read_header(fp, hdr, false, false); hdr->env->newsgroups = mutt_str_strdup(nntp_data->group); @@ -1058,7 +1058,7 @@ static int parse_overview_line(char *line, void *data) if (hdata) { mutt_debug(2, "mutt_hcache_fetch %s\n", buf); - mutt_header_free(&hdr); + mutt_email_free(&hdr); hdr = mutt_hcache_restore(hdata); ctx->mailbox->hdrs[ctx->mailbox->msg_count] = hdr; mutt_hcache_free(fc->hc, &hdata); @@ -1107,7 +1107,7 @@ static int parse_overview_line(char *line, void *data) nntp_data->last_loaded = anum; } else - mutt_header_free(&hdr); + mutt_email_free(&hdr); /* progress */ if (!ctx->mailbox->quiet) @@ -1130,7 +1130,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first, { struct NntpData *nntp_data = ctx->mailbox->data; struct FetchCtx fc; - struct Header *hdr = NULL; + struct Email *hdr = NULL; char buf[HUGE_STRING]; int rc = 0; int oldmsgcount = ctx->mailbox->msg_count; @@ -1237,7 +1237,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first, /* skip header marked as deleted in cache */ if (hdr->deleted && !restore) { - mutt_header_free(&hdr); + mutt_email_free(&hdr); if (nntp_data->bcache) { mutt_debug(2, "#2 mutt_bcache_del %s\n", buf); @@ -1303,7 +1303,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first, } /* parse header */ - ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_header_new(); + ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_email_new(); hdr = ctx->mailbox->hdrs[ctx->mailbox->msg_count]; hdr->env = mutt_rfc822_read_header(fp, hdr, false, false); hdr->received = hdr->date_sent; @@ -1440,7 +1440,7 @@ static int check_mailbox(struct Context *ctx) if (nntp_data->last_message < nntp_data->last_loaded) { for (int i = 0; i < ctx->mailbox->msg_count; i++) - mutt_header_free(&ctx->mailbox->hdrs[i]); + mutt_email_free(&ctx->mailbox->hdrs[i]); ctx->mailbox->msg_count = 0; ctx->tagged = 0; @@ -1460,7 +1460,7 @@ static int check_mailbox(struct Context *ctx) unsigned char *messages = NULL; char buf[16]; void *hdata = NULL; - struct Header *hdr = NULL; + struct Email *hdr = NULL; anum_t first = nntp_data->first_message; if (NntpContext && nntp_data->last_message - first + 1 > NntpContext) @@ -1497,13 +1497,13 @@ static int check_mailbox(struct Context *ctx) hdr->data = NULL; deleted = hdr->deleted; flagged = hdr->flagged; - mutt_header_free(&hdr); + mutt_email_free(&hdr); /* header marked as deleted, removing from context */ if (deleted) { mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_TAG, 0); - mutt_header_free(&ctx->mailbox->hdrs[i]); + mutt_email_free(&ctx->mailbox->hdrs[i]); continue; } } @@ -1545,7 +1545,7 @@ static int check_mailbox(struct Context *ctx) hdr->data = NULL; if (hdr->deleted) { - mutt_header_free(&hdr); + mutt_email_free(&hdr); if (nntp_data->bcache) { mutt_debug(2, "mutt_bcache_del %s\n", buf); @@ -2141,8 +2141,8 @@ int nntp_check_msgid(struct Context *ctx, const char *msgid) /* parse header */ if (ctx->mailbox->msg_count == ctx->mailbox->hdrmax) mx_alloc_memory(ctx->mailbox); - ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_header_new(); - struct Header *hdr = ctx->mailbox->hdrs[ctx->mailbox->msg_count]; + ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_email_new(); + struct Email *hdr = ctx->mailbox->hdrs[ctx->mailbox->msg_count]; hdr->data = mutt_mem_calloc(1, sizeof(struct NntpHeaderData)); hdr->env = mutt_rfc822_read_header(fp, hdr, false, false); mutt_file_fclose(&fp); @@ -2155,7 +2155,7 @@ int nntp_check_msgid(struct Context *ctx, const char *msgid) snprintf(buf, sizeof(buf), "STAT %s\r\n", msgid); if (nntp_query(nntp_data, buf, sizeof(buf)) < 0) { - mutt_header_free(&hdr); + mutt_email_free(&hdr); return -1; } sscanf(buf + 4, ANUM, &NHDR(hdr)->article_num); @@ -2244,8 +2244,8 @@ int nntp_check_children(struct Context *ctx, const char *msgid) */ int nntp_compare_order(const void *a, const void *b) { - struct Header **ha = (struct Header **) a; - struct Header **hb = (struct Header **) b; + struct Email **ha = (struct Email **) a; + struct Email **hb = (struct Email **) b; anum_t na = NHDR(*ha)->article_num; anum_t nb = NHDR(*hb)->article_num; @@ -2435,7 +2435,7 @@ static int nntp_mbox_sync(struct Context *ctx, int *index_hint) for (int i = 0; i < ctx->mailbox->msg_count; i++) { - struct Header *hdr = ctx->mailbox->hdrs[i]; + struct Email *hdr = ctx->mailbox->hdrs[i]; char buf[16]; snprintf(buf, sizeof(buf), "%d", NHDR(hdr)->article_num); @@ -2500,7 +2500,7 @@ static int nntp_mbox_close(struct Context *ctx) static int nntp_msg_open(struct Context *ctx, struct Message *msg, int msgno) { struct NntpData *nntp_data = ctx->mailbox->data; - struct Header *hdr = ctx->mailbox->hdrs[msgno]; + struct Email *hdr = ctx->mailbox->hdrs[msgno]; char article[16]; /* try to get article from cache */ diff --git a/nntp/nntp.h b/nntp/nntp.h index 9226e5e66..04477c23b 100644 --- a/nntp/nntp.h +++ b/nntp/nntp.h @@ -45,7 +45,7 @@ #include "mx.h" struct ConnAccount; -struct Header; +struct Email; struct Context; /* These Config Variables are only used in nntp/nntp.c */ @@ -169,7 +169,7 @@ const char *nntp_format_str(char *buf, size_t buflen, size_t col, int cols, char const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, enum FormatFlag flags); -void nntp_article_status(struct Mailbox *mailbox, struct Header *hdr, char *group, anum_t anum); +void nntp_article_status(struct Mailbox *mailbox, struct Email *hdr, char *group, anum_t anum); extern struct NntpServer *CurrentNewsSrv; diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index 3143a0754..4b2551055 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -266,7 +266,7 @@ static int init_mailbox(struct Mailbox *mailbox) * @retval ptr ID string * @retval NULL Error */ -static char *header_get_id(struct Header *h) +static char *header_get_id(struct Email *h) { return (h && h->data) ? ((struct NmHdrData *) h->data)->virtual_id : NULL; } @@ -278,7 +278,7 @@ static char *header_get_id(struct Header *h) * @param buflen Length of the buffer * @retval ptr Path string */ -static char *header_get_fullpath(struct Header *h, char *buf, size_t buflen) +static char *header_get_fullpath(struct Email *h, char *buf, size_t buflen) { snprintf(buf, buflen, "%s/%s", nm_header_get_folder(h), h->path); return buf; @@ -823,7 +823,7 @@ err: * @retval 0 Success * @retval 1 Tags unchanged */ -static int update_header_tags(struct Header *h, notmuch_message_t *msg) +static int update_header_tags(struct Email *h, notmuch_message_t *msg) { struct NmHdrData *data = h->data; char *new_tags = NULL; @@ -873,7 +873,7 @@ static int update_header_tags(struct Header *h, notmuch_message_t *msg) * @retval 0 Success * @retval 1 Failure */ -static int update_message_path(struct Header *h, const char *path) +static int update_message_path(struct Email *h, const char *path) { struct NmHdrData *data = h->data; @@ -932,7 +932,7 @@ static char *get_folder_from_path(const char *path) * deinit_header - Free the Notmuch data * @param h Email Header */ -static void deinit_header(struct Header *h) +static void deinit_header(struct Email *h) { free_hdrdata(h->data); h->data = NULL; @@ -967,7 +967,7 @@ static char *nm2mutt_message_id(const char *id) * @retval 0 Success * @retval -1 Failure */ -static int init_header(struct Header *h, const char *path, notmuch_message_t *msg) +static int init_header(struct Email *h, const char *path, notmuch_message_t *msg) { if (h->data) return 0; @@ -1079,7 +1079,7 @@ static void progress_update(struct Mailbox *mailbox, notmuch_query_t *q) * @retval ptr Email Header * @retval NULL Error */ -static struct Header *get_mutt_header(struct Mailbox *mailbox, notmuch_message_t *msg) +static struct Email *get_mutt_header(struct Mailbox *mailbox, notmuch_message_t *msg) { if (!mailbox || !msg) return NULL; @@ -1101,7 +1101,7 @@ static struct Header *get_mutt_header(struct Mailbox *mailbox, notmuch_message_t char *mid = nm2mutt_message_id(id); mutt_debug(2, "nm: neomutt id='%s'\n", mid); - struct Header *h = mutt_hash_find(mailbox->id_hash, mid); + struct Email *h = mutt_hash_find(mailbox->id_hash, mid); FREE(&mid); return h; } @@ -1117,7 +1117,7 @@ static void append_message(struct Mailbox *mailbox, notmuch_query_t *q, notmuch_message_t *msg, bool dedup) { char *newpath = NULL; - struct Header *h = NULL; + struct Email *h = NULL; struct NmMboxData *data = get_mboxdata(mailbox); if (!data) @@ -1173,7 +1173,7 @@ static void append_message(struct Mailbox *mailbox, notmuch_query_t *q, } if (init_header(h, newpath ? newpath : path, msg) != 0) { - mutt_header_free(&h); + mutt_email_free(&h); mutt_debug(1, "nm: failed to append header!\n"); goto done; } @@ -1340,7 +1340,7 @@ static bool read_threads_query(struct Mailbox *mailbox, notmuch_query_t *q, * @param hdr Email Header * @retval ptr Handle to the Notmuch message */ -static notmuch_message_t *get_nm_message(notmuch_database_t *db, struct Header *hdr) +static notmuch_message_t *get_nm_message(notmuch_database_t *db, struct Email *hdr) { notmuch_message_t *msg = NULL; char *id = header_get_id(hdr); @@ -1452,7 +1452,7 @@ static int update_tags(notmuch_message_t *msg, const char *tags) * update_header_tags and update_header_flags, which are given an array of * tags. */ -static int update_header_flags(struct Context *ctx, struct Header *hdr, const char *tags) +static int update_header_flags(struct Context *ctx, struct Email *hdr, const char *tags) { char *buf = mutt_str_strdup(tags); if (!buf) @@ -1514,8 +1514,7 @@ static int update_header_flags(struct Context *ctx, struct Header *hdr, const ch * @retval 1 Success, no change * @retval -1 Failure */ -static int rename_maildir_filename(const char *old, char *buf, size_t buflen, - struct Header *h) +static int rename_maildir_filename(const char *old, char *buf, size_t buflen, struct Email *h) { char filename[PATH_MAX]; char suffix[PATH_MAX]; @@ -1630,7 +1629,7 @@ static int remove_filename(struct NmMboxData *data, const char *path) * @retval -1 Failure */ static int rename_filename(struct NmMboxData *data, const char *old, - const char *new, struct Header *h) + const char *new, struct Email *h) { notmuch_database_t *db = get_db(data, true); if (!db || !new || !old || (access(new, F_OK) != 0)) @@ -1758,7 +1757,7 @@ static unsigned int count_query(notmuch_database_t *db, const char *qstr) * @retval ptr Folder containing email * @retval NULL Error */ -char *nm_header_get_folder(struct Header *h) +char *nm_header_get_folder(struct Email *h) { return (h && h->data) ? ((struct NmHdrData *) h->data)->folder : NULL; } @@ -1815,7 +1814,7 @@ void nm_debug_check(struct Mailbox *mailbox) * @retval 0 Success * @retval -1 Failure */ -int nm_read_entire_thread(struct Context *ctx, struct Header *h) +int nm_read_entire_thread(struct Context *ctx, struct Email *h) { struct NmMboxData *data = get_mboxdata(ctx->mailbox); if (!data) @@ -2026,7 +2025,7 @@ void nm_query_window_backward(void) * @param hdr Email Header * @retval true Message is still in query */ -bool nm_message_is_still_queried(struct Mailbox *mailbox, struct Header *hdr) +bool nm_message_is_still_queried(struct Mailbox *mailbox, struct Email *hdr) { struct NmMboxData *data = get_mboxdata(mailbox); notmuch_database_t *db = get_db(data, false); @@ -2098,7 +2097,7 @@ bool nm_message_is_still_queried(struct Mailbox *mailbox, struct Header *hdr) * @retval -1 Failure */ int nm_update_filename(struct Mailbox *mailbox, const char *old, - const char *new, struct Header *h) + const char *new, struct Email *h) { char buf[PATH_MAX]; struct NmMboxData *data = get_mboxdata(mailbox); @@ -2261,7 +2260,7 @@ int nm_description_to_path(const char *desc, char *buf, size_t buflen) * @retval 0 Success * @retval -1 Failure */ -int nm_record_message(struct Mailbox *mailbox, char *path, struct Header *h) +int nm_record_message(struct Mailbox *mailbox, char *path, struct Email *h) { notmuch_database_t *db = NULL; notmuch_status_t st; @@ -2478,7 +2477,7 @@ static int nm_mbox_check(struct Context *ctx, int *index_hint) const char *new = NULL; notmuch_message_t *m = notmuch_messages_get(msgs); - struct Header *h = get_mutt_header(ctx->mailbox, m); + struct Email *h = get_mutt_header(ctx->mailbox, m); if (!h) { @@ -2506,7 +2505,7 @@ static int nm_mbox_check(struct Context *ctx, int *index_hint) * this message, update the flags we just * detected. */ - struct Header tmp = { 0 }; + struct Email tmp = { 0 }; maildir_parse_flags(&tmp, new); maildir_update_flags(ctx, h, &tmp); } @@ -2575,7 +2574,7 @@ static int nm_mbox_sync(struct Context *ctx, int *index_hint) for (int i = 0; i < ctx->mailbox->msg_count; i++) { char old[PATH_MAX], new[PATH_MAX]; - struct Header *h = ctx->mailbox->hdrs[i]; + struct Email *h = ctx->mailbox->hdrs[i]; struct NmHdrData *hd = h->data; if (!ctx->mailbox->quiet) @@ -2652,7 +2651,7 @@ static int nm_msg_open(struct Context *ctx, struct Message *msg, int msgno) { if (!ctx || !msg) return 1; - struct Header *cur = ctx->mailbox->hdrs[msgno]; + struct Email *cur = ctx->mailbox->hdrs[msgno]; char path[PATH_MAX]; char *folder = nm_header_get_folder(cur); @@ -2704,7 +2703,7 @@ static int nm_tags_edit(struct Context *ctx, const char *tags, char *buf, size_t /** * nm_tags_commit - Implements MxOps::tags_commit() */ -static int nm_tags_commit(struct Context *ctx, struct Header *hdr, char *buf) +static int nm_tags_commit(struct Context *ctx, struct Email *hdr, char *buf) { struct NmMboxData *data = get_mboxdata(ctx->mailbox); if (!buf || !*buf || !data) diff --git a/notmuch/mutt_notmuch.h b/notmuch/mutt_notmuch.h index 7f2e78678..6f5695112 100644 --- a/notmuch/mutt_notmuch.h +++ b/notmuch/mutt_notmuch.h @@ -38,7 +38,7 @@ #include "mx.h" struct Context; -struct Header; +struct Email; /* These Config Variables are only used in notmuch/mutt_notmuch.c */ extern int NmDbLimit; @@ -57,18 +57,18 @@ void nm_debug_check (struct Mailbox *mailbox); int nm_description_to_path (const char *desc, char *buf, size_t buflen); int nm_get_all_tags (struct Mailbox *mailbox, char **tag_list, int *tag_count); char *nm_get_description (struct Mailbox *mailbox); -char *nm_header_get_folder (struct Header *h); +char *nm_header_get_folder (struct Email *h); void nm_longrun_done (struct Mailbox *mailbox); void nm_longrun_init (struct Mailbox *mailbox, bool writable); -bool nm_message_is_still_queried(struct Mailbox *mailbox, struct Header *hdr); +bool nm_message_is_still_queried(struct Mailbox *mailbox, struct Email *hdr); int nm_nonctx_get_count (char *path, int *all, int *new); bool nm_normalize_uri (const char *uri, char *buf, size_t buflen); int nm_path_probe (const char *path, const struct stat *st); void nm_query_window_backward (void); void nm_query_window_forward (void); -int nm_read_entire_thread (struct Context *ctx, struct Header *h); -int nm_record_message (struct Mailbox *mailbox, char *path, struct Header *h); -int nm_update_filename (struct Mailbox *mailbox, const char *old, const char *new, struct Header *h); +int nm_read_entire_thread (struct Context *ctx, struct Email *h); +int nm_record_message (struct Mailbox *mailbox, char *path, struct Email *h); +int nm_update_filename (struct Mailbox *mailbox, const char *old, const char *new, struct Email *h); char *nm_uri_from_query (struct Mailbox *mailbox, char *buf, size_t buflen); #endif /* MUTT_NOTMUCH_MUTT_NOTMUCH_H */ diff --git a/pager.c b/pager.c index 3954fb30d..238c317fa 100644 --- a/pager.c +++ b/pager.c @@ -101,7 +101,7 @@ static const char *Function_not_permitted_in_attach_message_mode = /* hack to return to position when returning from index to same message */ static int TopLine = 0; -static struct Header *OldHdr = NULL; +static struct Email *OldHdr = NULL; #define CHECK_MODE(x) \ if (!(x)) \ @@ -2357,7 +2357,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e { for (i = oldcount; i < Context->mailbox->msg_count; i++) { - struct Header *h = Context->mailbox->hdrs[i]; + struct Email *h = Context->mailbox->hdrs[i]; if (h && !h->read) { diff --git a/pager.h b/pager.h index f1fbfc852..d1368dc25 100644 --- a/pager.h +++ b/pager.h @@ -63,7 +63,7 @@ extern bool Tilde; struct Pager { struct Context *ctx; /**< current mailbox */ - struct Header *hdr; /**< current message */ + struct Email *hdr; /**< current message */ struct Body *bdy; /**< current attachment */ FILE *fp; /**< source stream */ struct AttachCtx *actx; /**< attachment information */ diff --git a/pattern.c b/pattern.c index 1ca722f86..73d698938 100644 --- a/pattern.c +++ b/pattern.c @@ -981,7 +981,7 @@ static bool msg_search(struct Context *ctx, struct Pattern *pat, int msgno) FILE *fp = NULL; long lng = 0; - struct Header *h = ctx->mailbox->hdrs[msgno]; + struct Email *h = ctx->mailbox->hdrs[msgno]; #ifdef USE_FMEMOPEN char *temp = NULL; size_t tempsize; @@ -1503,7 +1503,7 @@ struct Pattern *mutt_pattern_comp(/* const */ char *s, int flags, struct Buffer * @retval true If ALL of the Patterns evaluates to true */ static bool perform_and(struct Pattern *pat, enum PatternExecFlag flags, - struct Context *ctx, struct Header *hdr, struct PatternCache *cache) + struct Context *ctx, struct Email *hdr, struct PatternCache *cache) { for (; pat; pat = pat->next) if (mutt_pattern_exec(pat, flags, ctx, hdr, cache) <= 0) @@ -1521,7 +1521,7 @@ static bool perform_and(struct Pattern *pat, enum PatternExecFlag flags, * @retval true If ONE (or more) of the Patterns evaluates to true */ static int perform_or(struct Pattern *pat, enum PatternExecFlag flags, - struct Context *ctx, struct Header *hdr, struct PatternCache *cache) + struct Context *ctx, struct Email *hdr, struct PatternCache *cache) { for (; pat; pat = pat->next) if (mutt_pattern_exec(pat, flags, ctx, hdr, cache) > 0) @@ -1655,7 +1655,7 @@ static int match_threadcomplete(struct Pattern *pat, enum PatternExecFlag flags, int left, int up, int right, int down) { int a; - struct Header *h = NULL; + struct Email *h = NULL; if (!t) return 0; @@ -1756,7 +1756,7 @@ static int match_content_type(const struct Pattern *pat, struct Body *b) * @retval 0 Pattern did not match */ static int match_mime_content_type(const struct Pattern *pat, - struct Context *ctx, struct Header *hdr) + struct Context *ctx, struct Email *hdr) { mutt_parse_mime_message(ctx, hdr); return match_content_type(pat, hdr->content); @@ -1811,7 +1811,7 @@ static int is_pattern_cache_set(int cache_entry) * store some of the cacheable pattern matches in this structure. */ int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, - struct Context *ctx, struct Header *h, struct PatternCache *cache) + struct Context *ctx, struct Email *h, struct PatternCache *cache) { int result; int *cache_entry = NULL; @@ -2149,7 +2149,7 @@ void mutt_check_simple(char *s, size_t len, const char *simple) * @retval ptr Success, email found * @retval NULL Error */ -static struct MuttThread *top_of_thread(struct Header *h) +static struct MuttThread *top_of_thread(struct Email *h) { struct MuttThread *t = NULL; @@ -2170,7 +2170,7 @@ static struct MuttThread *top_of_thread(struct Header *h) * @retval true Success * @retval false Failure */ -bool mutt_limit_current_thread(struct Header *h) +bool mutt_limit_current_thread(struct Email *h) { struct MuttThread *me = NULL; @@ -2444,7 +2444,7 @@ int mutt_search_command(int cur, int op) } } - struct Header *h = Context->mailbox->hdrs[Context->mailbox->v2r[i]]; + struct Email *h = Context->mailbox->hdrs[Context->mailbox->v2r[i]]; if (h->searched) { /* if we've already evaluated this message, use the cached value */ diff --git a/pattern.h b/pattern.h index c6e2745c1..64e00ace3 100644 --- a/pattern.h +++ b/pattern.h @@ -29,7 +29,7 @@ struct Address; struct Buffer; -struct Header; +struct Email; struct Context; /* These Config Variables are only used in pattern.c */ @@ -91,7 +91,7 @@ struct PatternCache struct Pattern *mutt_pattern_new(void); int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, - struct Context *ctx, struct Header *h, struct PatternCache *cache); + struct Context *ctx, struct Email *h, struct PatternCache *cache); struct Pattern *mutt_pattern_comp(/* const */ char *s, int flags, struct Buffer *err); void mutt_check_simple(char *s, size_t len, const char *simple); void mutt_pattern_free(struct Pattern **pat); @@ -102,6 +102,6 @@ int mutt_is_list_cc(int alladdr, struct Address *a1, struct Address *a2); int mutt_pattern_func(int op, char *prompt); int mutt_search_command(int cur, int op); -bool mutt_limit_current_thread(struct Header *h); +bool mutt_limit_current_thread(struct Email *h); #endif /* MUTT_PATTERN_H */ diff --git a/po/POTFILES.in b/po/POTFILES.in index 2949263f1..12379d512 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -39,10 +39,10 @@ editmsg.c email/address.c email/attach.c email/body.c +email/email.c email/email_globals.c email/envelope.c email/from.c -email/header.c email/idna.c email/mime.c email/parameter.c diff --git a/pop/pop.c b/pop/pop.c index 352074602..fc41e9c19 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -119,7 +119,7 @@ static int fetch_message(char *line, void *file) * @retval -2 Invalid command or execution error * @retval -3 Error writing to tempfile */ -static int pop_read_header(struct PopData *pop_data, struct Header *h) +static int pop_read_header(struct PopData *pop_data, struct Email *h) { FILE *f = mutt_file_mkstemp(); if (!f) @@ -230,7 +230,7 @@ static int fetch_uidl(char *line, void *data) mx_alloc_memory(mailbox); mailbox->msg_count++; - mailbox->hdrs[i] = mutt_header_new(); + mailbox->hdrs[i] = mutt_email_new(); mailbox->hdrs[i]->data = mutt_str_strdup(line); } else if (mailbox->hdrs[i]->index != index - 1) @@ -397,9 +397,9 @@ static int pop_fetch_headers(struct Context *ctx) * (the old h->data should point inside a malloc'd block from * hcache so there shouldn't be a memleak here) */ - struct Header *h = mutt_hcache_restore((unsigned char *) data); + struct Email *h = mutt_hcache_restore((unsigned char *) data); mutt_hcache_free(hc, &data); - mutt_header_free(&ctx->mailbox->hdrs[i]); + mutt_email_free(&ctx->mailbox->hdrs[i]); ctx->mailbox->hdrs[i] = h; ctx->mailbox->hdrs[i]->refno = refno; ctx->mailbox->hdrs[i]->index = index; @@ -461,7 +461,7 @@ static int pop_fetch_headers(struct Context *ctx) if (ret < 0) { for (int i = ctx->mailbox->msg_count; i < new_count; i++) - mutt_header_free(&ctx->mailbox->hdrs[i]); + mutt_email_free(&ctx->mailbox->hdrs[i]); return ret; } @@ -896,7 +896,7 @@ static int pop_msg_open(struct Context *ctx, struct Message *msg, int msgno) char path[PATH_MAX]; struct Progress progressbar; struct PopData *pop_data = ctx->mailbox->data; - struct Header *h = ctx->mailbox->hdrs[msgno]; + struct Email *h = ctx->mailbox->hdrs[msgno]; bool bcache = true; /* see if we already have the message in body cache */ diff --git a/postpone.c b/postpone.c index 12a22db29..81ea92509 100644 --- a/postpone.c +++ b/postpone.c @@ -205,7 +205,7 @@ static void post_entry(char *buf, size_t buflen, struct Menu *menu, int num) * select_msg - Create a Menu to select a postponed message * @retval ptr Email Header */ -static struct Header *select_msg(void) +static struct Email *select_msg(void) { int r = -1; bool done = false; @@ -280,10 +280,10 @@ static struct Header *select_msg(void) * @retval 0 Normal exit * @retval #SEND_REPLY Recalled message is a reply */ -int mutt_get_postponed(struct Context *ctx, struct Header *hdr, - struct Header **cur, char *fcc, size_t fcclen) +int mutt_get_postponed(struct Context *ctx, struct Email *hdr, + struct Email **cur, char *fcc, size_t fcclen) { - struct Header *h = NULL; + struct Email *h = NULL; int code = SEND_POSTPONED; const char *p = NULL; int opt_delete; @@ -555,8 +555,8 @@ int mutt_parse_crypt_hdr(const char *p, int set_empty_signas, int crypt_app) * @retval 0 Success * @retval -1 Error */ -int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Header *newhdr, - struct Header *hdr, bool resend) +int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Email *newhdr, + struct Email *hdr, bool resend) { struct Message *msg = NULL; char file[PATH_MAX]; diff --git a/protos.h b/protos.h index 6cbab9421..2e1ebc7ab 100644 --- a/protos.h +++ b/protos.h @@ -33,7 +33,7 @@ struct Context; struct EnterState; struct Envelope; -struct Header; +struct Email; /** * enum XdgType - XDG variable types @@ -49,23 +49,23 @@ int mutt_system(const char *cmd); int mutt_set_xdg_path(enum XdgType type, char *buf, size_t bufsize); void mutt_help(int menu); void mutt_make_help(char *d, size_t dlen, const char *txt, int menu, int op); -void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool bf, bool upd_ctx); +void mutt_set_flag_update(struct Context *ctx, struct Email *h, int flag, bool bf, bool upd_ctx); #define mutt_set_flag(a, b, c, d) mutt_set_flag_update(a, b, c, d, true) void mutt_signal_init(void); void mutt_tag_set_flag(int flag, int bf); -int mutt_change_flag(struct Header *h, int bf); +int mutt_change_flag(struct Email *h, int bf); int mutt_complete(char *buf, size_t buflen); -int mutt_edit_message(struct Context *ctx, struct Header *hdr); -int mutt_view_message(struct Context *ctx, struct Header *hdr); -int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Header *newhdr, struct Header *hdr, bool resend); +int mutt_edit_message(struct Context *ctx, struct Email *hdr); +int mutt_view_message(struct Context *ctx, struct Email *hdr); +int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Email *newhdr, struct Email *hdr, bool resend); int mutt_enter_string(char *buf, size_t buflen, int col, int flags); int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, bool multiple, char ***files, int *numfiles, struct EnterState *state); -int mutt_get_postponed(struct Context *ctx, struct Header *hdr, struct Header **cur, char *fcc, size_t fcclen); +int mutt_get_postponed(struct Context *ctx, struct Email *hdr, struct Email **cur, char *fcc, size_t fcclen); int mutt_parse_crypt_hdr(const char *p, int set_empty_signas, int crypt_app); int mutt_num_postponed(bool force); -int mutt_thread_set_flag(struct Header *hdr, int flag, int bf, int subthread); +int mutt_thread_set_flag(struct Email *hdr, int flag, int bf, int subthread); void mutt_update_num_postponed(void); int url_parse_mailto(struct Envelope *e, char **body, const char *src); int mutt_is_quote_line(char *buf, regmatch_t *pmatch); diff --git a/query.c b/query.c index a5f5bef3b..2901711f8 100644 --- a/query.c +++ b/query.c @@ -333,7 +333,7 @@ static int query_tag(struct Menu *menu, int n, int m) static void query_menu(char *buf, size_t buflen, struct Query *results, bool retbuf) { struct Menu *menu = NULL; - struct Header *msg = NULL; + struct Email *msg = NULL; struct Entry *QueryTable = NULL; struct Query *queryp = NULL; char title[STRING]; @@ -484,7 +484,7 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, bool ret } /* fallthrough */ case OP_MAIL: - msg = mutt_header_new(); + msg = mutt_email_new(); msg->env = mutt_env_new(); if (!menu->tagprefix) { diff --git a/recvattach.c b/recvattach.c index 73049da25..57dc56934 100644 --- a/recvattach.c +++ b/recvattach.c @@ -480,8 +480,7 @@ static void prepend_curdir(char *buf, size_t buflen) * @retval 0 Success * @retval -1 Failure */ -static int query_save_attachment(FILE *fp, struct Body *body, - struct Header *hdr, char **directory) +static int query_save_attachment(FILE *fp, struct Body *body, struct Email *hdr, char **directory) { char *prompt = NULL; char buf[PATH_MAX], tfile[PATH_MAX]; @@ -576,7 +575,7 @@ static int query_save_attachment(FILE *fp, struct Body *body, * @param menu Menu listing attachments */ void mutt_save_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, - struct Body *top, struct Header *hdr, struct Menu *menu) + struct Body *top, struct Email *hdr, struct Menu *menu) { char buf[PATH_MAX], tfile[PATH_MAX]; char *directory = NULL; @@ -1016,7 +1015,7 @@ static int recvattach_pgp_check_traditional(struct AttachCtx *actx, struct Menu * @param hdr Header of the email */ static void recvattach_edit_content_type(struct AttachCtx *actx, - struct Menu *menu, struct Header *hdr) + struct Menu *menu, struct Email *hdr) { if (mutt_edit_content_type(hdr, CURATTACH->content, CURATTACH->fp) != 1) return; @@ -1045,7 +1044,7 @@ static void recvattach_edit_content_type(struct AttachCtx *actx, * @param recv true if these are received attachments (rather than in compose) * @retval num Operation performed */ -int mutt_attach_display_loop(struct Menu *menu, int op, struct Header *hdr, +int mutt_attach_display_loop(struct Menu *menu, int op, struct Email *hdr, struct AttachCtx *actx, bool recv) { do @@ -1122,7 +1121,7 @@ int mutt_attach_display_loop(struct Menu *menu, int op, struct Header *hdr, * @param level Attachment depth * @param decrypted True if attachment has been decrypted */ -static void mutt_generate_recvattach_list(struct AttachCtx *actx, struct Header *hdr, +static void mutt_generate_recvattach_list(struct AttachCtx *actx, struct Email *hdr, struct Body *m, FILE *fp, int parent_type, int level, bool decrypted) { @@ -1309,7 +1308,7 @@ static void attach_collapse(struct AttachCtx *actx, struct Menu *menu) * mutt_view_attachments - Show the attachments in a Menu * @param hdr Header of the email */ -void mutt_view_attachments(struct Header *hdr) +void mutt_view_attachments(struct Email *hdr) { char helpstr[LONG_STRING]; struct Body *cur = NULL; diff --git a/recvattach.h b/recvattach.h index 76224d016..c48675d4d 100644 --- a/recvattach.h +++ b/recvattach.h @@ -29,7 +29,7 @@ #include "format_flags.h" struct AttachCtx; -struct Header; +struct Email; /* These Config Variables are only used in recvattach.c */ extern char *AttachSep; @@ -41,6 +41,6 @@ void mutt_attach_init(struct AttachCtx *actx); void mutt_update_tree(struct AttachCtx *actx); const char *attach_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, enum FormatFlag flags); -void mutt_view_attachments(struct Header *hdr); +void mutt_view_attachments(struct Email *hdr); #endif /* MUTT_RECVATTACH_H */ diff --git a/recvcmd.c b/recvcmd.c index b92559671..1e70eae6c 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -386,7 +386,7 @@ static struct AttachPtr *find_parent(struct AttachCtx *actx, struct Body *cur, s * @param ofp File to write to * @param prefix Prefix for each line (OPTIONAL) */ -static void include_header(bool quote, FILE *ifp, struct Header *hdr, FILE *ofp, char *prefix) +static void include_header(bool quote, FILE *ifp, struct Email *hdr, FILE *ofp, char *prefix) { int chflags = CH_DECODE; char prefix2[SHORT_STRING]; @@ -446,12 +446,12 @@ static struct Body **copy_problematic_attachments(struct Body **last, * * (non-message types) */ -static void attach_forward_bodies(FILE *fp, struct Header *hdr, struct AttachCtx *actx, +static void attach_forward_bodies(FILE *fp, struct Email *hdr, struct AttachCtx *actx, struct Body *cur, short nattach) { bool mime_fwd_all = false; bool mime_fwd_any = true; - struct Header *parent_hdr = NULL; + struct Email *parent_hdr = NULL; FILE *parent_fp = NULL; char tmpbody[PATH_MAX]; char prefix[STRING]; @@ -473,7 +473,7 @@ static void attach_forward_bodies(FILE *fp, struct Header *hdr, struct AttachCtx parent_fp = actx->root_fp; } - struct Header *tmphdr = mutt_header_new(); + struct Email *tmphdr = mutt_email_new(); tmphdr->env = mutt_env_new(); mutt_make_forward_subject(tmphdr->env, Context, parent_hdr); @@ -482,7 +482,7 @@ static void attach_forward_bodies(FILE *fp, struct Header *hdr, struct AttachCtx if (!tmpfp) { mutt_error(_("Can't open temporary file %s"), tmpbody); - mutt_header_free(&tmphdr); + mutt_email_free(&tmphdr); return; } @@ -600,7 +600,7 @@ bail: mutt_file_unlink(tmpbody); } - mutt_header_free(&tmphdr); + mutt_email_free(&tmphdr); } /** @@ -619,8 +619,8 @@ bail: */ static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, struct Body *cur, int flags) { - struct Header *curhdr = NULL; - struct Header *tmphdr = NULL; + struct Email *curhdr = NULL; + struct Email *tmphdr = NULL; int rc; struct Body **last = NULL; @@ -643,7 +643,7 @@ static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, struct Body *c } } - tmphdr = mutt_header_new(); + tmphdr = mutt_email_new(); tmphdr->env = mutt_env_new(); mutt_make_forward_subject(tmphdr->env, Context, curhdr); @@ -659,7 +659,7 @@ static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, struct Body *c if (!tmpfp) { mutt_error(_("Can't create %s"), tmpbody); - mutt_header_free(&tmphdr); + mutt_email_free(&tmphdr); return; } @@ -719,7 +719,7 @@ static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, struct Body *c } } else - mutt_header_free(&tmphdr); + mutt_email_free(&tmphdr); ci_send_message(flags, tmphdr, *tmpbody ? tmpbody : NULL, NULL, curhdr); } @@ -732,7 +732,7 @@ static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, struct Body *c * @param cur Current message * @param flags Send mode, e.g. #SEND_RESEND */ -void mutt_attach_forward(FILE *fp, struct Header *hdr, struct AttachCtx *actx, +void mutt_attach_forward(FILE *fp, struct Email *hdr, struct AttachCtx *actx, struct Body *cur, int flags) { if (check_all_msg(actx, cur, false)) @@ -768,10 +768,10 @@ void mutt_attach_forward(FILE *fp, struct Header *hdr, struct AttachCtx *actx, * Note that this code is horribly similar to envelope_defaults() from send.c. */ static int attach_reply_envelope_defaults(struct Envelope *env, struct AttachCtx *actx, - struct Header *parent, int flags) + struct Email *parent, int flags) { struct Envelope *curenv = NULL; - struct Header *curhdr = NULL; + struct Email *curhdr = NULL; if (!parent) { @@ -857,7 +857,7 @@ static int attach_reply_envelope_defaults(struct Envelope *env, struct AttachCtx * @param tmpfp File handle to temporary file * @param cur Header of email */ -static void attach_include_reply(FILE *fp, FILE *tmpfp, struct Header *cur) +static void attach_include_reply(FILE *fp, FILE *tmpfp, struct Email *cur) { int cmflags = MUTT_CM_PREFIX | MUTT_CM_DECODE | MUTT_CM_CHARCONV; int chflags = CH_DECODE; @@ -884,16 +884,16 @@ static void attach_include_reply(FILE *fp, FILE *tmpfp, struct Header *cur) * @param cur Current message * @param flags Send mode, e.g. #SEND_RESEND */ -void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx, +void mutt_attach_reply(FILE *fp, struct Email *hdr, struct AttachCtx *actx, struct Body *cur, int flags) { bool mime_reply_any = false; short nattach = 0; struct AttachPtr *parent = NULL; - struct Header *parent_hdr = NULL; + struct Email *parent_hdr = NULL; FILE *parent_fp = NULL; - struct Header *tmphdr = NULL; + struct Email *tmphdr = NULL; struct State st; char tmpbody[PATH_MAX]; @@ -937,13 +937,13 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx, else if (nattach == 1) mime_reply_any = true; - tmphdr = mutt_header_new(); + tmphdr = mutt_email_new(); tmphdr->env = mutt_env_new(); if (attach_reply_envelope_defaults( tmphdr->env, actx, parent_hdr ? parent_hdr : (cur ? cur->hdr : NULL), flags) == -1) { - mutt_header_free(&tmphdr); + mutt_email_free(&tmphdr); return; } @@ -952,7 +952,7 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx, if (!tmpfp) { mutt_error(_("Can't create %s"), tmpbody); - mutt_header_free(&tmphdr); + mutt_email_free(&tmphdr); return; } @@ -1021,7 +1021,7 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx, if (mime_reply_any && !cur && !copy_problematic_attachments(&tmphdr->content, actx, false)) { - mutt_header_free(&tmphdr); + mutt_email_free(&tmphdr); mutt_file_fclose(&tmpfp); return; } @@ -1043,7 +1043,7 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx, * @param actx Attachment Context * @param cur Current attachment */ -void mutt_attach_mail_sender(FILE *fp, struct Header *hdr, +void mutt_attach_mail_sender(FILE *fp, struct Email *hdr, struct AttachCtx *actx, struct Body *cur) { if (!check_all_msg(actx, cur, 0)) @@ -1052,7 +1052,7 @@ void mutt_attach_mail_sender(FILE *fp, struct Header *hdr, return; } - struct Header *tmphdr = mutt_header_new(); + struct Email *tmphdr = mutt_email_new(); tmphdr->env = mutt_env_new(); if (cur) diff --git a/recvcmd.h b/recvcmd.h index fe212011b..7d3244c5d 100644 --- a/recvcmd.h +++ b/recvcmd.h @@ -27,15 +27,15 @@ struct AttachCtx; struct Body; -struct Header; +struct Email; /* These Config Variables are only used in recvcmd.c */ extern unsigned char MimeForwardRest; void mutt_attach_bounce(FILE *fp, struct AttachCtx *actx, struct Body *cur); void mutt_attach_resend(FILE *fp, struct AttachCtx *actx, struct Body *cur); -void mutt_attach_forward(FILE *fp, struct Header *hdr, struct AttachCtx *actx, struct Body *cur, int flags); -void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx, struct Body *cur, int flags); -void mutt_attach_mail_sender(FILE *fp, struct Header *hdr, struct AttachCtx *actx, struct Body *cur); +void mutt_attach_forward(FILE *fp, struct Email *hdr, struct AttachCtx *actx, struct Body *cur, int flags); +void mutt_attach_reply(FILE *fp, struct Email *hdr, struct AttachCtx *actx, struct Body *cur, int flags); +void mutt_attach_mail_sender(FILE *fp, struct Email *hdr, struct AttachCtx *actx, struct Body *cur); #endif /* MUTT_RECVCMD_H */ diff --git a/remailer.c b/remailer.c index a2f5726a3..647b6d6d3 100644 --- a/remailer.c +++ b/remailer.c @@ -766,7 +766,7 @@ void mix_make_chain(struct ListHead *chainhead) * @retval 0 Success * @retval -1 Error */ -int mix_check_message(struct Header *msg) +int mix_check_message(struct Email *msg) { const char *fqdn = NULL; bool need_hostname = false; diff --git a/remailer.h b/remailer.h index cb9d0b66e..b0cb55cd9 100644 --- a/remailer.h +++ b/remailer.h @@ -26,7 +26,7 @@ #include struct ListHead; -struct Header; +struct Email; /* These Config Variables are only used in remailer.c */ extern char *MixEntryFormat; @@ -58,7 +58,7 @@ struct MixChain }; int mix_send_message(struct ListHead *chain, const char *tempfile); -int mix_check_message(struct Header *msg); +int mix_check_message(struct Email *msg); void mix_make_chain(struct ListHead *chainhead); #endif /* MUTT_REMAILER_H */ diff --git a/rfc3676.c b/rfc3676.c index e34f2930e..18adfb9f4 100644 --- a/rfc3676.c +++ b/rfc3676.c @@ -391,7 +391,7 @@ int rfc3676_handler(struct Body *a, struct State *s) * freshly created copy in a tempfile and modifies the file's mtime so we don't * trigger code paths watching for mtime changes */ -void rfc3676_space_stuff(struct Header *hdr) +void rfc3676_space_stuff(struct Email *hdr) { int lc = 0; size_t len = 0; diff --git a/rfc3676.h b/rfc3676.h index ce1a8be03..61a75c347 100644 --- a/rfc3676.h +++ b/rfc3676.h @@ -28,7 +28,7 @@ #include struct Body; -struct Header; +struct Email; struct State; /* These Config Variables are only used in rfc3676.c */ @@ -36,6 +36,6 @@ extern bool ReflowSpaceQuotes; extern short ReflowWrap; int rfc3676_handler(struct Body *a, struct State *s); -void rfc3676_space_stuff(struct Header *hdr); +void rfc3676_space_stuff(struct Email *hdr); #endif /* MUTT_RFC3676_H */ diff --git a/score.c b/score.c index 7ca3a6d79..a7a431ee5 100644 --- a/score.c +++ b/score.c @@ -168,7 +168,7 @@ int mutt_parse_score(struct Buffer *buf, struct Buffer *s, unsigned long data, * @param hdr Email header * @param upd_ctx If true, update the Context too */ -void mutt_score_message(struct Context *ctx, struct Header *hdr, bool upd_ctx) +void mutt_score_message(struct Context *ctx, struct Email *hdr, bool upd_ctx) { struct Score *tmp = NULL; struct PatternCache cache = { 0 }; diff --git a/score.h b/score.h index 18752badf..a3fece917 100644 --- a/score.h +++ b/score.h @@ -26,7 +26,7 @@ #include struct Buffer; -struct Header; +struct Email; struct Context; /* These Config Variables are only used in score.c */ @@ -37,6 +37,6 @@ extern short ScoreThresholdRead; void mutt_check_rescore(struct Context *ctx); int mutt_parse_score(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err); int mutt_parse_unscore(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err); -void mutt_score_message(struct Context *ctx, struct Header *hdr, bool upd_ctx); +void mutt_score_message(struct Context *ctx, struct Email *hdr, bool upd_ctx); #endif /* MUTT_SCORE_H */ diff --git a/send.c b/send.c index e3526d8d7..ca14f21db 100644 --- a/send.c +++ b/send.c @@ -489,7 +489,7 @@ static void process_user_header(struct Envelope *env) * @param cur Header of email * @param fp File to write to */ -void mutt_forward_intro(struct Context *ctx, struct Header *cur, FILE *fp) +void mutt_forward_intro(struct Context *ctx, struct Email *cur, FILE *fp) { if (!ForwardAttributionIntro || !fp) return; @@ -508,7 +508,7 @@ void mutt_forward_intro(struct Context *ctx, struct Header *cur, FILE *fp) * @param cur Header of email * @param fp File to write to */ -void mutt_forward_trailer(struct Context *ctx, struct Header *cur, FILE *fp) +void mutt_forward_trailer(struct Context *ctx, struct Email *cur, FILE *fp) { if (!ForwardAttributionTrailer || !fp) return; @@ -530,7 +530,7 @@ void mutt_forward_trailer(struct Context *ctx, struct Header *cur, FILE *fp) * @retval 0 Success * @retval -1 Failure */ -static int include_forward(struct Context *ctx, struct Header *cur, FILE *out) +static int include_forward(struct Context *ctx, struct Email *cur, FILE *out) { int chflags = CH_DECODE, cmflags = 0; @@ -573,7 +573,7 @@ static int include_forward(struct Context *ctx, struct Header *cur, FILE *out) * @param cur Header of email * @param out File to write to */ -void mutt_make_attribution(struct Context *ctx, struct Header *cur, FILE *out) +void mutt_make_attribution(struct Context *ctx, struct Email *cur, FILE *out) { if (!Attribution || !out) return; @@ -592,7 +592,7 @@ void mutt_make_attribution(struct Context *ctx, struct Header *cur, FILE *out) * @param cur Header of email * @param out File to write to */ -void mutt_make_post_indent(struct Context *ctx, struct Header *cur, FILE *out) +void mutt_make_post_indent(struct Context *ctx, struct Email *cur, FILE *out) { if (!PostIndentString || !out) return; @@ -611,7 +611,7 @@ void mutt_make_post_indent(struct Context *ctx, struct Header *cur, FILE *out) * @retval 0 Success * @retval -1 Failure */ -static int include_reply(struct Context *ctx, struct Header *cur, FILE *out) +static int include_reply(struct Context *ctx, struct Email *cur, FILE *out) { int cmflags = MUTT_CM_PREFIX | MUTT_CM_DECODE | MUTT_CM_CHARCONV | MUTT_CM_REPLYING; int chflags = CH_DECODE; @@ -842,7 +842,7 @@ void mutt_fix_reply_recipients(struct Envelope *env) * @param ctx Mailbox * @param cur Header of email */ -void mutt_make_forward_subject(struct Envelope *env, struct Context *ctx, struct Header *cur) +void mutt_make_forward_subject(struct Envelope *env, struct Context *ctx, struct Email *cur) { if (!env) return; @@ -937,7 +937,7 @@ static void make_reference_headers(struct Envelope *curenv, * @retval -1 Failure */ static int envelope_defaults(struct Envelope *env, struct Context *ctx, - struct Header *cur, int flags) + struct Email *cur, int flags) { struct Envelope *curenv = NULL; bool tag = false; @@ -1030,8 +1030,8 @@ static int envelope_defaults(struct Envelope *env, struct Context *ctx, * @retval 0 Success * @retval -1 Error */ -static int generate_body(FILE *tempfp, struct Header *msg, int flags, - struct Context *ctx, struct Header *cur) +static int generate_body(FILE *tempfp, struct Email *msg, int flags, + struct Context *ctx, struct Email *cur) { int i; struct Body *tmp = NULL; @@ -1289,7 +1289,7 @@ struct Address *mutt_default_from(void) * @retval 0 Success * @retval -1 Failure */ -static int send_message(struct Header *msg) +static int send_message(struct Email *msg) { char tempfile[PATH_MAX]; int i; @@ -1418,13 +1418,13 @@ static void fix_end_of_file(const char *data) * @retval -1 Message was aborted or an error occurred * @retval 1 Message was postponed */ -int mutt_resend_message(FILE *fp, struct Context *ctx, struct Header *cur) +int mutt_resend_message(FILE *fp, struct Context *ctx, struct Email *cur) { - struct Header *msg = mutt_header_new(); + struct Email *msg = mutt_email_new(); if (mutt_prepare_template(fp, ctx, msg, cur, true) < 0) { - mutt_header_free(&msg); + mutt_email_free(&msg); return -1; } @@ -1459,7 +1459,7 @@ int mutt_resend_message(FILE *fp, struct Context *ctx, struct Header *cur) * @retval 1 It is a reply * @retval 0 It is not a reply */ -static int is_reply(struct Header *reply, struct Header *orig) +static int is_reply(struct Email *reply, struct Email *orig) { if (!reply || !reply->env || !orig || !orig->env) return 0; @@ -1518,8 +1518,8 @@ static bool search_attach_keyword(char *filename) * @retval -1 Message was aborted or an error occurred * @retval 1 Message was postponed */ -int ci_send_message(int flags, struct Header *msg, char *tempfile, - struct Context *ctx, struct Header *cur) +int ci_send_message(int flags, struct Email *msg, char *tempfile, + struct Context *ctx, struct Email *cur) { char buffer[LONG_STRING]; char fcc[PATH_MAX] = ""; /* where to copy this message */ @@ -1578,7 +1578,7 @@ int ci_send_message(int flags, struct Header *msg, char *tempfile, if (!msg) { - msg = mutt_header_new(); + msg = mutt_email_new(); if (flags == SEND_POSTPONED) { @@ -2446,7 +2446,7 @@ cleanup: mutt_file_fclose(&tempfp); if (!(flags & SEND_NO_FREE_HEADER)) - mutt_header_free(&msg); + mutt_email_free(&msg); FREE(&finalpath); return rc; diff --git a/send.h b/send.h index a1d1231d3..0d2102c87 100644 --- a/send.h +++ b/send.h @@ -30,7 +30,7 @@ struct Address; struct Body; struct Context; struct Envelope; -struct Header; +struct Email; /* These Config Variables are only used in send.c */ extern unsigned char AbortNoattach; /* forgotten attachment detector */ @@ -94,20 +94,20 @@ extern bool UseFrom; #define SEND_TO_SENDER (1 << 12) #define SEND_NEWS (1 << 13) -int ci_send_message(int flags, struct Header *msg, char *tempfile, struct Context *ctx, struct Header *cur); +int ci_send_message(int flags, struct Email *msg, char *tempfile, struct Context *ctx, struct Email *cur); void mutt_add_to_reference_headers(struct Envelope *env, struct Envelope *curenv); struct Address *mutt_default_from(void); void mutt_encode_descriptions(struct Body *b, bool recurse); int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, int flags); void mutt_fix_reply_recipients(struct Envelope *env); -void mutt_forward_intro(struct Context *ctx, struct Header *cur, FILE *fp); -void mutt_forward_trailer(struct Context *ctx, struct Header *cur, FILE *fp); -void mutt_make_attribution(struct Context *ctx, struct Header *cur, FILE *out); -void mutt_make_forward_subject(struct Envelope *env, struct Context *ctx, struct Header *cur); +void mutt_forward_intro(struct Context *ctx, struct Email *cur, FILE *fp); +void mutt_forward_trailer(struct Context *ctx, struct Email *cur, FILE *fp); +void mutt_make_attribution(struct Context *ctx, struct Email *cur, FILE *out); +void mutt_make_forward_subject(struct Envelope *env, struct Context *ctx, struct Email *cur); void mutt_make_misc_reply_headers(struct Envelope *env, struct Envelope *curenv); -void mutt_make_post_indent(struct Context *ctx, struct Header *cur, FILE *out); +void mutt_make_post_indent(struct Context *ctx, struct Email *cur, FILE *out); struct Address *mutt_remove_xrefs(struct Address *a, struct Address *b); -int mutt_resend_message(FILE *fp, struct Context *ctx, struct Header *cur); +int mutt_resend_message(FILE *fp, struct Context *ctx, struct Email *cur); void mutt_set_followup_to(struct Envelope *e); #endif /* MUTT_SEND_H */ diff --git a/sendlib.c b/sendlib.c index 55e75e809..c4a8bcdfe 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1450,7 +1450,7 @@ void mutt_update_encoding(struct Body *a) * @retval ptr Newly allocated Body * @retval NULL Error */ -struct Body *mutt_make_message_attach(struct Context *ctx, struct Header *hdr, bool attach_msg) +struct Body *mutt_make_message_attach(struct Context *ctx, struct Email *hdr, bool attach_msg) { char buffer[LONG_STRING]; struct Body *body = NULL; @@ -1525,7 +1525,7 @@ struct Body *mutt_make_message_attach(struct Context *ctx, struct Header *hdr, b fflush(fp); rewind(fp); - body->hdr = mutt_header_new(); + body->hdr = mutt_email_new(); body->hdr->offset = 0; /* we don't need the user headers here */ body->hdr->env = mutt_rfc822_read_header(fp, body->hdr, false, false); @@ -2955,7 +2955,7 @@ void mutt_unprepare_envelope(struct Envelope *env) * @retval 0 Success * @retval -1 Failure */ -static int bounce_message(FILE *fp, struct Header *h, struct Address *to, +static int bounce_message(FILE *fp, struct Email *h, struct Address *to, const char *resent_from, struct Address *env_from) { int rc = 0; @@ -3030,7 +3030,7 @@ static int bounce_message(FILE *fp, struct Header *h, struct Address *to, * @retval 0 Success * @retval -1 Failure */ -int mutt_bounce_message(FILE *fp, struct Header *h, struct Address *to) +int mutt_bounce_message(FILE *fp, struct Email *h, struct Address *to) { const char *fqdn = mutt_fqdn(true); char resent_from[STRING]; @@ -3111,7 +3111,7 @@ static void set_noconv_flags(struct Body *b, bool flag) * @retval 0 Success * @retval -1 Failure */ -int mutt_write_multiple_fcc(const char *path, struct Header *hdr, const char *msgid, +int mutt_write_multiple_fcc(const char *path, struct Email *hdr, const char *msgid, bool post, char *fcc, char **finalpath) { char fcc_tok[PATH_MAX]; @@ -3158,7 +3158,7 @@ int mutt_write_multiple_fcc(const char *path, struct Header *hdr, const char *ms * @retval 0 Success * @retval -1 Failure */ -int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid, +int mutt_write_fcc(const char *path, struct Email *hdr, const char *msgid, bool post, char *fcc, char **finalpath) { struct Message *msg = NULL; diff --git a/sendlib.h b/sendlib.h index 12c367d6e..4c367868f 100644 --- a/sendlib.h +++ b/sendlib.h @@ -30,7 +30,7 @@ struct Address; struct Body; struct Context; struct Envelope; -struct Header; +struct Email; struct ListHead; struct ParameterList; @@ -54,14 +54,14 @@ extern bool UserAgent; extern short WrapHeaders; char * mutt_body_get_charset(struct Body *b, char *buf, size_t buflen); -int mutt_bounce_message(FILE *fp, struct Header *h, struct Address *to); +int mutt_bounce_message(FILE *fp, struct Email *h, struct Address *to); const char * mutt_fqdn(bool may_hide_host); void mutt_generate_boundary(struct ParameterList *parm); struct Content *mutt_get_content_info(const char *fname, struct Body *b); int mutt_invoke_sendmail(struct Address *from, struct Address *to, struct Address *cc, struct Address *bcc, const char *msg, int eightbit); int mutt_lookup_mime_type(struct Body *att, const char *path); struct Body * mutt_make_file_attach(const char *path); -struct Body * mutt_make_message_attach(struct Context *ctx, struct Header *hdr, bool attach_msg); +struct Body * mutt_make_message_attach(struct Context *ctx, struct Email *hdr, bool attach_msg); struct Body * mutt_make_multipart(struct Body *b); void mutt_message_to_7bit(struct Body *a, FILE *fp); void mutt_prepare_envelope(struct Envelope *env, bool final); @@ -72,10 +72,10 @@ void mutt_stamp_attachment(struct Body *a); void mutt_unprepare_envelope(struct Envelope *env); void mutt_update_encoding(struct Body *a); void mutt_write_address_list(struct Address *addr, FILE *fp, int linelen, bool display); -int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid, bool post, char *fcc, char **finalpath); +int mutt_write_fcc(const char *path, struct Email *hdr, const char *msgid, bool post, char *fcc, char **finalpath); int mutt_write_mime_body(struct Body *a, FILE *f); int mutt_write_mime_header(struct Body *a, FILE *f); -int mutt_write_multiple_fcc(const char *path, struct Header *hdr, const char *msgid, bool post, char *fcc, char **finalpath); +int mutt_write_multiple_fcc(const char *path, struct Email *hdr, const char *msgid, bool post, char *fcc, char **finalpath); int mutt_write_one_header(FILE *fp, const char *tag, const char *value, const char *pfx, int wraplen, int flags); void mutt_write_references(const struct ListHead *r, FILE *f, size_t trim); diff --git a/sort.c b/sort.c index e677aef89..16e51be24 100644 --- a/sort.c +++ b/sort.c @@ -68,7 +68,7 @@ int perform_auxsort(int retval, const void *a, const void *b) /* If the items still match, use their index positions * to maintain a stable sort order */ if (retval == 0) - retval = (*((struct Header **) a))->index - (*((struct Header **) b))->index; + retval = (*((struct Email **) a))->index - (*((struct Email **) b))->index; return retval; } @@ -77,8 +77,8 @@ int perform_auxsort(int retval, const void *a, const void *b) */ static int compare_score(const void *a, const void *b) { - struct Header **pa = (struct Header **) a; - struct Header **pb = (struct Header **) b; + struct Email **pa = (struct Email **) a; + struct Email **pb = (struct Email **) b; int result = (*pb)->score - (*pa)->score; /* note that this is reverse */ result = perform_auxsort(result, a, b); return SORTCODE(result); @@ -89,8 +89,8 @@ static int compare_score(const void *a, const void *b) */ static int compare_size(const void *a, const void *b) { - struct Header **pa = (struct Header **) a; - struct Header **pb = (struct Header **) b; + struct Email **pa = (struct Email **) a; + struct Email **pb = (struct Email **) b; int result = (*pa)->content->length - (*pb)->content->length; result = perform_auxsort(result, a, b); return SORTCODE(result); @@ -101,8 +101,8 @@ static int compare_size(const void *a, const void *b) */ static int compare_date_sent(const void *a, const void *b) { - struct Header **pa = (struct Header **) a; - struct Header **pb = (struct Header **) b; + struct Email **pa = (struct Email **) a; + struct Email **pb = (struct Email **) b; int result = (*pa)->date_sent - (*pb)->date_sent; result = perform_auxsort(result, a, b); return SORTCODE(result); @@ -113,8 +113,8 @@ static int compare_date_sent(const void *a, const void *b) */ static int compare_subject(const void *a, const void *b) { - struct Header **pa = (struct Header **) a; - struct Header **pb = (struct Header **) b; + struct Email **pa = (struct Email **) a; + struct Email **pb = (struct Email **) b; int rc; if (!(*pa)->env->real_subj) @@ -164,8 +164,8 @@ const char *mutt_get_name(struct Address *a) */ static int compare_to(const void *a, const void *b) { - struct Header **ppa = (struct Header **) a; - struct Header **ppb = (struct Header **) b; + struct Email **ppa = (struct Email **) a; + struct Email **ppb = (struct Email **) b; char fa[SHORT_STRING]; mutt_str_strfcpy(fa, mutt_get_name((*ppa)->env->to), SHORT_STRING); @@ -180,8 +180,8 @@ static int compare_to(const void *a, const void *b) */ static int compare_from(const void *a, const void *b) { - struct Header **ppa = (struct Header **) a; - struct Header **ppb = (struct Header **) b; + struct Email **ppa = (struct Email **) a; + struct Email **ppb = (struct Email **) b; char fa[SHORT_STRING]; mutt_str_strfcpy(fa, mutt_get_name((*ppa)->env->from), SHORT_STRING); @@ -196,8 +196,8 @@ static int compare_from(const void *a, const void *b) */ static int compare_date_received(const void *a, const void *b) { - struct Header **pa = (struct Header **) a; - struct Header **pb = (struct Header **) b; + struct Email **pa = (struct Email **) a; + struct Email **pb = (struct Email **) b; int result = (*pa)->received - (*pb)->received; result = perform_auxsort(result, a, b); return SORTCODE(result); @@ -208,8 +208,8 @@ static int compare_date_received(const void *a, const void *b) */ static int compare_order(const void *a, const void *b) { - struct Header **ha = (struct Header **) a; - struct Header **hb = (struct Header **) b; + struct Email **ha = (struct Email **) a; + struct Email **hb = (struct Email **) b; /* no need to auxsort because you will never have equality here */ return SORTCODE((*ha)->index - (*hb)->index); @@ -220,8 +220,8 @@ static int compare_order(const void *a, const void *b) */ static int compare_spam(const void *a, const void *b) { - struct Header **ppa = (struct Header **) a; - struct Header **ppb = (struct Header **) b; + struct Email **ppa = (struct Email **) a; + struct Email **ppb = (struct Email **) b; char *aptr = NULL, *bptr = NULL; int ahas, bhas; int result = 0; @@ -276,8 +276,8 @@ static int compare_spam(const void *a, const void *b) */ static int compare_label(const void *a, const void *b) { - struct Header **ppa = (struct Header **) a; - struct Header **ppb = (struct Header **) b; + struct Email **ppa = (struct Email **) a; + struct Email **ppb = (struct Email **) b; int ahas, bhas, result = 0; /* As with compare_spam, not all messages will have the x-label @@ -351,7 +351,7 @@ sort_t *mutt_get_sort_func(int method) */ void mutt_sort_headers(struct Context *ctx, bool init) { - struct Header *h = NULL; + struct Email *h = NULL; struct MuttThread *thread = NULL, *top = NULL; sort_t *sortfunc = NULL; @@ -414,13 +414,13 @@ void mutt_sort_headers(struct Context *ctx, bool init) } else qsort((void *) ctx->mailbox->hdrs, ctx->mailbox->msg_count, - sizeof(struct Header *), sortfunc); + sizeof(struct Email *), sortfunc); /* adjust the virtual message numbers */ ctx->mailbox->vcount = 0; for (int i = 0; i < ctx->mailbox->msg_count; i++) { - struct Header *cur = ctx->mailbox->hdrs[i]; + struct Email *cur = ctx->mailbox->hdrs[i]; if (cur->virtual != -1 || (cur->collapsed && (!ctx->pattern || cur->limited))) { cur->virtual = ctx->mailbox->vcount;