From 10582a954e73988075fabadb1d257abc486bd7e2 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 5 Jul 2019 15:04:53 +0100 Subject: [PATCH] unify naming of Email vars/params --- commands.c | 118 +++--- commands.h | 2 +- compose.c | 220 +++++------ compose.h | 2 +- edit.c | 36 +- edit.h | 2 +- email/thread.h | 4 +- hdrline.c | 8 +- imap/util.c | 4 +- index.c | 24 +- maildir/lib.h | 2 +- maildir/shared.c | 34 +- main.c | 88 ++--- mbox/mbox.c | 42 +-- mutt_attach.c | 16 +- mutt_header.h | 2 +- mutt_parse.h | 2 +- mutt_thread.c | 189 +++++----- mutt_thread.h | 14 +- ncrypt/crypt.c | 28 +- ncrypt/crypt_gpgme.c | 54 +-- ncrypt/crypt_gpgme.h | 4 +- ncrypt/crypt_mod.h | 4 +- ncrypt/cryptglue.c | 8 +- ncrypt/ncrypt.h | 10 +- ncrypt/pgp.c | 50 +-- ncrypt/pgp.h | 2 +- ncrypt/smime.c | 36 +- ncrypt/smime.h | 2 +- notmuch/mutt_notmuch.c | 6 +- pager.c | 10 +- postpone.c | 80 ++-- protos.h | 4 +- query.c | 10 +- recvcmd.c | 39 +- remailer.c | 14 +- remailer.h | 2 +- send.c | 537 ++++++++++++++------------- send.h | 4 +- sort.c | 8 +- test/email/mutt_email_cmp_strict.c | 8 +- test/email/mutt_email_free.c | 6 +- test/parse/mutt_rfc822_parse_line.c | 12 +- test/parse/mutt_rfc822_read_header.c | 4 +- 44 files changed, 876 insertions(+), 875 deletions(-) diff --git a/commands.c b/commands.c index 9436b2feb..42aef3acd 100644 --- a/commands.c +++ b/commands.c @@ -94,9 +94,9 @@ static char LastSaveFolder[PATH_MAX] = ""; /** * update_protected_headers - Get the protected header and update the index - * @param cur Email to update + * @param e Email to update */ -static void update_protected_headers(struct Email *cur) +static void update_protected_headers(struct Email *e) { struct Envelope *prot_headers = NULL; regmatch_t pmatch[1]; @@ -105,7 +105,7 @@ static void update_protected_headers(struct Email *cur) return; /* Grab protected headers to update in the index */ - if (cur->security & SEC_SIGN) + if (e->security & SEC_SIGN) { /* Don't update on a bad signature. * @@ -113,56 +113,56 @@ static void update_protected_headers(struct Email *cur) * encrypted part of a nested encrypt/signed. But properly handling that * case would require more complexity in the decryption handlers, which * I'm not sure is worth it. */ - if (!(cur->security & SEC_GOODSIGN)) + if (!(e->security & SEC_GOODSIGN)) return; - if (mutt_is_multipart_signed(cur->content) && cur->content->parts) + if (mutt_is_multipart_signed(e->content) && e->content->parts) { - prot_headers = cur->content->parts->mime_headers; + prot_headers = e->content->parts->mime_headers; } - else if (((WithCrypto & APPLICATION_SMIME) != 0) && mutt_is_application_smime(cur->content)) + else if (((WithCrypto & APPLICATION_SMIME) != 0) && mutt_is_application_smime(e->content)) { - prot_headers = cur->content->mime_headers; + prot_headers = e->content->mime_headers; } } - if (!prot_headers && (cur->security & SEC_ENCRYPT)) + if (!prot_headers && (e->security & SEC_ENCRYPT)) { if (((WithCrypto & APPLICATION_PGP) != 0) && - (mutt_is_valid_multipart_pgp_encrypted(cur->content) || - mutt_is_malformed_multipart_pgp_encrypted(cur->content))) + (mutt_is_valid_multipart_pgp_encrypted(e->content) || + mutt_is_malformed_multipart_pgp_encrypted(e->content))) { - prot_headers = cur->content->mime_headers; + prot_headers = e->content->mime_headers; } - else if (((WithCrypto & APPLICATION_SMIME) != 0) && mutt_is_application_smime(cur->content)) + else if (((WithCrypto & APPLICATION_SMIME) != 0) && mutt_is_application_smime(e->content)) { - prot_headers = cur->content->mime_headers; + prot_headers = e->content->mime_headers; } } /* Update protected headers in the index and header cache. */ if (prot_headers && prot_headers->subject && - mutt_str_strcmp(cur->env->subject, prot_headers->subject)) + mutt_str_strcmp(e->env->subject, prot_headers->subject)) { - if (Context->mailbox->subj_hash && cur->env->real_subj) - mutt_hash_delete(Context->mailbox->subj_hash, cur->env->real_subj, cur); + if (Context->mailbox->subj_hash && e->env->real_subj) + mutt_hash_delete(Context->mailbox->subj_hash, e->env->real_subj, e); - mutt_str_replace(&cur->env->subject, prot_headers->subject); - FREE(&cur->env->disp_subj); - if (regexec(C_ReplyRegex->regex, cur->env->subject, 1, pmatch, 0) == 0) - cur->env->real_subj = cur->env->subject + pmatch[0].rm_eo; + mutt_str_replace(&e->env->subject, prot_headers->subject); + FREE(&e->env->disp_subj); + if (regexec(C_ReplyRegex->regex, e->env->subject, 1, pmatch, 0) == 0) + e->env->real_subj = e->env->subject + pmatch[0].rm_eo; else - cur->env->real_subj = cur->env->subject; + e->env->real_subj = e->env->subject; if (Context->mailbox->subj_hash) - mutt_hash_insert(Context->mailbox->subj_hash, cur->env->real_subj, cur); + mutt_hash_insert(Context->mailbox->subj_hash, e->env->real_subj, e); - mx_save_hcache(Context->mailbox, cur); + mx_save_hcache(Context->mailbox, e); /* Also persist back to the message headers if this is set */ if (C_CryptProtectedHeadersSave) { - cur->env->changed |= MUTT_ENV_CHANGED_SUBJECT; - cur->changed = 1; + e->env->changed |= MUTT_ENV_CHANGED_SUBJECT; + e->changed = 1; Context->mailbox->changed = 1; } } @@ -170,11 +170,11 @@ static void update_protected_headers(struct Email *cur) /** * mutt_display_message - Display a message in the pager - * @param cur Current Email + * @param e Email to display * @retval 0 Success * @retval -1 Error */ -int mutt_display_message(struct Email *cur) +int mutt_display_message(struct Email *e) { char tempfile[PATH_MAX], buf[1024]; int rc = 0; @@ -184,24 +184,24 @@ int mutt_display_message(struct Email *cur) pid_t filterpid = -1; int res; - snprintf(buf, sizeof(buf), "%s/%s", TYPE(cur->content), cur->content->subtype); + snprintf(buf, sizeof(buf), "%s/%s", TYPE(e->content), e->content->subtype); - mutt_parse_mime_message(Context->mailbox, cur); - mutt_message_hook(Context->mailbox, cur, MUTT_MESSAGE_HOOK); + mutt_parse_mime_message(Context->mailbox, e); + mutt_message_hook(Context->mailbox, e, MUTT_MESSAGE_HOOK); /* see if crypto is needed for this message. if so, we should exit curses */ - if ((WithCrypto != 0) && cur->security) + if ((WithCrypto != 0) && e->security) { - if (cur->security & SEC_ENCRYPT) + if (e->security & SEC_ENCRYPT) { - if (cur->security & APPLICATION_SMIME) - crypt_smime_getkeys(cur->env); - if (!crypt_valid_passphrase(cur->security)) + if (e->security & APPLICATION_SMIME) + crypt_smime_getkeys(e->env); + if (!crypt_valid_passphrase(e->security)) return 0; cmflags |= MUTT_CM_VERIFY; } - else if (cur->security & SEC_SIGN) + else if (e->security & SEC_SIGN) { /* find out whether or not the verify signature */ /* L10N: Used for the $crypt_verify_sig prompt */ @@ -212,17 +212,17 @@ int mutt_display_message(struct Email *cur) } } - if (cmflags & MUTT_CM_VERIFY || cur->security & SEC_ENCRYPT) + if (cmflags & MUTT_CM_VERIFY || e->security & SEC_ENCRYPT) { - if (cur->security & APPLICATION_PGP) + if (e->security & APPLICATION_PGP) { - if (!TAILQ_EMPTY(&cur->env->from)) - crypt_pgp_invoke_getkeys(TAILQ_FIRST(&cur->env->from)); + if (!TAILQ_EMPTY(&e->env->from)) + crypt_pgp_invoke_getkeys(TAILQ_FIRST(&e->env->from)); crypt_invoke_message(APPLICATION_PGP); } - if (cur->security & APPLICATION_SMIME) + if (e->security & APPLICATION_SMIME) crypt_invoke_message(APPLICATION_SMIME); } @@ -258,7 +258,7 @@ int mutt_display_message(struct Email *cur) hfi.ctx = Context; hfi.mailbox = Context->mailbox; hfi.pager_progress = ExtPagerProgress; - hfi.email = cur; + hfi.email = e; mutt_make_string_info(buf, sizeof(buf), MuttIndexWindow->cols, NONULL(C_PagerFormat), &hfi, MUTT_FORMAT_NO_FLAGS); fputs(buf, fp_out); @@ -270,7 +270,7 @@ int mutt_display_message(struct Email *cur) if (Context->mailbox->magic == MUTT_NOTMUCH) chflags |= CH_VIRTUAL; #endif - res = mutt_copy_message_ctx(fp_out, Context->mailbox, cur, cmflags, chflags); + res = mutt_copy_message_ctx(fp_out, Context->mailbox, e, cmflags, chflags); if (((mutt_file_fclose(&fp_out) != 0) && (errno != EPIPE)) || (res < 0)) { @@ -292,47 +292,47 @@ int mutt_display_message(struct Email *cur) if (WithCrypto) { /* update crypto information for this message */ - cur->security &= ~(SEC_GOODSIGN | SEC_BADSIGN); - cur->security |= crypt_query(cur->content); + e->security &= ~(SEC_GOODSIGN | SEC_BADSIGN); + e->security |= crypt_query(e->content); /* Remove color cache for this message, in case there * are color patterns for both ~g and ~V */ - cur->pair = 0; + e->pair = 0; /* Grab protected headers and update the header and index */ - update_protected_headers(cur); + update_protected_headers(e); } if (builtin) { - if ((WithCrypto != 0) && (cur->security & APPLICATION_SMIME) && (cmflags & MUTT_CM_VERIFY)) + if ((WithCrypto != 0) && (e->security & APPLICATION_SMIME) && (cmflags & MUTT_CM_VERIFY)) { - if (cur->security & SEC_GOODSIGN) + if (e->security & SEC_GOODSIGN) { - if (crypt_smime_verify_sender(cur) == 0) + if (crypt_smime_verify_sender(e) == 0) mutt_message(_("S/MIME signature successfully verified")); else mutt_error(_("S/MIME certificate owner does not match sender")); } - else if (cur->security & SEC_PARTSIGN) + else if (e->security & SEC_PARTSIGN) mutt_message(_("Warning: Part of this message has not been signed")); - else if (cur->security & SEC_SIGN || cur->security & SEC_BADSIGN) + else if (e->security & SEC_SIGN || e->security & SEC_BADSIGN) mutt_error(_("S/MIME signature could NOT be verified")); } - if ((WithCrypto != 0) && (cur->security & APPLICATION_PGP) && (cmflags & MUTT_CM_VERIFY)) + if ((WithCrypto != 0) && (e->security & APPLICATION_PGP) && (cmflags & MUTT_CM_VERIFY)) { - if (cur->security & SEC_GOODSIGN) + if (e->security & SEC_GOODSIGN) mutt_message(_("PGP signature successfully verified")); - else if (cur->security & SEC_PARTSIGN) + else if (e->security & SEC_PARTSIGN) mutt_message(_("Warning: Part of this message has not been signed")); - else if (cur->security & SEC_SIGN) + else if (e->security & SEC_SIGN) mutt_message(_("PGP signature could NOT be verified")); } struct Pager info = { 0 }; /* Invoke the builtin pager */ - info.email = cur; + info.email = e; info.ctx = Context; rc = mutt_pager(NULL, tempfile, MUTT_PAGER_MESSAGE, &info); } @@ -350,7 +350,7 @@ int mutt_display_message(struct Email *cur) if (!OptNoCurses) keypad(stdscr, true); if (r != -1) - mutt_set_flag(Context->mailbox, cur, MUTT_READ, true); + mutt_set_flag(Context->mailbox, e, MUTT_READ, true); if ((r != -1) && C_PromptAfter) { mutt_unget_event(mutt_any_key_to_continue(_("Command: ")), 0); diff --git a/commands.h b/commands.h index 97afe6e0d..e0d5c62a8 100644 --- a/commands.h +++ b/commands.h @@ -47,7 +47,7 @@ void ci_bounce_message(struct Mailbox *m, struct EmailList *el); void mutt_check_stats(void); bool mutt_check_traditional_pgp(struct EmailList *el, MuttRedrawFlags *redraw); void mutt_display_address(struct Envelope *env); -int mutt_display_message(struct Email *cur); +int mutt_display_message(struct Email *e); bool mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp); void mutt_enter_command(void); void mutt_pipe_message(struct Mailbox *m, struct EmailList *el); diff --git a/compose.c b/compose.c index f4a6e7290..7a392c978 100644 --- a/compose.c +++ b/compose.c @@ -873,16 +873,16 @@ static void compose_status_line(char *buf, size_t buflen, size_t col, int cols, /** * mutt_compose_menu - Allow the user to edit the message envelope - * @param msg Message to fill + * @param e Email to fill * @param fcc Buffer to save FCC * @param fcclen Length of FCC buffer - * @param cur Current message + * @param e_cur Current message * @param flags Flags, e.g. #MUTT_COMPOSE_NOFREEHEADER * @retval 1 Message should be postponed * @retval 0 Normal exit * @retval -1 Abort message */ -int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email *cur, int flags) +int mutt_compose_menu(struct Email *e, char *fcc, size_t fcclen, struct Email *e_cur, int flags) { char helpstr[1024]; // This isn't copied by the help bar char buf[PATH_MAX]; @@ -897,7 +897,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email init_header_padding(); - rd.email = msg; + rd.email = e; rd.fcc = fcc; struct Menu *menu = mutt_menu_new(MENU_COMPOSE); @@ -915,7 +915,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_menu_push_current(menu); struct AttachCtx *actx = mutt_mem_calloc(sizeof(struct AttachCtx), 1); - actx->email = msg; + actx->email = e; mutt_update_compose_menu(actx, menu, true); while (loop) @@ -927,8 +927,8 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email switch (op) { case OP_COMPOSE_EDIT_FROM: - edit_address_list(HDR_FROM, &msg->env->from); - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + edit_address_list(HDR_FROM, &e->env->from); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_EDIT_TO: @@ -936,13 +936,13 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email if (news) break; #endif - edit_address_list(HDR_TO, &msg->env->to); + edit_address_list(HDR_TO, &e->env->to); if (C_CryptOpportunisticEncrypt) { - crypt_opportunistic_encrypt(msg); - redraw_crypt_lines(msg); + crypt_opportunistic_encrypt(e); + redraw_crypt_lines(e); } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_EDIT_BCC: @@ -950,13 +950,13 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email if (news) break; #endif - edit_address_list(HDR_BCC, &msg->env->bcc); + edit_address_list(HDR_BCC, &e->env->bcc); if (C_CryptOpportunisticEncrypt) { - crypt_opportunistic_encrypt(msg); - redraw_crypt_lines(msg); + crypt_opportunistic_encrypt(e); + redraw_crypt_lines(e); } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_EDIT_CC: @@ -964,28 +964,28 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email if (news) break; #endif - edit_address_list(HDR_CC, &msg->env->cc); + edit_address_list(HDR_CC, &e->env->cc); if (C_CryptOpportunisticEncrypt) { - crypt_opportunistic_encrypt(msg); - redraw_crypt_lines(msg); + crypt_opportunistic_encrypt(e); + redraw_crypt_lines(e); } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; #ifdef USE_NNTP case OP_COMPOSE_EDIT_NEWSGROUPS: if (!news) break; - if (msg->env->newsgroups) - mutt_str_strfcpy(buf, msg->env->newsgroups, sizeof(buf)); + if (e->env->newsgroups) + mutt_str_strfcpy(buf, e->env->newsgroups, sizeof(buf)); else buf[0] = '\0'; if (mutt_get_field("Newsgroups: ", buf, sizeof(buf), 0) == 0) { - mutt_str_replace(&msg->env->newsgroups, buf); + mutt_str_replace(&e->env->newsgroups, buf); mutt_window_move(MuttIndexWindow, HDR_TO, HDR_XOFFSET); - if (msg->env->newsgroups) - mutt_paddstr(W, msg->env->newsgroups); + if (e->env->newsgroups) + mutt_paddstr(W, e->env->newsgroups); else clrtoeol(); } @@ -994,16 +994,16 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email case OP_COMPOSE_EDIT_FOLLOWUP_TO: if (!news) break; - if (msg->env->followup_to) - mutt_str_strfcpy(buf, msg->env->followup_to, sizeof(buf)); + if (e->env->followup_to) + mutt_str_strfcpy(buf, e->env->followup_to, sizeof(buf)); else buf[0] = '\0'; if (mutt_get_field("Followup-To: ", buf, sizeof(buf), 0) == 0) { - mutt_str_replace(&msg->env->followup_to, buf); + mutt_str_replace(&e->env->followup_to, buf); mutt_window_move(MuttIndexWindow, HDR_CC, HDR_XOFFSET); - if (msg->env->followup_to) - mutt_paddstr(W, msg->env->followup_to); + if (e->env->followup_to) + mutt_paddstr(W, e->env->followup_to); else clrtoeol(); } @@ -1012,16 +1012,16 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email case OP_COMPOSE_EDIT_X_COMMENT_TO: if (!(news && C_XCommentTo)) break; - if (msg->env->x_comment_to) - mutt_str_strfcpy(buf, msg->env->x_comment_to, sizeof(buf)); + if (e->env->x_comment_to) + mutt_str_strfcpy(buf, e->env->x_comment_to, sizeof(buf)); else buf[0] = '\0'; if (mutt_get_field("X-Comment-To: ", buf, sizeof(buf), 0) == 0) { - mutt_str_replace(&msg->env->x_comment_to, buf); + mutt_str_replace(&e->env->x_comment_to, buf); mutt_window_move(MuttIndexWindow, HDR_BCC, HDR_XOFFSET); - if (msg->env->x_comment_to) - mutt_paddstr(W, msg->env->x_comment_to); + if (e->env->x_comment_to) + mutt_paddstr(W, e->env->x_comment_to); else clrtoeol(); } @@ -1029,25 +1029,25 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email #endif case OP_COMPOSE_EDIT_SUBJECT: - if (msg->env->subject) - mutt_str_strfcpy(buf, msg->env->subject, sizeof(buf)); + if (e->env->subject) + mutt_str_strfcpy(buf, e->env->subject, sizeof(buf)); else buf[0] = '\0'; if (mutt_get_field(_("Subject: "), buf, sizeof(buf), 0) == 0) { - mutt_str_replace(&msg->env->subject, buf); + mutt_str_replace(&e->env->subject, buf); mutt_window_move(MuttIndexWindow, HDR_SUBJECT, HDR_XOFFSET); - if (msg->env->subject) - mutt_paddstr(W, msg->env->subject); + if (e->env->subject) + mutt_paddstr(W, e->env->subject); else mutt_window_clrtoeol(MuttIndexWindow); } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_EDIT_REPLY_TO: - edit_address_list(HDR_REPLYTO, &msg->env->reply_to); - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + edit_address_list(HDR_REPLYTO, &e->env->reply_to); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_EDIT_FCC: @@ -1060,16 +1060,16 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_paddstr(W, fcc); fcc_set = true; } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_EDIT_MESSAGE: if (C_Editor && (mutt_str_strcmp("builtin", C_Editor) != 0) && !C_EditHeaders) { - mutt_edit_file(C_Editor, msg->content->filename); - mutt_update_encoding(msg->content); + mutt_edit_file(C_Editor, e->content->filename); + mutt_update_encoding(e->content); menu->redraw = REDRAW_FULL; - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; } /* fallthrough */ @@ -1080,15 +1080,15 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email { const char *tag = NULL; char *err = NULL; - mutt_env_to_local(msg->env); - mutt_edit_headers(NONULL(C_Editor), msg->content->filename, msg, fcc, fcclen); - if (mutt_env_to_intl(msg->env, &tag, &err)) + mutt_env_to_local(e->env); + mutt_edit_headers(NONULL(C_Editor), e->content->filename, e, fcc, fcclen); + if (mutt_env_to_intl(e->env, &tag, &err)) { mutt_error(_("Bad IDN in '%s': '%s'"), tag, err); FREE(&err); } if (C_CryptOpportunisticEncrypt) - crypt_opportunistic_encrypt(msg); + crypt_opportunistic_encrypt(e); } else { @@ -1096,9 +1096,9 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email * attachment list could change if the user invokes ~v to edit * the message with headers, in which we need to execute the * code below to regenerate the index array */ - mutt_builtin_editor(msg->content->filename, msg, cur); + mutt_builtin_editor(e->content->filename, e, e_cur); } - mutt_update_encoding(msg->content); + mutt_update_encoding(e->content); /* attachments may have been added */ if (actx->idxlen && actx->idx[actx->idxlen - 1]->content->next) @@ -1108,7 +1108,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email } menu->redraw = REDRAW_FULL; - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_ATTACH_KEY: @@ -1127,7 +1127,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email menu->redraw |= REDRAW_STATUS; - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; } @@ -1142,7 +1142,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_error(_("The fundamental part can't be moved")); break; } - compose_attach_swap(msg->content, actx->idx, menu->current - 1); + compose_attach_swap(e->content, actx->idx, menu->current - 1); menu->redraw = REDRAW_INDEX; menu->current--; break; @@ -1158,7 +1158,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_error(_("The fundamental part can't be moved")); break; } - compose_attach_swap(msg->content, actx->idx, menu->current); + compose_attach_swap(e->content, actx->idx, menu->current); menu->redraw = REDRAW_INDEX; menu->current++; break; @@ -1179,7 +1179,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email struct Body *alts = NULL; /* group tagged message into a multipart/alternative */ - struct Body *bptr = msg->content; + struct Body *bptr = e->content; for (int i = 0; bptr;) { if (bptr->tagged) @@ -1201,7 +1201,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email } /* append bptr to the alts list, - * and remove from the msg->content list */ + * and remove from the e->content list */ if (!alts) { group->parts = bptr; @@ -1256,7 +1256,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email /* traverse to see whether all the parts have Content-Language: set */ int tagged_with_lang_num = 0; - for (struct Body *b = msg->content; b; b = b->next) + for (struct Body *b = e->content; b; b = b->next) if (b->tagged && b->language && *b->language) tagged_with_lang_num++; @@ -1277,7 +1277,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email struct Body *alts = NULL; /* group tagged message into a multipart/multilingual */ - struct Body *bptr = msg->content; + struct Body *bptr = e->content; for (int i = 0; bptr;) { if (bptr->tagged) @@ -1299,7 +1299,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email } /* append bptr to the alts list, - * and remove from the msg->content list */ + * and remove from the e->content list */ if (!alts) { group->parts = bptr; @@ -1385,7 +1385,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_clear_error(); menu->redraw |= REDRAW_INDEX | REDRAW_STATUS; - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; } @@ -1514,7 +1514,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email /* Restore old $sort and $sort_aux */ C_Sort = old_sort; C_SortAux = old_sort_aux; - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; } @@ -1526,9 +1526,9 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email break; mutt_update_compose_menu(actx, menu, false); if (menu->current == 0) - msg->content = actx->idx[0]->content; + e->content = actx->idx[0]->content; - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_TOGGLE_RECODE: @@ -1545,7 +1545,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email else mutt_message(_("The current attachment will be converted")); menu->redraw = REDRAW_CURRENT; - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; } @@ -1560,7 +1560,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_str_replace(&CUR_ATTACH->content->description, buf); menu->redraw = REDRAW_CURRENT; } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_UPDATE_ENCODING: @@ -1568,7 +1568,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email if (menu->tagprefix) { struct Body *top = NULL; - for (top = msg->content; top; top = top->next) + for (top = e->content; top; top = top->next) { if (top->tagged) mutt_update_encoding(top); @@ -1580,7 +1580,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_update_encoding(CUR_ATTACH->content); menu->redraw = REDRAW_CURRENT | REDRAW_STATUS; } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_TOGGLE_DISPOSITION: @@ -1600,7 +1600,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email menu->redraw = REDRAW_CURRENT; } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_EDIT_LANGUAGE: @@ -1616,7 +1616,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email } else mutt_warning(_("Empty 'Content-Language'")); - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_EDIT_ENCODING: @@ -1635,7 +1635,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email else mutt_error(_("Invalid encoding")); } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_SEND_MESSAGE: @@ -1648,7 +1648,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email } #ifdef MIXMASTER - if (!STAILQ_EMPTY(&msg->chain) && (mix_check_message(msg) != 0)) + if (!STAILQ_EMPTY(&e->chain) && (mix_check_message(e) != 0)) break; #endif @@ -1671,7 +1671,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_edit_file(NONULL(C_Editor), CUR_ATTACH->content->filename); mutt_update_encoding(CUR_ATTACH->content); menu->redraw = REDRAW_CURRENT | REDRAW_STATUS; - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_TOGGLE_UNLINK: @@ -1686,7 +1686,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email CHECK_COUNT; if (menu->tagprefix) { - for (struct Body *top = msg->content; top; top = top->next) + for (struct Body *top = e->content; top; top = top->next) { if (top->tagged) mutt_get_tmp_attachment(top); @@ -1744,7 +1744,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email if (CUR_ATTACH->content->stamp >= st.st_mtime) mutt_stamp_attachment(CUR_ATTACH->content); } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_COMPOSE_NEW_MIME: @@ -1809,7 +1809,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_update_encoding(CUR_ATTACH->content); menu->redraw = REDRAW_FULL; } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; } @@ -1820,7 +1820,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_update_encoding(CUR_ATTACH->content); menu->redraw = REDRAW_FULL; } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_VIEW_ATTACH: @@ -1852,7 +1852,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email if (op == OP_FILTER) /* cte might have changed */ menu->redraw = menu->tagprefix ? REDRAW_FULL : REDRAW_CURRENT; menu->redraw |= REDRAW_STATUS; - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_EXIT: @@ -1897,12 +1897,12 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email case OP_COMPOSE_ISPELL: endwin(); - snprintf(buf, sizeof(buf), "%s -x %s", NONULL(C_Ispell), msg->content->filename); + snprintf(buf, sizeof(buf), "%s -x %s", NONULL(C_Ispell), e->content->filename); if (mutt_system(buf) == -1) mutt_error(_("Error running \"%s\""), buf); else { - mutt_update_encoding(msg->content); + mutt_update_encoding(e->content); menu->redraw |= REDRAW_STATUS; } break; @@ -1915,18 +1915,18 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_pretty_mailbox(buf, sizeof(buf)); } if (actx->idxlen) - msg->content = actx->idx[0]->content; + e->content = actx->idx[0]->content; if ((mutt_enter_fname(_("Write message to mailbox"), buf, sizeof(buf), true) != -1) && (buf[0] != '\0')) { mutt_message(_("Writing message to %s ..."), buf); mutt_expand_path(buf, sizeof(buf)); - if (msg->content->next) - msg->content = mutt_make_multipart(msg->content); + if (e->content->next) + e->content = mutt_make_multipart(e->content); - if (mutt_write_fcc(buf, msg, NULL, false, NULL, NULL) < 0) - msg->content = mutt_remove_multipart(msg->content); + if (mutt_write_fcc(buf, e, NULL, false, NULL, NULL) < 0) + e->content = mutt_remove_multipart(e->content); else mutt_message(_("Message written")); } @@ -1940,25 +1940,25 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_error(_("No PGP backend configured")); break; } - if (((WithCrypto & APPLICATION_SMIME) != 0) && (msg->security & APPLICATION_SMIME)) + if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME)) { - if (msg->security & (SEC_ENCRYPT | SEC_SIGN)) + if (e->security & (SEC_ENCRYPT | SEC_SIGN)) { if (mutt_yesorno(_("S/MIME already selected. Clear and continue?"), MUTT_YES) != MUTT_YES) { mutt_clear_error(); break; } - msg->security &= ~(SEC_ENCRYPT | SEC_SIGN); + e->security &= ~(SEC_ENCRYPT | SEC_SIGN); } - msg->security &= ~APPLICATION_SMIME; - msg->security |= APPLICATION_PGP; - crypt_opportunistic_encrypt(msg); - redraw_crypt_lines(msg); + e->security &= ~APPLICATION_SMIME; + e->security |= APPLICATION_PGP; + crypt_opportunistic_encrypt(e); + redraw_crypt_lines(e); } - msg->security = crypt_pgp_send_menu(msg); - redraw_crypt_lines(msg); - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + e->security = crypt_pgp_send_menu(e); + redraw_crypt_lines(e); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; case OP_FORGET_PASSPHRASE: @@ -1974,31 +1974,31 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email break; } - if (((WithCrypto & APPLICATION_PGP) != 0) && (msg->security & APPLICATION_PGP)) + if (((WithCrypto & APPLICATION_PGP) != 0) && (e->security & APPLICATION_PGP)) { - if (msg->security & (SEC_ENCRYPT | SEC_SIGN)) + if (e->security & (SEC_ENCRYPT | SEC_SIGN)) { if (mutt_yesorno(_("PGP already selected. Clear and continue?"), MUTT_YES) != MUTT_YES) { mutt_clear_error(); break; } - msg->security &= ~(SEC_ENCRYPT | SEC_SIGN); + e->security &= ~(SEC_ENCRYPT | SEC_SIGN); } - msg->security &= ~APPLICATION_PGP; - msg->security |= APPLICATION_SMIME; - crypt_opportunistic_encrypt(msg); - redraw_crypt_lines(msg); + e->security &= ~APPLICATION_PGP; + e->security |= APPLICATION_SMIME; + crypt_opportunistic_encrypt(e); + redraw_crypt_lines(e); } - msg->security = crypt_smime_send_menu(msg); - redraw_crypt_lines(msg); - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + e->security = crypt_smime_send_menu(e); + redraw_crypt_lines(e); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; #ifdef MIXMASTER case OP_COMPOSE_MIX: - mix_make_chain(&msg->chain); - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mix_make_chain(&e->chain); + mutt_message_hook(NULL, e, MUTT_SEND2_HOOK); break; #endif } @@ -2008,9 +2008,9 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email mutt_menu_destroy(&menu); if (actx->idxlen) - msg->content = actx->idx[0]->content; + e->content = actx->idx[0]->content; else - msg->content = NULL; + e->content = NULL; mutt_actx_free(&actx); diff --git a/compose.h b/compose.h index 986400ac9..386b2a722 100644 --- a/compose.h +++ b/compose.h @@ -35,6 +35,6 @@ extern unsigned char C_Postpone; /* flags for mutt_compose_menu() */ #define MUTT_COMPOSE_NOFREEHEADER (1 << 0) -int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email *cur, int flags); +int mutt_compose_menu(struct Email *e, char *fcc, size_t fcclen, struct Email *e_cur, int flags); #endif /* MUTT_COMPOSE_H */ diff --git a/edit.c b/edit.c index 72f5fa6af..84249f467 100644 --- a/edit.c +++ b/edit.c @@ -393,12 +393,12 @@ static void be_edit_header(struct Envelope *e, bool force) /** * mutt_builtin_editor - Show the user the built-in editor * @param path File to read - * @param msg New Email - * @param cur Current Email + * @param e_new New Email + * @param e_cur Current Email * @retval 0 Success * @retval -1 Error */ -int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur) +int mutt_builtin_editor(const char *path, struct Email *e_new, struct Email *e_cur) { char **buf = NULL; int bufmax = 0, buflen = 0; @@ -409,7 +409,7 @@ int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur) scrollok(stdscr, true); - be_edit_header(msg->env, false); + be_edit_header(e_new->env, false); addstr(_("(End message with a . on a line by itself)\n")); @@ -442,15 +442,15 @@ int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur) addstr(_(EditorHelp2)); break; case 'b': - mutt_addrlist_parse2(&msg->env->bcc, p); - mutt_expand_aliases(&msg->env->bcc); + mutt_addrlist_parse2(&e_new->env->bcc, p); + mutt_expand_aliases(&e_new->env->bcc); break; case 'c': - mutt_addrlist_parse2(&msg->env->cc, p); - mutt_expand_aliases(&msg->env->cc); + mutt_addrlist_parse2(&e_new->env->cc, p); + mutt_expand_aliases(&e_new->env->cc); break; case 'h': - be_edit_header(msg->env, true); + be_edit_header(e_new->env, true); break; case 'F': case 'f': @@ -458,12 +458,12 @@ int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur) case 'M': if (Context) { - if (!*p && cur) + if (!*p && e_cur) { /* include the current message */ p = tmp + mutt_str_strlen(tmp) + 1; snprintf(tmp + mutt_str_strlen(tmp), - sizeof(tmp) - mutt_str_strlen(tmp), " %d", cur->msgno + 1); + sizeof(tmp) - mutt_str_strlen(tmp), " %d", e_cur->msgno + 1); } buf = be_include_messages(p, buf, &bufmax, &buflen, (tolower(tmp[1]) == 'm'), (isupper((unsigned char) tmp[1]))); @@ -474,7 +474,7 @@ int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur) case 'p': addstr("-----\n"); addstr(_("Message contains:\n")); - be_print_header(msg->env); + be_print_header(e_new->env); for (int i = 0; i < buflen; i++) addstr(buf[i]); /* L10N: This entry is shown AFTER the message content, @@ -497,11 +497,11 @@ int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur) addstr(_("missing filename.\n")); break; case 's': - mutt_str_replace(&msg->env->subject, p); + mutt_str_replace(&e_new->env->subject, p); break; case 't': - mutt_addrlist_parse(&msg->env->to, p); - mutt_expand_aliases(&msg->env->to); + mutt_addrlist_parse(&e_new->env->to, p); + mutt_expand_aliases(&e_new->env->to); break; case 'u': if (buflen) @@ -530,9 +530,9 @@ int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur) if (C_EditHeaders) { - mutt_env_to_local(msg->env); - mutt_edit_headers(NONULL(C_Visual), path, msg, NULL, 0); - if (mutt_env_to_intl(msg->env, &tag, &err)) + mutt_env_to_local(e_new->env); + mutt_edit_headers(NONULL(C_Visual), path, e_new, NULL, 0); + if (mutt_env_to_intl(e_new->env, &tag, &err)) printw(_("Bad IDN in '%s': '%s'"), tag, err); /* tag is a statically allocated string and should not be freed */ FREE(&err); diff --git a/edit.h b/edit.h index 85dd58db0..93c5cabe3 100644 --- a/edit.h +++ b/edit.h @@ -28,6 +28,6 @@ struct Email; /* These Config Variables are only used in edit.c */ extern char *C_Escape; -int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur); +int mutt_builtin_editor(const char *path, struct Email *e_new, struct Email *e_cur); #endif /* MUTT_EDIT_H */ diff --git a/email/thread.h b/email/thread.h index 44ded2094..a432d9cad 100644 --- a/email/thread.h +++ b/email/thread.h @@ -29,7 +29,7 @@ struct Email; /** - * struct MuttThread - An email conversation + * struct MuttThread - An Email conversation */ struct MuttThread { @@ -50,7 +50,7 @@ struct MuttThread }; void clean_references(struct MuttThread *brk, struct MuttThread *cur); -struct Email *find_virtual(struct MuttThread *cur, int reverse); +struct Email * find_virtual(struct MuttThread *cur, int reverse); void insert_message(struct MuttThread **add, struct MuttThread *parent, struct MuttThread *cur); bool is_descendant(struct MuttThread *a, struct MuttThread *b); void mutt_break_thread(struct Email *e); diff --git a/hdrline.c b/hdrline.c index f9f22805d..96e85f8fc 100644 --- a/hdrline.c +++ b/hdrline.c @@ -1290,19 +1290,19 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co bool label = true; if (e->env->x_label) { - struct Email *etmp = NULL; + struct Email *e_tmp = NULL; if (flags & MUTT_FORMAT_TREE && (e->thread->prev && e->thread->prev->message && e->thread->prev->message->env->x_label)) { - etmp = e->thread->prev->message; + e_tmp = e->thread->prev->message; } else if (flags & MUTT_FORMAT_TREE && (e->thread->parent && e->thread->parent->message && e->thread->parent->message->env->x_label)) { - etmp = e->thread->parent->message; + e_tmp = e->thread->parent->message; } - if (etmp && (mutt_str_strcasecmp(e->env->x_label, etmp->env->x_label) == 0)) + if (e_tmp && (mutt_str_strcasecmp(e->env->x_label, e_tmp->env->x_label) == 0)) label = false; } else diff --git a/imap/util.c b/imap/util.c index 1e7f2131f..6b4e18d17 100644 --- a/imap/util.c +++ b/imap/util.c @@ -358,8 +358,8 @@ static void imap_msn_index_to_uid_seqset(struct Buffer *b, struct ImapMboxData * bool match = false; if (msn <= mdata->max_msn) { - struct Email *cur_header = mdata->msn_index[msn - 1]; - cur_uid = cur_header ? imap_edata_get(cur_header)->uid : 0; + struct Email *e_cur = mdata->msn_index[msn - 1]; + cur_uid = e_cur ? imap_edata_get(e_cur)->uid : 0; if (!state || (cur_uid && ((cur_uid - 1) == last_uid))) match = true; last_uid = cur_uid; diff --git a/index.c b/index.c index c084ff9b2..10bcbccca 100644 --- a/index.c +++ b/index.c @@ -402,7 +402,7 @@ static int mx_toggle_write(struct Mailbox *m) */ static void resort_index(struct Menu *menu) { - struct Email *current = CUR_EMAIL; + struct Email *e = CUR_EMAIL; menu->current = -1; mutt_sort_headers(Context, false); @@ -410,7 +410,7 @@ static void resort_index(struct Menu *menu) for (int i = 0; i < Context->mailbox->vcount; i++) { - if (Context->mailbox->emails[Context->mailbox->v2r[i]] == current) + if (Context->mailbox->emails[Context->mailbox->v2r[i]] == e) { menu->current = i; break; @@ -418,7 +418,7 @@ static void resort_index(struct Menu *menu) } if (((C_Sort & SORT_MASK) == SORT_THREADS) && (menu->current < 0)) - menu->current = mutt_parent_message(Context, current, false); + menu->current = mutt_parent_message(Context, e, false); if (menu->current < 0) menu->current = ci_first_message(); @@ -1467,7 +1467,7 @@ int mutt_index_menu(void) /* at least one message has been loaded */ if (Context->mailbox->msg_count > oldmsgcount) { - struct Email *oldcur = CUR_EMAIL; + struct Email *e_oldcur = CUR_EMAIL; struct Email *e = NULL; bool quiet = Context->mailbox->quiet; @@ -1480,7 +1480,7 @@ int mutt_index_menu(void) * update the index */ if (menu->menu == MENU_PAGER) { - menu->current = oldcur->vnum; + menu->current = e_oldcur->vnum; menu->redraw = REDRAW_STATUS | REDRAW_INDEX; op = OP_DISPLAY_MESSAGE; continue; @@ -1983,7 +1983,7 @@ int mutt_index_menu(void) main_change_folder(menu, op, NULL, buf, sizeof(buf), &oldcount, &index_hint); } oldcount = Context->mailbox->msg_count; - struct Email *oldcur = CUR_EMAIL; + struct Email *e_oldcur = CUR_EMAIL; if (nm_read_entire_thread(Context->mailbox, CUR_EMAIL) < 0) { mutt_message(_("Failed to read thread, aborting")); @@ -1992,10 +1992,10 @@ int mutt_index_menu(void) if (oldcount < Context->mailbox->msg_count) { /* nm_read_entire_thread() triggers mutt_sort_headers() if necessary */ - menu->current = oldcur->vnum; + menu->current = e_oldcur->vnum; menu->redraw = REDRAW_STATUS | REDRAW_INDEX; - if (oldcur->collapsed || Context->collapsed) + if (e_oldcur->collapsed || Context->collapsed) { menu->current = mutt_uncollapse_thread(Context, CUR_EMAIL); mutt_set_vnum(Context); @@ -2400,11 +2400,11 @@ int mutt_index_menu(void) !STAILQ_EMPTY(&CUR_EMAIL->env->references)) { { - struct Email *oldcur = CUR_EMAIL; + struct Email *e_oldcur = CUR_EMAIL; mutt_break_thread(CUR_EMAIL); mutt_sort_headers(Context, true); - menu->current = oldcur->vnum; + menu->current = e_oldcur->vnum; } Context->mailbox->changed = true; @@ -2441,14 +2441,14 @@ int mutt_index_menu(void) mutt_error(_("First, please tag a message to be linked here")); else { - struct Email *oldcur = CUR_EMAIL; + struct Email *e_oldcur = CUR_EMAIL; struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, Context, Context->last_tag, tag); if (mutt_link_threads(CUR_EMAIL, &el, Context->mailbox)) { mutt_sort_headers(Context, true); - menu->current = oldcur->vnum; + menu->current = e_oldcur->vnum; Context->mailbox->changed = true; mutt_message(_("Threads linked")); diff --git a/maildir/lib.h b/maildir/lib.h index 3b4291077..c99f22f0c 100644 --- a/maildir/lib.h +++ b/maildir/lib.h @@ -63,7 +63,7 @@ FILE * maildir_open_find_message(const char *folder, const char *msg, cha void maildir_parse_flags (struct Email *e, const char *path); struct Email *maildir_parse_message (enum MailboxType magic, const char *fname, bool is_old, struct Email *e); struct Email *maildir_parse_stream (enum MailboxType magic, FILE *fp, const char *fname, bool is_old, struct Email *e); -bool maildir_update_flags (struct Mailbox *m, struct Email *o, struct Email *n); +bool maildir_update_flags (struct Mailbox *m, struct Email *e_old, struct Email *e_new); int mh_check_empty (const char *path); int mh_sync_mailbox_message (struct Mailbox *m, int msgno, header_cache_t *hc); diff --git a/maildir/shared.c b/maildir/shared.c index b96856293..9d0573621 100644 --- a/maildir/shared.c +++ b/maildir/shared.c @@ -869,14 +869,14 @@ int mh_read_dir(struct Mailbox *m, const char *subdir) */ int maildir_mh_open_message(struct Mailbox *m, struct Message *msg, int msgno, bool is_maildir) { - struct Email *cur = m->emails[msgno]; + struct Email *e = m->emails[msgno]; char path[PATH_MAX]; - snprintf(path, sizeof(path), "%s/%s", mutt_b2s(m->pathbuf), cur->path); + snprintf(path, sizeof(path), "%s/%s", mutt_b2s(m->pathbuf), e->path); msg->fp = fopen(path, "r"); if (!msg->fp && (errno == ENOENT) && is_maildir) - msg->fp = maildir_open_find_message(mutt_b2s(m->pathbuf), cur->path, NULL); + msg->fp = maildir_open_find_message(mutt_b2s(m->pathbuf), e->path, NULL); if (!msg->fp) { @@ -1490,13 +1490,13 @@ int mh_sync_mailbox_message(struct Mailbox *m, int msgno, header_cache_t *hc) /** * maildir_update_flags - Update the mailbox flags - * @param m Mailbox - * @param o Old Email - * @param n New Email + * @param m Mailbox + * @param e_old Old Email + * @param e_new New Email * @retval true If the flags changed * @retval false Otherwise */ -bool maildir_update_flags(struct Mailbox *m, struct Email *o, struct Email *n) +bool maildir_update_flags(struct Mailbox *m, struct Email *e_old, struct Email *e_new) { if (!m) return false; @@ -1510,21 +1510,21 @@ bool maildir_update_flags(struct Mailbox *m, struct Email *o, struct Email *n) * anything. mutt_set_flag() will just ignore the call if the status * bits are already properly set, but it is still faster not to pass * through it */ - if (o->flagged != n->flagged) - mutt_set_flag(m, o, MUTT_FLAG, n->flagged); - if (o->replied != n->replied) - mutt_set_flag(m, o, MUTT_REPLIED, n->replied); - if (o->read != n->read) - mutt_set_flag(m, o, MUTT_READ, n->read); - if (o->old != n->old) - mutt_set_flag(m, o, MUTT_OLD, n->old); + if (e_old->flagged != e_new->flagged) + mutt_set_flag(m, e_old, MUTT_FLAG, e_new->flagged); + if (e_old->replied != e_new->replied) + mutt_set_flag(m, e_old, MUTT_REPLIED, e_new->replied); + if (e_old->read != e_new->read) + mutt_set_flag(m, e_old, MUTT_READ, e_new->read); + if (e_old->old != e_new->old) + mutt_set_flag(m, e_old, MUTT_OLD, e_new->old); /* mutt_set_flag() will set this, but we don't need to * sync the changes we made because we just updated the * context to match the current on-disk state of the * message. */ - bool header_changed = o->changed; - o->changed = false; + bool header_changed = e_old->changed; + e_old->changed = false; /* if the mailbox was not modified before we made these * changes, unset the changed flag since nothing needs to diff --git a/main.c b/main.c index 3e9e84b54..b451faaa7 100644 --- a/main.c +++ b/main.c @@ -414,7 +414,7 @@ int main(int argc, char *argv[], char *envp[]) #ifdef USE_NNTP char *cli_nntp = NULL; #endif - struct Email *msg = NULL; + struct Email *e = NULL; struct ListHead attach = STAILQ_HEAD_INITIALIZER(attach); struct ListHead commands = STAILQ_HEAD_INITIALIZER(commands); struct ListHead queries = STAILQ_HEAD_INITIALIZER(queries); @@ -646,18 +646,18 @@ int main(int argc, char *argv[], char *envp[]) if (!STAILQ_EMPTY(&cc_list) || !STAILQ_EMPTY(&bcc_list)) { - msg = mutt_email_new(); - msg->env = mutt_env_new(); + e = mutt_email_new(); + e->env = mutt_env_new(); struct ListNode *np = NULL; STAILQ_FOREACH(np, &bcc_list, entries) { - mutt_addrlist_parse(&msg->env->bcc, np->data); + mutt_addrlist_parse(&e->env->bcc, np->data); } STAILQ_FOREACH(np, &cc_list, entries) { - mutt_addrlist_parse(&msg->env->cc, np->data); + mutt_addrlist_parse(&e->env->cc, np->data); } mutt_list_free(&bcc_list); @@ -842,7 +842,7 @@ int main(int argc, char *argv[], char *envp[]) repeat_error = true; goto main_curses; } - else if (subject || msg || sendflags || draft_file || include_file || + else if (subject || e || sendflags || draft_file || include_file || !STAILQ_EMPTY(&attach) || (optind < argc)) { FILE *fp_in = NULL; @@ -855,34 +855,34 @@ int main(int argc, char *argv[], char *envp[]) if (!OptNoCurses) mutt_flushinp(); - if (!msg) - msg = mutt_email_new(); - if (!msg->env) - msg->env = mutt_env_new(); + if (!e) + e = mutt_email_new(); + if (!e->env) + e->env = mutt_env_new(); for (i = optind; i < argc; i++) { if (url_check_scheme(argv[i]) == U_MAILTO) { - if (mutt_parse_mailto(msg->env, &bodytext, argv[i]) < 0) + if (mutt_parse_mailto(e->env, &bodytext, argv[i]) < 0) { mutt_error(_("Failed to parse mailto: link")); goto main_curses; // TEST25: neomutt mailto: } } else - mutt_addrlist_parse(&msg->env->to, argv[i]); + mutt_addrlist_parse(&e->env->to, argv[i]); } - if (!draft_file && C_Autoedit && TAILQ_EMPTY(&msg->env->to) && - TAILQ_EMPTY(&msg->env->cc)) + if (!draft_file && C_Autoedit && TAILQ_EMPTY(&e->env->to) && + TAILQ_EMPTY(&e->env->cc)) { mutt_error(_("No recipients specified")); goto main_curses; // TEST26: neomutt -s test (with autoedit=yes) } if (subject) - msg->env->subject = mutt_str_strdup(subject); + e->env->subject = mutt_str_strdup(subject); if (draft_file) { @@ -963,57 +963,57 @@ int main(int argc, char *argv[], char *envp[]) /* Parse the draft_file into the full Email/Body structure. * Set SEND_DRAFT_FILE so ci_send_message doesn't overwrite - * our msg->content. */ + * our e->content. */ if (draft_file) { - struct Envelope *opts_env = msg->env; + struct Envelope *opts_env = e->env; struct stat st; sendflags |= SEND_DRAFT_FILE; - /* Set up a "context" header with just enough information so that + /* Set up a tmp Email with just enough information so that * mutt_prepare_template() can parse the message in fp_in. */ - struct Email *context_hdr = mutt_email_new(); - context_hdr->offset = 0; - context_hdr->content = mutt_body_new(); + struct Email *e_tmp = mutt_email_new(); + e_tmp->offset = 0; + e_tmp->content = mutt_body_new(); if (fstat(fileno(fp_in), &st) != 0) { mutt_perror(draft_file); goto main_curses; // TEST31: can't test } - context_hdr->content->length = st.st_size; + e_tmp->content->length = st.st_size; - if (mutt_prepare_template(fp_in, NULL, msg, context_hdr, false) < 0) + if (mutt_prepare_template(fp_in, NULL, e, e_tmp, false) < 0) { mutt_error(_("Can't parse message template: %s"), draft_file); mutt_env_free(&opts_env); - mutt_email_free(&context_hdr); + mutt_email_free(&e_tmp); goto main_curses; } /* Scan for neomutt header to set C_ResumeDraftFiles */ struct ListNode *np = NULL, *tmp = NULL; - STAILQ_FOREACH_SAFE(np, &msg->env->userhdrs, entries, tmp) + STAILQ_FOREACH_SAFE(np, &e->env->userhdrs, entries, tmp) { if (mutt_str_startswith(np->data, "X-Mutt-Resume-Draft:", CASE_IGNORE)) { if (C_ResumeEditedDraftFiles) cs_str_native_set(Config, "resume_draft_files", true, NULL); - STAILQ_REMOVE(&msg->env->userhdrs, np, ListNode, entries); + STAILQ_REMOVE(&e->env->userhdrs, np, ListNode, entries); FREE(&np->data); FREE(&np); } } - mutt_addrlist_copy(&msg->env->to, &opts_env->to, false); - mutt_addrlist_copy(&msg->env->cc, &opts_env->cc, false); - mutt_addrlist_copy(&msg->env->bcc, &opts_env->bcc, false); + mutt_addrlist_copy(&e->env->to, &opts_env->to, false); + mutt_addrlist_copy(&e->env->cc, &opts_env->cc, false); + mutt_addrlist_copy(&e->env->bcc, &opts_env->bcc, false); if (opts_env->subject) - mutt_str_replace(&msg->env->subject, opts_env->subject); + mutt_str_replace(&e->env->subject, opts_env->subject); mutt_env_free(&opts_env); - mutt_email_free(&context_hdr); + mutt_email_free(&e_tmp); } /* Editing the include_file: pass it directly in. * Note that SEND_NO_FREE_HEADER is set above so it isn't unlinked. */ @@ -1031,7 +1031,7 @@ int main(int argc, char *argv[], char *envp[]) if (!STAILQ_EMPTY(&attach)) { - struct Body *b = msg->content; + struct Body *b = e->content; while (b && b->next) b = b->next; @@ -1047,7 +1047,7 @@ int main(int argc, char *argv[], char *envp[]) else { b = mutt_make_file_attach(np->data); - msg->content = b; + e->content = b; } if (!b) { @@ -1059,7 +1059,7 @@ int main(int argc, char *argv[], char *envp[]) mutt_list_free(&attach); } - rv = ci_send_message(sendflags, msg, bodyfile, NULL, NULL); + rv = ci_send_message(sendflags, e, bodyfile, NULL, NULL); /* We WANT the "Mail sent." and any possible, later error */ log_queue_empty(); if (ErrorBufMessage) @@ -1068,7 +1068,7 @@ int main(int argc, char *argv[], char *envp[]) if (edit_infile) { if (include_file) - msg->content->unlink = false; + e->content->unlink = false; else if (draft_file) { if (truncate(expanded_infile, 0) == -1) @@ -1087,20 +1087,20 @@ int main(int argc, char *argv[], char *envp[]) * have been done. */ if (rv < 0) { - if (msg->content->next) - msg->content = mutt_make_multipart(msg->content); - mutt_encode_descriptions(msg->content, true); - mutt_prepare_envelope(msg->env, false); - mutt_env_to_intl(msg->env, NULL, NULL); + if (e->content->next) + e->content = mutt_make_multipart(e->content); + mutt_encode_descriptions(e->content, true); + mutt_prepare_envelope(e->env, false); + mutt_env_to_intl(e->env, NULL, NULL); } mutt_rfc822_write_header( - fp_out, msg->env, msg->content, MUTT_WRITE_HEADER_POSTPONE, false, - C_CryptProtectedHeadersRead && mutt_should_hide_protected_subject(msg)); + fp_out, e->env, e->content, MUTT_WRITE_HEADER_POSTPONE, false, + C_CryptProtectedHeadersRead && mutt_should_hide_protected_subject(e)); if (C_ResumeEditedDraftFiles) fprintf(fp_out, "X-Mutt-Resume-Draft: 1\n"); fputc('\n', fp_out); - if ((mutt_write_mime_body(msg->content, fp_out) == -1)) + if ((mutt_write_mime_body(e->content, fp_out) == -1)) { mutt_file_fclose(&fp_out); goto main_curses; // TEST35: can't test @@ -1108,7 +1108,7 @@ int main(int argc, char *argv[], char *envp[]) mutt_file_fclose(&fp_out); } - mutt_email_free(&msg); + mutt_email_free(&e); } /* !edit_infile && draft_file will leave the tempfile around */ diff --git a/mbox/mbox.c b/mbox/mbox.c index 313f21bc3..6248ed5ae 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -558,7 +558,7 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) return -1; bool (*cmp_headers)(const struct Email *, const struct Email *) = NULL; - struct Email **old_hdrs = NULL; + struct Email **e_old = NULL; int old_msg_count; bool msg_mod = false; int rc = -1; @@ -575,7 +575,7 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) C_Sort = old_sort; } - old_hdrs = NULL; + e_old = NULL; old_msg_count = 0; /* simulate a close */ @@ -594,7 +594,7 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) { /* save the old headers */ old_msg_count = m->msg_count; - old_hdrs = m->emails; + e_old = m->emails; m->emails = NULL; } @@ -635,8 +635,8 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) { /* free the old headers */ for (int i = 0; i < old_msg_count; i++) - mutt_email_free(&(old_hdrs[i])); - FREE(&old_hdrs); + mutt_email_free(&(e_old[i])); + FREE(&e_old); m->quiet = false; return -1; @@ -659,9 +659,9 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) int j; for (j = i; j < old_msg_count; j++) { - if (!old_hdrs[j]) + if (!e_old[j]) continue; - if (cmp_headers(m->emails[i], old_hdrs[j])) + if (cmp_headers(m->emails[i], e_old[j])) { found = true; break; @@ -671,9 +671,9 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) { for (j = 0; (j < i) && (j < old_msg_count); j++) { - if (!old_hdrs[j]) + if (!e_old[j]) continue; - if (cmp_headers(m->emails[i], old_hdrs[j])) + if (cmp_headers(m->emails[i], e_old[j])) { found = true; break; @@ -687,35 +687,35 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) if (index_hint && (*index_hint == j)) *index_hint = i; - if (old_hdrs[j]->changed) + if (e_old[j]->changed) { /* Only update the flags if the old header was changed; * otherwise, the header may have been modified externally, * and we don't want to lose _those_ changes */ - mutt_set_flag(m, m->emails[i], MUTT_FLAG, old_hdrs[j]->flagged); - mutt_set_flag(m, m->emails[i], MUTT_REPLIED, old_hdrs[j]->replied); - mutt_set_flag(m, m->emails[i], MUTT_OLD, old_hdrs[j]->old); - mutt_set_flag(m, m->emails[i], MUTT_READ, old_hdrs[j]->read); + mutt_set_flag(m, m->emails[i], MUTT_FLAG, e_old[j]->flagged); + mutt_set_flag(m, m->emails[i], MUTT_REPLIED, e_old[j]->replied); + mutt_set_flag(m, m->emails[i], MUTT_OLD, e_old[j]->old); + mutt_set_flag(m, m->emails[i], MUTT_READ, e_old[j]->read); } - mutt_set_flag(m, m->emails[i], MUTT_DELETE, old_hdrs[j]->deleted); - mutt_set_flag(m, m->emails[i], MUTT_PURGE, old_hdrs[j]->purge); - mutt_set_flag(m, m->emails[i], MUTT_TAG, old_hdrs[j]->tagged); + mutt_set_flag(m, m->emails[i], MUTT_DELETE, e_old[j]->deleted); + mutt_set_flag(m, m->emails[i], MUTT_PURGE, e_old[j]->purge); + mutt_set_flag(m, m->emails[i], MUTT_TAG, e_old[j]->tagged); /* we don't need this header any more */ - mutt_email_free(&(old_hdrs[j])); + mutt_email_free(&(e_old[j])); } } /* free the remaining old headers */ for (int j = 0; j < old_msg_count; j++) { - if (old_hdrs[j]) + if (e_old[j]) { - mutt_email_free(&(old_hdrs[j])); + mutt_email_free(&(e_old[j])); msg_mod = true; } } - FREE(&old_hdrs); + FREE(&e_old); } m->quiet = false; diff --git a/mutt_attach.c b/mutt_attach.c index 76699b382..403403b76 100644 --- a/mutt_attach.c +++ b/mutt_attach.c @@ -810,9 +810,9 @@ int mutt_save_attachment(FILE *fp, struct Body *m, const char *path, CopyHeaderFlags chflags = CH_NO_FLAGS; int rc = -1; - struct Email *en = m->email; - en->msgno = e->msgno; /* required for MH/maildir */ - en->read = true; + struct Email *e_new = m->email; + e_new->msgno = e->msgno; /* required for MH/maildir */ + e_new->read = true; if (fseeko(fp, m->offset, SEEK_SET) < 0) return -1; @@ -825,7 +825,7 @@ int mutt_save_attachment(FILE *fp, struct Body *m, const char *path, mailbox_free(&m_att); return -1; } - msg = mx_msg_open_new(ctx->mailbox, en, + msg = mx_msg_open_new(ctx->mailbox, e_new, is_from(buf, NULL, 0, NULL) ? MUTT_MSG_NO_FLAGS : MUTT_ADD_FROM); if (!msg) { @@ -835,7 +835,7 @@ int mutt_save_attachment(FILE *fp, struct Body *m, const char *path, if ((ctx->mailbox->magic == MUTT_MBOX) || (ctx->mailbox->magic == MUTT_MMDF)) chflags = CH_FROM | CH_UPDATE_LEN; chflags |= ((ctx->mailbox->magic == MUTT_MAILDIR) ? CH_NOSTATUS : CH_UPDATE); - if ((mutt_copy_message_fp(msg->fp, fp, en, MUTT_CM_NO_FLAGS, chflags) == 0) && + if ((mutt_copy_message_fp(msg->fp, fp, e_new, MUTT_CM_NO_FLAGS, chflags) == 0) && (mx_msg_commit(ctx->mailbox, msg) == 0)) { rc = 0; @@ -927,7 +927,7 @@ int mutt_decode_save_attachment(FILE *fp, struct Body *m, const char *path, struct State s = { 0 }; unsigned int saved_encoding = 0; struct Body *saved_parts = NULL; - struct Email *saved_hdr = NULL; + struct Email *e_saved = NULL; int rc = 0; s.flags = displaying; @@ -972,7 +972,7 @@ int mutt_decode_save_attachment(FILE *fp, struct Body *m, const char *path, m->length = st.st_size; m->offset = 0; saved_parts = m->parts; - saved_hdr = m->email; + e_saved = m->email; mutt_parse_part(s.fp_in, m); if (m->noconv || is_multipart(m)) @@ -999,7 +999,7 @@ int mutt_decode_save_attachment(FILE *fp, struct Body *m, const char *path, { mutt_email_free(&m->email); m->parts = saved_parts; - m->email = saved_hdr; + m->email = e_saved; } mutt_file_fclose(&s.fp_in); } diff --git a/mutt_header.h b/mutt_header.h index 1589b7885..98f23eefa 100644 --- a/mutt_header.h +++ b/mutt_header.h @@ -29,7 +29,7 @@ struct Context; struct Email; struct EmailList; -void mutt_edit_headers(const char *editor, const char *body, struct Email *msg, char *fcc, size_t fcclen); +void mutt_edit_headers(const char *editor, const char *body, struct Email *e, char *fcc, size_t fcclen); void mutt_label_hash_add(struct Mailbox *m, struct Email *e); void mutt_label_hash_remove(struct Mailbox *m, struct Email *e); int mutt_label_message(struct Mailbox *m, struct EmailList *el); diff --git a/mutt_parse.h b/mutt_parse.h index c7f4e94bf..07084ba2c 100644 --- a/mutt_parse.h +++ b/mutt_parse.h @@ -28,6 +28,6 @@ struct Email; struct Mailbox; int mutt_count_body_parts(struct Mailbox *m, struct Email *e); -void mutt_parse_mime_message(struct Mailbox *m, struct Email *cur); +void mutt_parse_mime_message(struct Mailbox *m, struct Email *e); #endif /* MUTT_MUTT_PARSE_H */ diff --git a/mutt_thread.c b/mutt_thread.c index 17db4b649..c804bda71 100644 --- a/mutt_thread.c +++ b/mutt_thread.c @@ -795,33 +795,33 @@ static void check_subjects(struct Mailbox *m, bool init) if (!m) return; - struct Email *cur = NULL; + struct Email *e = NULL; struct MuttThread *tmp = NULL; for (int i = 0; i < m->msg_count; i++) { - cur = m->emails[i]; - if (cur->thread->check_subject) - cur->thread->check_subject = false; + e = m->emails[i]; + if (e->thread->check_subject) + e->thread->check_subject = false; else if (!init) continue; /* figure out which messages have subjects different than their parents' */ - tmp = cur->thread->parent; + tmp = e->thread->parent; while (tmp && !tmp->message) { tmp = tmp->parent; } if (!tmp) - cur->subject_changed = true; - else if (cur->env->real_subj && tmp->message->env->real_subj) + e->subject_changed = true; + else if (e->env->real_subj && tmp->message->env->real_subj) { - cur->subject_changed = - (mutt_str_strcmp(cur->env->real_subj, tmp->message->env->real_subj) != 0); + e->subject_changed = + (mutt_str_strcmp(e->env->real_subj, tmp->message->env->real_subj) != 0); } else { - cur->subject_changed = (cur->env->real_subj || tmp->message->env->real_subj); + e->subject_changed = (e->env->real_subj || tmp->message->env->real_subj); } } } @@ -838,7 +838,7 @@ void mutt_sort_threads(struct Context *ctx, bool init) struct Mailbox *m = ctx->mailbox; - struct Email *cur = NULL; + struct Email *e = NULL; int i, oldsort, using_refs = 0; struct MuttThread *thread = NULL, *tnew = NULL, *tmp = NULL; struct MuttThread top = { 0 }; @@ -875,20 +875,20 @@ void mutt_sort_threads(struct Context *ctx, bool init) * MuttThread, make a new one for it. */ for (i = 0; i < m->msg_count; i++) { - cur = m->emails[i]; + e = m->emails[i]; - if (!cur->thread) + if (!e->thread) { - if ((!init || C_DuplicateThreads) && cur->env->message_id) - thread = mutt_hash_find(ctx->thread_hash, cur->env->message_id); + if ((!init || C_DuplicateThreads) && e->env->message_id) + thread = mutt_hash_find(ctx->thread_hash, e->env->message_id); else thread = NULL; if (thread && !thread->message) { /* this is a message which was missing before */ - thread->message = cur; - cur->thread = thread; + thread->message = e; + e->thread = thread; thread->check_subject = true; /* mark descendants as needing subject_changed checked */ @@ -926,18 +926,18 @@ void mutt_sort_threads(struct Context *ctx, bool init) tnew = (C_DuplicateThreads ? thread : NULL); thread = mutt_mem_calloc(1, sizeof(struct MuttThread)); - thread->message = cur; + thread->message = e; thread->check_subject = true; - cur->thread = thread; + e->thread = thread; mutt_hash_insert(ctx->thread_hash, - cur->env->message_id ? cur->env->message_id : "", thread); + e->env->message_id ? e->env->message_id : "", thread); if (tnew) { if (tnew->duplicate_thread) tnew = tnew->parent; - thread = cur->thread; + thread = e->thread; insert_message(&tnew->child, tnew, thread); thread->duplicate_thread = true; @@ -949,7 +949,7 @@ void mutt_sort_threads(struct Context *ctx, bool init) { /* unlink pseudo-threads because they might be children of newly * arrived messages */ - thread = cur->thread; + thread = e->thread; for (tnew = thread->child; tnew;) { tmp = tnew->next; @@ -967,12 +967,12 @@ void mutt_sort_threads(struct Context *ctx, bool init) /* thread by references */ for (i = 0; i < m->msg_count; i++) { - cur = m->emails[i]; - if (cur->threaded) + e = m->emails[i]; + if (e->threaded) continue; - cur->threaded = true; + e->threaded = true; - thread = cur->thread; + thread = e->thread; using_refs = 0; while (true) @@ -980,12 +980,12 @@ void mutt_sort_threads(struct Context *ctx, bool init) if (using_refs == 0) { /* look at the beginning of in-reply-to: */ - ref = STAILQ_FIRST(&cur->env->in_reply_to); + ref = STAILQ_FIRST(&e->env->in_reply_to); if (ref) using_refs = 1; else { - ref = STAILQ_FIRST(&cur->env->references); + ref = STAILQ_FIRST(&e->env->references); using_refs = 2; } } @@ -996,14 +996,14 @@ void mutt_sort_threads(struct Context *ctx, bool init) * if it's different than the first in-reply-to, otherwise use * the second reference (since at least eudora puts the most * recent reference in in-reply-to and the rest in references) */ - if (STAILQ_EMPTY(&cur->env->references)) + if (STAILQ_EMPTY(&e->env->references)) ref = STAILQ_NEXT(ref, entries); else { - if (mutt_str_strcmp(ref->data, STAILQ_FIRST(&cur->env->references)->data) != 0) - ref = STAILQ_FIRST(&cur->env->references); + if (mutt_str_strcmp(ref->data, STAILQ_FIRST(&e->env->references)->data) != 0) + ref = STAILQ_FIRST(&e->env->references); else - ref = STAILQ_NEXT(STAILQ_FIRST(&cur->env->references), entries); + ref = STAILQ_NEXT(STAILQ_FIRST(&e->env->references), entries); using_refs = 2; } @@ -1077,7 +1077,7 @@ void mutt_sort_threads(struct Context *ctx, bool init) int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads) { struct MuttThread *cur = NULL; - struct Email *tmp = NULL; + struct Email *e_tmp = NULL; if ((C_Sort & SORT_MASK) != SORT_THREADS) { @@ -1113,8 +1113,8 @@ int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads) cur = cur->next; if (!cur) return -1; - tmp = find_virtual(cur, 0); - } while (!tmp); + e_tmp = find_virtual(cur, 0); + } while (!e_tmp); } else { @@ -1123,11 +1123,11 @@ int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads) cur = cur->prev; if (!cur) return -1; - tmp = find_virtual(cur, 1); - } while (!tmp); + e_tmp = find_virtual(cur, 1); + } while (!e_tmp); } - return tmp->vnum; + return e_tmp->vnum; } /** @@ -1141,7 +1141,7 @@ int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads) int mutt_parent_message(struct Context *ctx, struct Email *e, bool find_root) { struct MuttThread *thread = NULL; - struct Email *parent = NULL; + struct Email *e_parent = NULL; if ((C_Sort & SORT_MASK) != SORT_THREADS) { @@ -1151,25 +1151,25 @@ int mutt_parent_message(struct Context *ctx, struct Email *e, bool find_root) /* Root may be the current message */ if (find_root) - parent = e; + e_parent = e; for (thread = e->thread->parent; thread; thread = thread->parent) { e = thread->message; if (e) { - parent = e; + e_parent = e; if (!find_root) break; } } - if (!parent) + if (!e_parent) { mutt_error(_("Parent message is not available")); return -1; } - if (!is_visible(parent, ctx)) + if (!is_visible(e_parent, ctx)) { if (find_root) mutt_error(_("Root message is not visible in this limited view")); @@ -1177,7 +1177,7 @@ int mutt_parent_message(struct Context *ctx, struct Email *e, bool find_root) mutt_error(_("Parent message is not visible in this limited view")); return -1; } - return parent->vnum; + return e_parent->vnum; } /** @@ -1191,7 +1191,7 @@ void mutt_set_vnum(struct Context *ctx) struct Mailbox *m = ctx->mailbox; - struct Email *cur = NULL; + struct Email *e = NULL; m->vcount = 0; ctx->vsize = 0; @@ -1199,80 +1199,79 @@ void mutt_set_vnum(struct Context *ctx) for (int i = 0; i < m->msg_count; i++) { - cur = m->emails[i]; - if (cur->vnum >= 0) + e = m->emails[i]; + if (e->vnum >= 0) { - cur->vnum = m->vcount; + e->vnum = m->vcount; m->v2r[m->vcount] = i; m->vcount++; - ctx->vsize += cur->content->length + cur->content->offset - - cur->content->hdr_offset + padding; - cur->num_hidden = mutt_get_hidden(ctx, cur); + ctx->vsize += e->content->length + e->content->offset - e->content->hdr_offset + padding; + e->num_hidden = mutt_get_hidden(ctx, e); } } } /** * mutt_traverse_thread - Recurse through an email thread, matching messages - * @param ctx Mailbox - * @param cur Current Email - * @param flag Flag to set, see #MuttThreadFlags + * @param ctx Mailbox + * @param e_cur Current Email + * @param flag Flag to set, see #MuttThreadFlags * @retval num Number of matches */ -int mutt_traverse_thread(struct Context *ctx, struct Email *cur, MuttThreadFlags flag) +int mutt_traverse_thread(struct Context *ctx, struct Email *e_cur, MuttThreadFlags flag) { struct MuttThread *thread = NULL, *top = NULL; - struct Email *roothdr = NULL; + struct Email *e_root = NULL; int final, reverse = (C_Sort & SORT_REVERSE), minmsgno; int num_hidden = 0, new_mail = 0, old_mail = 0; bool flagged = false; - int min_unread_msgno = INT_MAX, min_unread = cur->vnum; -#define CHECK_LIMIT (!ctx->pattern || cur->limited) + int min_unread_msgno = INT_MAX, min_unread = e_cur->vnum; +#define CHECK_LIMIT (!ctx->pattern || e_cur->limited) if (((C_Sort & SORT_MASK) != SORT_THREADS) && !(flag & MUTT_THREAD_GET_HIDDEN)) { mutt_error(_("Threading is not enabled")); - return cur->vnum; + return e_cur->vnum; } - final = cur->vnum; - thread = cur->thread; + final = e_cur->vnum; + thread = e_cur->thread; while (thread->parent) thread = thread->parent; top = thread; while (!thread->message) thread = thread->child; - cur = thread->message; - minmsgno = cur->msgno; + e_cur = thread->message; + minmsgno = e_cur->msgno; - if (!cur->read && CHECK_LIMIT) + if (!e_cur->read && CHECK_LIMIT) { - if (cur->old) + if (e_cur->old) old_mail = 2; else new_mail = 1; - if (cur->msgno < min_unread_msgno) + if (e_cur->msgno < min_unread_msgno) { - min_unread = cur->vnum; - min_unread_msgno = cur->msgno; + min_unread = e_cur->vnum; + min_unread_msgno = e_cur->msgno; } } - if (cur->flagged && CHECK_LIMIT) + if (e_cur->flagged && CHECK_LIMIT) flagged = true; - if ((cur->vnum == -1) && CHECK_LIMIT) + if ((e_cur->vnum == -1) && CHECK_LIMIT) num_hidden++; if (flag & (MUTT_THREAD_COLLAPSE | MUTT_THREAD_UNCOLLAPSE)) { - cur->pair = 0; /* force index entry's color to be re-evaluated */ - cur->collapsed = flag & MUTT_THREAD_COLLAPSE; - if (cur->vnum != -1) + e_cur->pair = 0; /* force index entry's color to be re-evaluated */ + e_cur->collapsed = flag & MUTT_THREAD_COLLAPSE; + if (e_cur->vnum != -1) { - roothdr = cur; + e_root = e_cur; if (flag & MUTT_THREAD_COLLAPSE) - final = roothdr->vnum; + final = e_root->vnum; } } @@ -1293,56 +1292,56 @@ int mutt_traverse_thread(struct Context *ctx, struct Email *cur, MuttThreadFlags while (true) { - cur = thread->message; + e_cur = thread->message; - if (cur) + if (e_cur) { if (flag & (MUTT_THREAD_COLLAPSE | MUTT_THREAD_UNCOLLAPSE)) { - cur->pair = 0; /* force index entry's color to be re-evaluated */ - cur->collapsed = flag & MUTT_THREAD_COLLAPSE; - if (!roothdr && CHECK_LIMIT) + e_cur->pair = 0; /* force index entry's color to be re-evaluated */ + e_cur->collapsed = flag & MUTT_THREAD_COLLAPSE; + if (!e_root && CHECK_LIMIT) { - roothdr = cur; + e_root = e_cur; if (flag & MUTT_THREAD_COLLAPSE) - final = roothdr->vnum; + final = e_root->vnum; } - if (reverse && (flag & MUTT_THREAD_COLLAPSE) && (cur->msgno < minmsgno) && CHECK_LIMIT) + if (reverse && (flag & MUTT_THREAD_COLLAPSE) && (e_cur->msgno < minmsgno) && CHECK_LIMIT) { - minmsgno = cur->msgno; - final = cur->vnum; + minmsgno = e_cur->msgno; + final = e_cur->vnum; } if (flag & MUTT_THREAD_COLLAPSE) { - if (cur != roothdr) - cur->vnum = -1; + if (e_cur != e_root) + e_cur->vnum = -1; } else { if (CHECK_LIMIT) - cur->vnum = cur->msgno; + e_cur->vnum = e_cur->msgno; } } - if (!cur->read && CHECK_LIMIT) + if (!e_cur->read && CHECK_LIMIT) { - if (cur->old) + if (e_cur->old) old_mail = 2; else new_mail = 1; - if (cur->msgno < min_unread_msgno) + if (e_cur->msgno < min_unread_msgno) { - min_unread = cur->vnum; - min_unread_msgno = cur->msgno; + min_unread = e_cur->vnum; + min_unread_msgno = e_cur->msgno; } } - if (cur->flagged && CHECK_LIMIT) + if (e_cur->flagged && CHECK_LIMIT) flagged = true; - if ((cur->vnum == -1) && CHECK_LIMIT) + if ((e_cur->vnum == -1) && CHECK_LIMIT) num_hidden++; } diff --git a/mutt_thread.h b/mutt_thread.h index aebc67567..c51c1ae89 100644 --- a/mutt_thread.h +++ b/mutt_thread.h @@ -52,13 +52,13 @@ typedef uint8_t MuttThreadFlags; ///< Flags, e.g. #MUTT_THREAD_COLLAPSE #define MUTT_THREAD_NEXT_UNREAD (1 << 4) ///< Find the next unread email #define MUTT_THREAD_FLAGGED (1 << 5) ///< Count flagged emails in a thread -int mutt_traverse_thread(struct Context *ctx, struct Email *cur, MuttThreadFlags flag); -#define mutt_collapse_thread(ctx, cur) mutt_traverse_thread(ctx, cur, MUTT_THREAD_COLLAPSE) -#define mutt_uncollapse_thread(ctx, cur) mutt_traverse_thread(ctx, cur, MUTT_THREAD_UNCOLLAPSE) -#define mutt_get_hidden(ctx, cur) mutt_traverse_thread(ctx, cur, MUTT_THREAD_GET_HIDDEN) -#define mutt_thread_contains_unread(ctx, cur) mutt_traverse_thread(ctx, cur, MUTT_THREAD_UNREAD) -#define mutt_thread_contains_flagged(ctx, cur) mutt_traverse_thread(ctx, cur, MUTT_THREAD_FLAGGED) -#define mutt_thread_next_unread(ctx, cur) mutt_traverse_thread(ctx, cur, MUTT_THREAD_NEXT_UNREAD) +int mutt_traverse_thread(struct Context *ctx, struct Email *e, MuttThreadFlags flag); +#define mutt_collapse_thread(ctx, e) mutt_traverse_thread(ctx, e, MUTT_THREAD_COLLAPSE) +#define mutt_uncollapse_thread(ctx, e) mutt_traverse_thread(ctx, e, MUTT_THREAD_UNCOLLAPSE) +#define mutt_get_hidden(ctx, e) mutt_traverse_thread(ctx, e, MUTT_THREAD_GET_HIDDEN) +#define mutt_thread_contains_unread(ctx, e) mutt_traverse_thread(ctx, e, MUTT_THREAD_UNREAD) +#define mutt_thread_contains_flagged(ctx, e) mutt_traverse_thread(ctx, e, MUTT_THREAD_FLAGGED) +#define mutt_thread_next_unread(ctx, e) mutt_traverse_thread(ctx, e, MUTT_THREAD_NEXT_UNREAD) int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads); #define mutt_next_thread(e) mutt_aside_thread(e, true, false) diff --git a/ncrypt/crypt.c b/ncrypt/crypt.c index 65bdc0f18..40a9d9dd0 100644 --- a/ncrypt/crypt.c +++ b/ncrypt/crypt.c @@ -901,7 +901,7 @@ void crypt_extract_keys_from_messages(struct EmailList *el) /** * crypt_get_keys - Check we have all the keys we need - * @param[in] msg Message with addresses to match + * @param[in] e Email with addresses to match * @param[out] keylist Keys needed * @param[in] oppenc_mode If true, use opportunistic encryption * @retval 0 Success @@ -913,7 +913,7 @@ void crypt_extract_keys_from_messages(struct EmailList *el) * If oppenc_mode is true, only keys that can be determined without * prompting will be used. */ -int crypt_get_keys(struct Email *msg, char **keylist, bool oppenc_mode) +int crypt_get_keys(struct Email *e, char **keylist, bool oppenc_mode) { if (!WithCrypto) return 0; @@ -928,17 +928,17 @@ int crypt_get_keys(struct Email *msg, char **keylist, bool oppenc_mode) if (WithCrypto & APPLICATION_PGP) OptPgpCheckTrust = true; - mutt_addrlist_copy(&addrlist, &msg->env->to, false); - mutt_addrlist_copy(&addrlist, &msg->env->cc, false); - mutt_addrlist_copy(&addrlist, &msg->env->bcc, false); + mutt_addrlist_copy(&addrlist, &e->env->to, false); + mutt_addrlist_copy(&addrlist, &e->env->cc, false); + mutt_addrlist_copy(&addrlist, &e->env->bcc, false); mutt_addrlist_qualify(&addrlist, fqdn); mutt_addrlist_dedupe(&addrlist); *keylist = NULL; - if (oppenc_mode || (msg->security & SEC_ENCRYPT)) + if (oppenc_mode || (e->security & SEC_ENCRYPT)) { - if (((WithCrypto & APPLICATION_PGP) != 0) && (msg->security & APPLICATION_PGP)) + if (((WithCrypto & APPLICATION_PGP) != 0) && (e->security & APPLICATION_PGP)) { *keylist = crypt_pgp_find_keys(&addrlist, oppenc_mode); if (!*keylist) @@ -950,7 +950,7 @@ int crypt_get_keys(struct Email *msg, char **keylist, bool oppenc_mode) if (C_PgpSelfEncrypt || (C_PgpEncryptSelf == MUTT_YES)) self_encrypt = C_PgpDefaultKey; } - if (((WithCrypto & APPLICATION_SMIME) != 0) && (msg->security & APPLICATION_SMIME)) + if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME)) { *keylist = crypt_smime_find_keys(&addrlist, oppenc_mode); if (!*keylist) @@ -977,30 +977,30 @@ int crypt_get_keys(struct Email *msg, char **keylist, bool oppenc_mode) /** * crypt_opportunistic_encrypt - Can all recipients be determined - * @param msg Email + * @param e Email * * Check if all recipients keys can be automatically determined. * Enable encryption if they can, otherwise disable encryption. */ -void crypt_opportunistic_encrypt(struct Email *msg) +void crypt_opportunistic_encrypt(struct Email *e) { if (!WithCrypto) return; - if (!(C_CryptOpportunisticEncrypt && (msg->security & SEC_OPPENCRYPT))) + if (!(C_CryptOpportunisticEncrypt && (e->security & SEC_OPPENCRYPT))) return; char *pgpkeylist = NULL; - crypt_get_keys(msg, &pgpkeylist, 1); + crypt_get_keys(e, &pgpkeylist, 1); if (pgpkeylist) { - msg->security |= SEC_ENCRYPT; + e->security |= SEC_ENCRYPT; FREE(&pgpkeylist); } else { - msg->security &= ~SEC_ENCRYPT; + e->security &= ~SEC_ENCRYPT; } } diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 44d52500b..6f4e6eef9 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -5395,11 +5395,11 @@ void smime_gpgme_init(void) /** * gpgme_send_menu - Show the user the encryption/signing menu - * @param msg Email + * @param e Email * @param is_smime True if an SMIME message * @retval num Flags, e.g. #APPLICATION_SMIME | #SEC_ENCRYPT */ -static int gpgme_send_menu(struct Email *msg, int is_smime) +static int gpgme_send_menu(struct Email *e, int is_smime) { struct CryptKeyInfo *p = NULL; const char *prompt = NULL; @@ -5408,15 +5408,15 @@ static int gpgme_send_menu(struct Email *msg, int is_smime) int choice; if (is_smime) - msg->security |= APPLICATION_SMIME; + e->security |= APPLICATION_SMIME; else - msg->security |= APPLICATION_PGP; + e->security |= APPLICATION_PGP; /* Opportunistic encrypt is controlling encryption. * NOTE: "Signing" and "Clearing" only adjust the sign bit, so we have different * letter choices for those. */ - if (C_CryptOpportunisticEncrypt && (msg->security & SEC_OPPENCRYPT)) + if (C_CryptOpportunisticEncrypt && (e->security & SEC_OPPENCRYPT)) { if (is_smime) { @@ -5497,25 +5497,25 @@ static int gpgme_send_menu(struct Email *msg, int is_smime) mutt_str_replace(is_smime ? &C_SmimeDefaultKey : &C_PgpSignAs, input_signas); crypt_free_key(&p); - msg->security |= SEC_SIGN; + e->security |= SEC_SIGN; } break; case 'b': /* (b)oth */ - msg->security |= (SEC_ENCRYPT | SEC_SIGN); + e->security |= (SEC_ENCRYPT | SEC_SIGN); break; case 'C': - msg->security &= ~SEC_SIGN; + e->security &= ~SEC_SIGN; break; case 'c': /* (c)lear */ - msg->security &= ~(SEC_ENCRYPT | SEC_SIGN); + e->security &= ~(SEC_ENCRYPT | SEC_SIGN); break; case 'e': /* (e)ncrypt */ - msg->security |= SEC_ENCRYPT; - msg->security &= ~SEC_SIGN; + e->security |= SEC_ENCRYPT; + e->security &= ~SEC_SIGN; break; case 'm': /* (p)gp or s/(m)ime */ @@ -5523,54 +5523,54 @@ static int gpgme_send_menu(struct Email *msg, int is_smime) is_smime = !is_smime; if (is_smime) { - msg->security &= ~APPLICATION_PGP; - msg->security |= APPLICATION_SMIME; + e->security &= ~APPLICATION_PGP; + e->security |= APPLICATION_SMIME; } else { - msg->security &= ~APPLICATION_SMIME; - msg->security |= APPLICATION_PGP; + e->security &= ~APPLICATION_SMIME; + e->security |= APPLICATION_PGP; } - crypt_opportunistic_encrypt(msg); + crypt_opportunistic_encrypt(e); break; case 'O': /* oppenc mode on */ - msg->security |= SEC_OPPENCRYPT; - crypt_opportunistic_encrypt(msg); + e->security |= SEC_OPPENCRYPT; + crypt_opportunistic_encrypt(e); break; case 'o': /* oppenc mode off */ - msg->security &= ~SEC_OPPENCRYPT; + e->security &= ~SEC_OPPENCRYPT; break; case 'S': /* (s)ign in oppenc mode */ - msg->security |= SEC_SIGN; + e->security |= SEC_SIGN; break; case 's': /* (s)ign */ - msg->security &= ~SEC_ENCRYPT; - msg->security |= SEC_SIGN; + e->security &= ~SEC_ENCRYPT; + e->security |= SEC_SIGN; break; } } - return msg->security; + return e->security; } /** * pgp_gpgme_send_menu - Implements CryptModuleSpecs::send_menu() */ -int pgp_gpgme_send_menu(struct Email *msg) +int pgp_gpgme_send_menu(struct Email *e) { - return gpgme_send_menu(msg, 0); + return gpgme_send_menu(e, 0); } /** * smime_gpgme_send_menu - Implements CryptModuleSpecs::send_menu() */ -int smime_gpgme_send_menu(struct Email *msg) +int smime_gpgme_send_menu(struct Email *e) { - return gpgme_send_menu(msg, 1); + return gpgme_send_menu(e, 1); } /** diff --git a/ncrypt/crypt_gpgme.h b/ncrypt/crypt_gpgme.h index 7e0efc1eb..843c46aab 100644 --- a/ncrypt/crypt_gpgme.h +++ b/ncrypt/crypt_gpgme.h @@ -43,7 +43,7 @@ char * pgp_gpgme_find_keys(struct AddressList *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 Email *msg); +int pgp_gpgme_send_menu(struct Email *e); struct Body *pgp_gpgme_sign_message(struct Body *a); int pgp_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile); @@ -52,7 +52,7 @@ struct Body *smime_gpgme_build_smime_entity(struct Body *a, char *keylist); int smime_gpgme_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur); char * smime_gpgme_find_keys(struct AddressList *addrlist, bool oppenc_mode); void smime_gpgme_init(void); -int smime_gpgme_send_menu(struct Email *msg); +int smime_gpgme_send_menu(struct Email *e); 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 Email *e); diff --git a/ncrypt/crypt_mod.h b/ncrypt/crypt_mod.h index 508976c5e..e6aada2a1 100644 --- a/ncrypt/crypt_mod.h +++ b/ncrypt/crypt_mod.h @@ -116,10 +116,10 @@ struct CryptModuleSpecs int (*verify_one)(struct Body *sigbdy, struct State *s, const char *tempf); /** * send_menu - Ask the user whether to sign and/or encrypt the email - * @param msg Email + * @param e Email * @retval num Flags, e.g. #APPLICATION_PGP | #SEC_ENCRYPT */ - int (*send_menu)(struct Email *msg); + int (*send_menu)(struct Email *e); /** * set_sender - Set the sender of the email * @param sender Email address diff --git a/ncrypt/cryptglue.c b/ncrypt/cryptglue.c index 6b4d00af8..b0e12ab02 100644 --- a/ncrypt/cryptglue.c +++ b/ncrypt/cryptglue.c @@ -322,10 +322,10 @@ 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 Email *msg) +int crypt_pgp_send_menu(struct Email *e) { if (CRYPT_MOD_CALL_CHECK(PGP, send_menu)) - return CRYPT_MOD_CALL(PGP, send_menu)(msg); + return CRYPT_MOD_CALL(PGP, send_menu)(e); return 0; } @@ -477,10 +477,10 @@ 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 Email *msg) +int crypt_smime_send_menu(struct Email *e) { if (CRYPT_MOD_CALL_CHECK(SMIME, send_menu)) - return CRYPT_MOD_CALL(SMIME, send_menu)(msg); + return CRYPT_MOD_CALL(SMIME, send_menu)(e); return 0; } diff --git a/ncrypt/ncrypt.h b/ncrypt/ncrypt.h index f39a429fe..591e745bd 100644 --- a/ncrypt/ncrypt.h +++ b/ncrypt/ncrypt.h @@ -184,8 +184,8 @@ typedef uint16_t KeyFlags; ///< Flags describing PGP/SMIME keys /* crypt.c */ void crypt_extract_keys_from_messages(struct EmailList *el); void crypt_forget_passphrase(void); -int crypt_get_keys(struct Email *msg, char **keylist, bool oppenc_mode); -void crypt_opportunistic_encrypt(struct Email *msg); +int crypt_get_keys(struct Email *e, char **keylist, bool oppenc_mode); +void crypt_opportunistic_encrypt(struct Email *e); SecurityFlags crypt_query(struct Body *m); bool crypt_valid_passphrase(SecurityFlags flags); SecurityFlags mutt_is_application_pgp(struct Body *m); @@ -194,7 +194,7 @@ SecurityFlags mutt_is_malformed_multipart_pgp_encrypted(struct Body *b); SecurityFlags mutt_is_multipart_encrypted(struct Body *b); SecurityFlags mutt_is_multipart_signed(struct Body *b); int mutt_is_valid_multipart_pgp_encrypted(struct Body *b); -int mutt_protect(struct Email *msg, char *keylist); +int mutt_protect(struct Email *e, char *keylist); int mutt_protected_headers_handler(struct Body *m, struct State *s); bool mutt_should_hide_protected_subject(struct Email *e); int mutt_signed_handler(struct Body *a, struct State *s); @@ -210,11 +210,11 @@ 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 Email *msg); +int crypt_pgp_send_menu(struct Email *e); int crypt_smime_application_handler(struct Body *m, struct State *s); int crypt_smime_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur); void crypt_smime_getkeys(struct Envelope *env); -int crypt_smime_send_menu(struct Email *msg); +int crypt_smime_send_menu(struct Email *e); int crypt_smime_verify_sender(struct Email *e); /* crypt_mod.c */ diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index b7b690f5d..c163dc40f 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -1832,7 +1832,7 @@ struct Body *pgp_class_traditional_encryptsign(struct Body *a, SecurityFlags fla /** * pgp_class_send_menu - Implements CryptModuleSpecs::send_menu() */ -int pgp_class_send_menu(struct Email *msg) +int pgp_class_send_menu(struct Email *e) { struct PgpKeyInfo *p = NULL; const char *prompt = NULL; @@ -1842,19 +1842,19 @@ int pgp_class_send_menu(struct Email *msg) int choice; if (!(WithCrypto & APPLICATION_PGP)) - return msg->security; + return e->security; /* If autoinline and no crypto options set, then set inline. */ - if (C_PgpAutoinline && !((msg->security & APPLICATION_PGP) && - (msg->security & (SEC_SIGN | SEC_ENCRYPT)))) + if (C_PgpAutoinline && + !((e->security & APPLICATION_PGP) && (e->security & (SEC_SIGN | SEC_ENCRYPT)))) { - msg->security |= SEC_INLINE; + e->security |= SEC_INLINE; } - msg->security |= APPLICATION_PGP; + e->security |= APPLICATION_PGP; char *mime_inline = NULL; - if (msg->security & SEC_INLINE) + if (e->security & SEC_INLINE) { /* L10N: The next string MUST have the same highlighted letter One of them will appear in each of the three strings marked "(inline"), below. */ @@ -1870,9 +1870,9 @@ int pgp_class_send_menu(struct Email *msg) * between inline and mime, but not turn encryption on or off. * NOTE: "Signing" and "Clearing" only adjust the sign bit, so we have different * letter choices for those. */ - if (C_CryptOpportunisticEncrypt && (msg->security & SEC_OPPENCRYPT)) + if (C_CryptOpportunisticEncrypt && (e->security & SEC_OPPENCRYPT)) { - if (msg->security & (SEC_ENCRYPT | SEC_SIGN)) + if (e->security & (SEC_ENCRYPT | SEC_SIGN)) { snprintf(promptbuf, sizeof(promptbuf), /* L10N: PGP options (inline) (opportunistic encryption is on) */ @@ -1900,7 +1900,7 @@ int pgp_class_send_menu(struct Email *msg) { /* When the message is not selected for signing or encryption, the toggle * between PGP/MIME and Traditional doesn't make sense. */ - if (msg->security & (SEC_ENCRYPT | SEC_SIGN)) + if (e->security & (SEC_ENCRYPT | SEC_SIGN)) { snprintf(promptbuf, sizeof(promptbuf), /* L10N: PGP options (inline) (opportunistic encryption is off) */ @@ -1926,7 +1926,7 @@ int pgp_class_send_menu(struct Email *msg) /* Opportunistic encryption is unset */ else { - if (msg->security & (SEC_ENCRYPT | SEC_SIGN)) + if (e->security & (SEC_ENCRYPT | SEC_SIGN)) { snprintf(promptbuf, sizeof(promptbuf), /* L10N: PGP options (inline) */ @@ -1965,52 +1965,52 @@ int pgp_class_send_menu(struct Email *msg) mutt_str_replace(&C_PgpSignAs, input_signas); pgp_free_key(&p); - msg->security |= SEC_SIGN; + e->security |= SEC_SIGN; crypt_pgp_void_passphrase(); /* probably need a different passphrase */ } break; case 'b': /* (b)oth */ - msg->security |= (SEC_ENCRYPT | SEC_SIGN); + e->security |= (SEC_ENCRYPT | SEC_SIGN); break; case 'C': - msg->security &= ~SEC_SIGN; + e->security &= ~SEC_SIGN; break; case 'c': /* (c)lear */ - msg->security &= ~(SEC_ENCRYPT | SEC_SIGN); + e->security &= ~(SEC_ENCRYPT | SEC_SIGN); break; case 'e': /* (e)ncrypt */ - msg->security |= SEC_ENCRYPT; - msg->security &= ~SEC_SIGN; + e->security |= SEC_ENCRYPT; + e->security &= ~SEC_SIGN; break; case 'i': /* toggle (i)nline */ - msg->security ^= SEC_INLINE; + e->security ^= SEC_INLINE; break; case 'O': /* oppenc mode on */ - msg->security |= SEC_OPPENCRYPT; - crypt_opportunistic_encrypt(msg); + e->security |= SEC_OPPENCRYPT; + crypt_opportunistic_encrypt(e); break; case 'o': /* oppenc mode off */ - msg->security &= ~SEC_OPPENCRYPT; + e->security &= ~SEC_OPPENCRYPT; break; case 'S': /* (s)ign in oppenc mode */ - msg->security |= SEC_SIGN; + e->security |= SEC_SIGN; break; case 's': /* (s)ign */ - msg->security &= ~SEC_ENCRYPT; - msg->security |= SEC_SIGN; + e->security &= ~SEC_ENCRYPT; + e->security |= SEC_SIGN; break; } } - return msg->security; + return e->security; } diff --git a/ncrypt/pgp.h b/ncrypt/pgp.h index 46a308e61..7e608b4a4 100644 --- a/ncrypt/pgp.h +++ b/ncrypt/pgp.h @@ -61,6 +61,6 @@ struct Body *pgp_class_traditional_encryptsign(struct Body *a, SecurityFlags fla 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 Email *msg); +int pgp_class_send_menu(struct Email *e); #endif /* MUTT_NCRYPT_PGP_H */ diff --git a/ncrypt/smime.c b/ncrypt/smime.c index dba61c8aa..c012f6b21 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -2307,7 +2307,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 Email *msg) +int smime_class_send_menu(struct Email *e) { struct SmimeKey *key = NULL; const char *prompt = NULL; @@ -2316,14 +2316,14 @@ int smime_class_send_menu(struct Email *msg) int choice; if (!(WithCrypto & APPLICATION_SMIME)) - return msg->security; + return e->security; - msg->security |= APPLICATION_SMIME; + e->security |= APPLICATION_SMIME; /* Opportunistic encrypt is controlling encryption. * NOTE: "Signing" and "Clearing" only adjust the sign bit, so we have different * letter choices for those. */ - if (C_CryptOpportunisticEncrypt && (msg->security & SEC_OPPENCRYPT)) + if (C_CryptOpportunisticEncrypt && (e->security & SEC_OPPENCRYPT)) { /* L10N: S/MIME options (opportunistic encryption is on) */ prompt = _("S/MIME (s)ign, encrypt (w)ith, sign (a)s, (c)lear, or (o)ppenc " @@ -2366,7 +2366,7 @@ int smime_class_send_menu(struct Email *msg) mutt_str_replace(&C_SmimeSignAs, key->hash); smime_free_key(&key); - msg->security |= SEC_SIGN; + e->security |= SEC_SIGN; /* probably need a different passphrase */ crypt_smime_void_passphrase(); @@ -2375,43 +2375,43 @@ int smime_class_send_menu(struct Email *msg) break; case 'b': /* (b)oth */ - msg->security |= (SEC_ENCRYPT | SEC_SIGN); + e->security |= (SEC_ENCRYPT | SEC_SIGN); break; case 'c': /* (c)lear */ - msg->security &= ~(SEC_ENCRYPT | SEC_SIGN); + e->security &= ~(SEC_ENCRYPT | SEC_SIGN); break; case 'C': - msg->security &= ~SEC_SIGN; + e->security &= ~SEC_SIGN; break; case 'e': /* (e)ncrypt */ - msg->security |= SEC_ENCRYPT; - msg->security &= ~SEC_SIGN; + e->security |= SEC_ENCRYPT; + e->security &= ~SEC_SIGN; break; case 'O': /* oppenc mode on */ - msg->security |= SEC_OPPENCRYPT; - crypt_opportunistic_encrypt(msg); + e->security |= SEC_OPPENCRYPT; + crypt_opportunistic_encrypt(e); break; case 'o': /* oppenc mode off */ - msg->security &= ~SEC_OPPENCRYPT; + e->security &= ~SEC_OPPENCRYPT; break; case 'S': /* (s)ign in oppenc mode */ - msg->security |= SEC_SIGN; + e->security |= SEC_SIGN; break; case 's': /* (s)ign */ - msg->security &= ~SEC_ENCRYPT; - msg->security |= SEC_SIGN; + e->security &= ~SEC_ENCRYPT; + e->security |= SEC_SIGN; break; case 'w': /* encrypt (w)ith */ { - msg->security |= SEC_ENCRYPT; + e->security |= SEC_ENCRYPT; do { switch (mutt_multi_choice(_("Choose algorithm family: (1) DES, (2) " @@ -2483,5 +2483,5 @@ int smime_class_send_menu(struct Email *msg) } } - return msg->security; + return e->security; } diff --git a/ncrypt/smime.h b/ncrypt/smime.h index bcc0d8cab..fa1af9b5e 100644 --- a/ncrypt/smime.h +++ b/ncrypt/smime.h @@ -55,7 +55,7 @@ int smime_class_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b char * smime_class_find_keys(struct AddressList *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 Email *msg); +int smime_class_send_menu(struct Email *e); struct Body *smime_class_sign_message(struct Body *a); bool smime_class_valid_passphrase(void); int smime_class_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile); diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index 843fb747b..5ec7613ea 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -2288,9 +2288,9 @@ static int nm_mbox_check(struct Mailbox *m, int *index_hint) { /* if the user hasn't modified the flags on this message, update the * flags we just detected. */ - struct Email tmp = { 0 }; - maildir_parse_flags(&tmp, new_file); - maildir_update_flags(m, e, &tmp); + struct Email e_tmp = { 0 }; + maildir_parse_flags(&e_tmp, new_file); + maildir_update_flags(m, e, &e_tmp); } if (update_email_tags(e, msg) == 0) diff --git a/pager.c b/pager.c index 579482d6c..b059300f5 100644 --- a/pager.c +++ b/pager.c @@ -109,7 +109,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 Email *OldHdr = NULL; +static struct Email *OldEmail = NULL; #define CHECK_MODE(test) \ if (!(test)) \ @@ -1882,7 +1882,7 @@ static struct Mapping PagerNewsHelpExtra[] = { void mutt_clear_pager_position(void) { TopLine = 0; - OldHdr = NULL; + OldEmail = NULL; } /** @@ -2348,7 +2348,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P mutt_refresh(); - if (IsEmail(extra) && (OldHdr == extra->email) && (TopLine != rd.topline) && + if (IsEmail(extra) && (OldEmail == extra->email) && (TopLine != rd.topline) && (rd.line_info[rd.curline].offset < (rd.sb.st_size - 1))) { if ((TopLine - rd.topline) > rd.lines) @@ -2358,7 +2358,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P continue; } else - OldHdr = NULL; + OldEmail = NULL; ch = km_dokey(MENU_PAGER); if (ch >= 0) @@ -3557,7 +3557,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P break; default: TopLine = rd.topline; - OldHdr = extra->email; + OldEmail = extra->email; break; } } diff --git a/postpone.c b/postpone.c index bf1522510..3983d2dba 100644 --- a/postpone.c +++ b/postpone.c @@ -571,7 +571,7 @@ SecurityFlags mutt_parse_crypt_hdr(const char *p, bool set_empty_signas, Securit * mutt_prepare_template - Prepare a message template * @param fp If not NULL, file containing the template * @param m If fp is NULL, the Mailbox containing the header with the template - * @param newhdr The template is read into this Header + * @param e_new The template is read into this Header * @param e Email to recall/resend * @param resend Set if resending (as opposed to recalling a postponed msg) * Resent messages enable header weeding, and also @@ -579,7 +579,7 @@ SecurityFlags mutt_parse_crypt_hdr(const char *p, bool set_empty_signas, Securit * @retval 0 Success * @retval -1 Error */ -int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, +int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *e_new, struct Email *e, bool resend) { struct Message *msg = NULL; @@ -601,38 +601,38 @@ int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, /* parse the message header and MIME structure */ fseeko(fp, e->offset, SEEK_SET); - newhdr->offset = e->offset; + e_new->offset = e->offset; /* enable header weeding for resent messages */ - newhdr->env = mutt_rfc822_read_header(fp, newhdr, true, resend); - newhdr->content->length = e->content->length; - mutt_parse_part(fp, newhdr->content); + e_new->env = mutt_rfc822_read_header(fp, e_new, true, resend); + e_new->content->length = e->content->length; + mutt_parse_part(fp, e_new->content); /* If resending a message, don't keep message_id or mail_followup_to. * Otherwise, we are resuming a postponed message, and want to keep those * headers if they exist. */ if (resend) { - FREE(&newhdr->env->message_id); - FREE(&newhdr->env->mail_followup_to); + FREE(&e_new->env->message_id); + FREE(&e_new->env->mail_followup_to); } /* decrypt pgp/mime encoded messages */ if (((WithCrypto & APPLICATION_PGP) != 0) && - (sec_type = mutt_is_multipart_encrypted(newhdr->content))) + (sec_type = mutt_is_multipart_encrypted(e_new->content))) { - newhdr->security |= sec_type; + e_new->security |= sec_type; if (!crypt_valid_passphrase(sec_type)) goto bail; mutt_message(_("Decrypting message...")); - if ((crypt_pgp_decrypt_mime(fp, &fp_body, newhdr->content, &b) == -1) || !b) + if ((crypt_pgp_decrypt_mime(fp, &fp_body, e_new->content, &b) == -1) || !b) { goto bail; } - mutt_body_free(&newhdr->content); - newhdr->content = b; + mutt_body_free(&e_new->content); + e_new->content = b; if (b->mime_headers) { @@ -645,28 +645,28 @@ int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, /* remove a potential multipart/signed layer - useful when * resending messages */ - if ((WithCrypto != 0) && mutt_is_multipart_signed(newhdr->content)) + if ((WithCrypto != 0) && mutt_is_multipart_signed(e_new->content)) { - newhdr->security |= SEC_SIGN; + e_new->security |= SEC_SIGN; if (((WithCrypto & APPLICATION_PGP) != 0) && (mutt_str_strcasecmp( - mutt_param_get(&newhdr->content->parameter, "protocol"), + mutt_param_get(&e_new->content->parameter, "protocol"), "application/pgp-signature") == 0)) { - newhdr->security |= APPLICATION_PGP; + e_new->security |= APPLICATION_PGP; } else if (WithCrypto & APPLICATION_SMIME) - newhdr->security |= APPLICATION_SMIME; + e_new->security |= APPLICATION_SMIME; /* destroy the signature */ - mutt_body_free(&newhdr->content->parts->next); - newhdr->content = mutt_remove_multipart(newhdr->content); + mutt_body_free(&e_new->content->parts->next); + e_new->content = mutt_remove_multipart(e_new->content); - if (newhdr->content->mime_headers) + if (e_new->content->mime_headers) { mutt_env_free(&protected_headers); - protected_headers = newhdr->content->mime_headers; - newhdr->content->mime_headers = NULL; + protected_headers = e_new->content->mime_headers; + e_new->content->mime_headers = NULL; } } @@ -676,15 +676,15 @@ int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, * XXX - we don't handle multipart/alternative in any * smart way when sending messages. However, one may * consider this a feature. */ - if (newhdr->content->type == TYPE_MULTIPART) - newhdr->content = mutt_remove_multipart(newhdr->content); + if (e_new->content->type == TYPE_MULTIPART) + e_new->content = mutt_remove_multipart(e_new->content); s.fp_in = fp_body; struct Buffer *file = mutt_buffer_pool_get(); /* create temporary files for all attachments */ - for (b = newhdr->content; b; b = b->next) + for (b = e_new->content; b; b = b->next) { /* what follows is roughly a receive-mode variant of * mutt_get_tmp_attachment () from muttlib.c */ @@ -742,13 +742,13 @@ int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, goto bail; } - if ((b == newhdr->content) && !protected_headers) + if ((b == e_new->content) && !protected_headers) { protected_headers = b->mime_headers; b->mime_headers = NULL; } - newhdr->security |= sec_type; + e_new->security |= sec_type; b->type = TYPE_TEXT; mutt_str_replace(&b->subtype, "plain"); mutt_param_delete(&b->parameter, "x-action"); @@ -760,7 +760,7 @@ int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, { if (!crypt_valid_passphrase(APPLICATION_SMIME)) goto bail; - crypt_smime_getkeys(newhdr->env); + crypt_smime_getkeys(e_new->env); mutt_message(_("Decrypting message...")); } @@ -770,7 +770,7 @@ int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, goto bail; } - newhdr->security |= sec_type; + e_new->security |= sec_type; b->type = TYPE_TEXT; mutt_str_replace(&b->subtype, "plain"); } @@ -791,28 +791,28 @@ int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, } if (C_CryptProtectedHeadersRead && protected_headers && protected_headers->subject && - (mutt_str_strcmp(newhdr->env->subject, protected_headers->subject) != 0)) + (mutt_str_strcmp(e_new->env->subject, protected_headers->subject) != 0)) { - mutt_str_replace(&newhdr->env->subject, protected_headers->subject); + mutt_str_replace(&e_new->env->subject, protected_headers->subject); } mutt_env_free(&protected_headers); /* Fix encryption flags. */ /* No inline if multipart. */ - if ((WithCrypto != 0) && (newhdr->security & SEC_INLINE) && newhdr->content->next) - newhdr->security &= ~SEC_INLINE; + if ((WithCrypto != 0) && (e_new->security & SEC_INLINE) && e_new->content->next) + e_new->security &= ~SEC_INLINE; /* Do we even support multiple mechanisms? */ - newhdr->security &= WithCrypto | ~(APPLICATION_PGP | APPLICATION_SMIME); + e_new->security &= WithCrypto | ~(APPLICATION_PGP | APPLICATION_SMIME); /* Theoretically, both could be set. Take the one the user wants to set by default. */ - if ((newhdr->security & APPLICATION_PGP) && (newhdr->security & APPLICATION_SMIME)) + if ((e_new->security & APPLICATION_PGP) && (e_new->security & APPLICATION_SMIME)) { if (C_SmimeIsDefault) - newhdr->security &= ~APPLICATION_PGP; + e_new->security &= ~APPLICATION_PGP; else - newhdr->security &= ~APPLICATION_SMIME; + e_new->security &= ~APPLICATION_SMIME; } rc = 0; @@ -828,8 +828,8 @@ bail: if (rc == -1) { - mutt_env_free(&newhdr->env); - mutt_body_free(&newhdr->content); + mutt_env_free(&e_new->env); + mutt_body_free(&e_new->content); } return rc; diff --git a/protos.h b/protos.h index 42f744f04..dea64d9ef 100644 --- a/protos.h +++ b/protos.h @@ -71,11 +71,11 @@ void mutt_emails_set_flag(struct Mailbox *m, struct EmailList *el, int flag, boo int mutt_change_flag(struct Mailbox *m, struct EmailList *el, bool bf); int mutt_complete(char *buf, size_t buflen); -int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, struct Email *e, bool resend); +int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *e_new, struct Email *e, bool resend); int mutt_enter_string(char *buf, size_t buflen, int col, CompletionFlags flags); int mutt_enter_string_full(char *buf, size_t buflen, int col, CompletionFlags flags, bool multiple, char ***files, int *numfiles, struct EnterState *state); -int mutt_get_postponed(struct Context *ctx, struct Email *e, struct Email **cur, char *fcc, size_t fcclen); +int mutt_get_postponed(struct Context *ctx, struct Email *hdr, struct Email **cur, char *fcc, size_t fcclen); SecurityFlags mutt_parse_crypt_hdr(const char *p, bool set_empty_signas, SecurityFlags crypt_app); int mutt_num_postponed(struct Mailbox *m, bool force); int mutt_thread_set_flag(struct Email *e, int flag, bool bf, bool subthread); diff --git a/query.c b/query.c index 5780e5bf5..07aa28265 100644 --- a/query.c +++ b/query.c @@ -508,14 +508,14 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, bool ret /* fallthrough */ case OP_MAIL: { - struct Email *msg = mutt_email_new(); - msg->env = mutt_env_new(); + struct Email *e = mutt_email_new(); + e->env = mutt_env_new(); if (!menu->tagprefix) { struct AddressList al = TAILQ_HEAD_INITIALIZER(al); if (result_to_addr(&al, query_table[menu->current].data)) { - mutt_addrlist_copy(&msg->env->to, &al, false); + mutt_addrlist_copy(&e->env->to, &al, false); mutt_addrlist_clear(&al); } } @@ -528,13 +528,13 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, bool ret struct AddressList al = TAILQ_HEAD_INITIALIZER(al); if (result_to_addr(&al, query_table[i].data)) { - mutt_addrlist_copy(&msg->env->to, &al, false); + mutt_addrlist_copy(&e->env->to, &al, false); mutt_addrlist_clear(&al); } } } } - ci_send_message(SEND_NO_FLAGS, msg, NULL, Context, NULL); + ci_send_message(SEND_NO_FLAGS, e, NULL, Context, NULL); menu->redraw = REDRAW_FULL; break; } diff --git a/recvcmd.c b/recvcmd.c index fb4c45187..2599adccf 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -863,14 +863,14 @@ static int attach_reply_envelope_defaults(struct Envelope *env, struct AttachCtx * attach_include_reply - This is _very_ similar to send.c's include_reply() * @param fp File handle to attachment * @param fp_tmp File handle to temporary file - * @param cur Email + * @param e Email */ -static void attach_include_reply(FILE *fp, FILE *fp_tmp, struct Email *cur) +static void attach_include_reply(FILE *fp, FILE *fp_tmp, struct Email *e) { CopyMessageFlags cmflags = MUTT_CM_PREFIX | MUTT_CM_DECODE | MUTT_CM_CHARCONV; CopyHeaderFlags chflags = CH_DECODE; - mutt_make_attribution(Context->mailbox, cur, fp_tmp); + mutt_make_attribution(Context->mailbox, e, fp_tmp); if (!C_Header) cmflags |= MUTT_CM_NOHEADER; @@ -880,8 +880,8 @@ static void attach_include_reply(FILE *fp, FILE *fp_tmp, struct Email *cur) cmflags |= MUTT_CM_WEED; } - mutt_copy_message_fp(fp_tmp, fp, cur, cmflags, chflags); - mutt_make_post_indent(Context->mailbox, cur, fp_tmp); + mutt_copy_message_fp(fp_tmp, fp, e, cmflags, chflags); + mutt_make_post_indent(Context->mailbox, e, fp_tmp); } /** @@ -889,11 +889,11 @@ static void attach_include_reply(FILE *fp, FILE *fp_tmp, struct Email *cur) * @param fp File handle to reply * @param e Email * @param actx Attachment Context - * @param cur Current message + * @param e_cur Current message * @param flags Send mode, see #SendFlags */ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, - struct Body *cur, SendFlags flags) + struct Body *e_cur, SendFlags flags) { bool mime_reply_any = false; @@ -916,10 +916,10 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, OptNewsSend = false; #endif - if (!check_all_msg(actx, cur, false)) + if (!check_all_msg(actx, e_cur, false)) { nattach = count_tagged(actx); - parent = find_parent(actx, cur, nattach); + parent = find_parent(actx, e_cur, nattach); if (parent) { e_parent = parent->content->email; @@ -932,7 +932,7 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, } } - if ((nattach > 1) && !check_can_decode(actx, cur)) + if ((nattach > 1) && !check_can_decode(actx, e_cur)) { const enum QuadOption ans = query_quadoption( C_MimeForwardRest, _("Can't decode all tagged attachments. " @@ -949,7 +949,7 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, e_tmp->env = mutt_env_new(); if (attach_reply_envelope_defaults( - e_tmp->env, actx, e_parent ? e_parent : (cur ? cur->email : NULL), flags) == -1) + e_tmp->env, actx, e_parent ? e_parent : (e_cur ? e_cur->email : NULL), flags) == -1) { mutt_email_free(&e_tmp); return; @@ -966,8 +966,8 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, if (!e_parent) { - if (cur) - attach_include_reply(fp, fp_tmp, cur->email); + if (e_cur) + attach_include_reply(fp, fp_tmp, e_cur->email); else { for (short i = 0; i < actx->idxlen; i++) @@ -1001,16 +1001,16 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, if (C_Header) include_header(true, fp_parent, e_parent, fp_tmp, prefix); - if (cur) + if (e_cur) { - if (mutt_can_decode(cur)) + if (mutt_can_decode(e_cur)) { st.fp_in = fp; - mutt_body_handler(cur, &st); + mutt_body_handler(e_cur, &st); state_putc('\n', &st); } else - mutt_body_copy(fp, &e_tmp->content, cur); + mutt_body_copy(fp, &e_tmp->content, e_cur); } else { @@ -1027,7 +1027,8 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, mutt_make_post_indent(Context->mailbox, e_parent, fp_tmp); - if (mime_reply_any && !cur && !copy_problematic_attachments(&e_tmp->content, actx, false)) + if (mime_reply_any && !e_cur && + !copy_problematic_attachments(&e_tmp->content, actx, false)) { mutt_email_free(&e_tmp); mutt_file_fclose(&fp_tmp); @@ -1038,7 +1039,7 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, mutt_file_fclose(&fp_tmp); struct EmailList el = STAILQ_HEAD_INITIALIZER(el); - el_add_email(&el, e_parent ? e_parent : (cur ? cur->email : NULL)); + el_add_email(&el, e_parent ? e_parent : (e_cur ? e_cur->email : NULL)); if (ci_send_message(flags, e_tmp, tmpbody, NULL, &el) == 0) { mutt_set_flag(Context->mailbox, e, MUTT_REPLIED, true); diff --git a/remailer.c b/remailer.c index 5fc48b3a0..cd42058d1 100644 --- a/remailer.c +++ b/remailer.c @@ -769,15 +769,15 @@ void mix_make_chain(struct ListHead *chainhead) /** * mix_check_message - Safety-check the message before passing it to mixmaster - * @param msg Email + * @param e Email * @retval 0 Success * @retval -1 Error */ -int mix_check_message(struct Email *msg) +int mix_check_message(struct Email *e) { bool need_hostname = false; - if (!TAILQ_EMPTY(&msg->env->cc) || !TAILQ_EMPTY(&msg->env->bcc)) + if (!TAILQ_EMPTY(&e->env->cc) || !TAILQ_EMPTY(&e->env->bcc)) { mutt_error(_("Mixmaster doesn't accept Cc or Bcc headers")); return -1; @@ -790,7 +790,7 @@ int mix_check_message(struct Email *msg) */ struct Address *a = NULL; - TAILQ_FOREACH(a, &msg->env->to, entries) + TAILQ_FOREACH(a, &e->env->to, entries) { if (!a->group && !strchr(a->mailbox, '@')) { @@ -810,9 +810,9 @@ int mix_check_message(struct Email *msg) } /* Cc and Bcc are empty at this point. */ - mutt_addrlist_qualify(&msg->env->to, fqdn); - mutt_addrlist_qualify(&msg->env->reply_to, fqdn); - mutt_addrlist_qualify(&msg->env->mail_followup_to, fqdn); + mutt_addrlist_qualify(&e->env->to, fqdn); + mutt_addrlist_qualify(&e->env->reply_to, fqdn); + mutt_addrlist_qualify(&e->env->mail_followup_to, fqdn); } return 0; diff --git a/remailer.h b/remailer.h index 5ebe2a399..f50dcd7d2 100644 --- a/remailer.h +++ b/remailer.h @@ -65,7 +65,7 @@ struct MixChain }; int mix_send_message(struct ListHead *chain, const char *tempfile); -int mix_check_message(struct Email *msg); +int mix_check_message(struct Email *e); void mix_make_chain(struct ListHead *chainhead); #endif /* MUTT_REMAILER_H */ diff --git a/send.c b/send.c index 1d064d347..f50a368e8 100644 --- a/send.c +++ b/send.c @@ -506,13 +506,13 @@ static int include_forward(struct Mailbox *m, struct Email *e, FILE *fp_out) /** * inline_forward_attachments - Add attachments to an email, inline * @param[in] m Mailbox - * @param[in] cur Current Email + * @param[in] e Current Email * @param[out] plast Pointer to the last Attachment * @param[out] forwardq Result of asking the user to forward the attachments, e.g. #MUTT_YES * @retval 0 Success * @retval -1 Error */ -static int inline_forward_attachments(struct Mailbox *m, struct Email *cur, +static int inline_forward_attachments(struct Mailbox *m, struct Email *e, struct Body ***plast, int *forwardq) { struct Body **last = *plast; @@ -521,15 +521,15 @@ static int inline_forward_attachments(struct Mailbox *m, struct Email *cur, struct AttachCtx *actx = NULL; int rc = 0, i; - mutt_parse_mime_message(m, cur); - mutt_message_hook(m, cur, MUTT_MESSAGE_HOOK); + mutt_parse_mime_message(m, e); + mutt_message_hook(m, e, MUTT_MESSAGE_HOOK); - msg = mx_msg_open(m, cur->msgno); + msg = mx_msg_open(m, e->msgno); if (!msg) return -1; actx = mutt_mem_calloc(1, sizeof(*actx)); - actx->email = cur; + actx->email = e; actx->fp_root = msg->fp; mutt_generate_recvattach_list(actx, actx->email, actx->email->content, @@ -582,20 +582,21 @@ cleanup: /** * mutt_inline_forward - Forward attachments, inline - * @param m Mailbox - * @param msg Email to alter - * @param cur Current Email - * @param out File + * @param m Mailbox + * @param e_edit Email to alter + * @param e_cur Current Email + * @param out File * @retval 0 Success * @retval -1 Error */ -int mutt_inline_forward(struct Mailbox *m, struct Email *msg, struct Email *cur, FILE *out) +int mutt_inline_forward(struct Mailbox *m, struct Email *e_edit, + struct Email *e_cur, FILE *out) { int i, forwardq = -1; struct Body **last = NULL; - if (cur) - include_forward(m, cur, out); + if (e_cur) + include_forward(m, e_cur, out); else for (i = 0; i < m->vcount; i++) if (m->emails[m->v2r[i]]->tagged) @@ -603,13 +604,13 @@ int mutt_inline_forward(struct Mailbox *m, struct Email *msg, struct Email *cur, if (C_ForwardDecode && (C_ForwardAttachments != MUTT_NO)) { - last = &msg->content; + last = &e_edit->content; while (*last) last = &((*last)->next); - if (cur) + if (e_cur) { - if (inline_forward_attachments(m, cur, &last, &forwardq) != 0) + if (inline_forward_attachments(m, e_cur, &last, &forwardq) != 0) return -1; } else @@ -901,9 +902,9 @@ void mutt_fix_reply_recipients(struct Envelope *env) * mutt_make_forward_subject - Create a subject for a forwarded email * @param env Envelope for result * @param m Mailbox - * @param cur Email + * @param e Email */ -void mutt_make_forward_subject(struct Envelope *env, struct Mailbox *m, struct Email *cur) +void mutt_make_forward_subject(struct Envelope *env, struct Mailbox *m, struct Email *e) { if (!env) return; @@ -911,7 +912,7 @@ void mutt_make_forward_subject(struct Envelope *env, struct Mailbox *m, struct E char buf[256]; /* set the default subject for the message. */ - mutt_make_string(buf, sizeof(buf), NONULL(C_ForwardFormat), NULL, m, cur); + mutt_make_string(buf, sizeof(buf), NONULL(C_ForwardFormat), NULL, m, e); mutt_str_replace(&env->subject, buf); } @@ -1322,11 +1323,11 @@ struct Address *mutt_default_from(void) /** * send_message - Send an email - * @param msg Email + * @param e Email * @retval 0 Success * @retval -1 Failure */ -static int send_message(struct Email *msg) +static int send_message(struct Email *e) { char tempfile[PATH_MAX]; int i; @@ -1346,13 +1347,13 @@ static int send_message(struct Email *msg) C_WriteBcc = false; #endif #ifdef MIXMASTER - mutt_rfc822_write_header(fp_tmp, msg->env, msg->content, - MUTT_WRITE_HEADER_NORMAL, !STAILQ_EMPTY(&msg->chain), - mutt_should_hide_protected_subject(msg)); + mutt_rfc822_write_header(fp_tmp, e->env, e->content, MUTT_WRITE_HEADER_NORMAL, + !STAILQ_EMPTY(&e->chain), + mutt_should_hide_protected_subject(e)); #endif #ifndef MIXMASTER - mutt_rfc822_write_header(fp_tmp, msg->env, msg->content, MUTT_WRITE_HEADER_NORMAL, - false, mutt_should_hide_protected_subject(msg)); + mutt_rfc822_write_header(fp_tmp, e->env, e->content, MUTT_WRITE_HEADER_NORMAL, + false, mutt_should_hide_protected_subject(e)); #endif #ifdef USE_SMTP if (old_write_bcc) @@ -1361,7 +1362,7 @@ static int send_message(struct Email *msg) fputc('\n', fp_tmp); /* tie off the header. */ - if ((mutt_write_mime_body(msg->content, fp_tmp) == -1)) + if ((mutt_write_mime_body(e->content, fp_tmp) == -1)) { mutt_file_fclose(&fp_tmp); unlink(tempfile); @@ -1376,8 +1377,8 @@ static int send_message(struct Email *msg) } #ifdef MIXMASTER - if (!STAILQ_EMPTY(&msg->chain)) - return mix_send_message(&msg->chain, tempfile); + if (!STAILQ_EMPTY(&e->chain)) + return mix_send_message(&e->chain, tempfile); #endif #ifdef USE_SMTP @@ -1386,14 +1387,13 @@ static int send_message(struct Email *msg) #endif if (C_SmtpUrl) { - return mutt_smtp_send(&msg->env->from, &msg->env->to, &msg->env->cc, - &msg->env->bcc, tempfile, - (msg->content->encoding == ENC_8BIT)); + return mutt_smtp_send(&e->env->from, &e->env->to, &e->env->cc, &e->env->bcc, + tempfile, (e->content->encoding == ENC_8BIT)); } #endif /* USE_SMTP */ - i = mutt_invoke_sendmail(&msg->env->from, &msg->env->to, &msg->env->cc, - &msg->env->bcc, tempfile, (msg->content->encoding == ENC_8BIT)); + i = mutt_invoke_sendmail(&e->env->from, &e->env->to, &e->env->cc, &e->env->bcc, + tempfile, (e->content->encoding == ENC_8BIT)); return i; } @@ -1452,20 +1452,20 @@ static void fix_end_of_file(const char *data) /** * mutt_resend_message - Resend an email - * @param fp File containing email - * @param ctx Mailbox - * @param cur Email to resend + * @param fp File containing email + * @param ctx Mailbox + * @param e_cur Email to resend * @retval 0 Message was successfully sent * @retval -1 Message was aborted or an error occurred * @retval 1 Message was postponed */ -int mutt_resend_message(FILE *fp, struct Context *ctx, struct Email *cur) +int mutt_resend_message(FILE *fp, struct Context *ctx, struct Email *e_cur) { - struct Email *msg = mutt_email_new(); + struct Email *e_new = mutt_email_new(); - if (mutt_prepare_template(fp, ctx->mailbox, msg, cur, true) < 0) + if (mutt_prepare_template(fp, ctx->mailbox, e_new, e_cur, true) < 0) { - mutt_email_free(&msg); + mutt_email_free(&e_new); return -1; } @@ -1473,26 +1473,26 @@ int mutt_resend_message(FILE *fp, struct Context *ctx, struct Email *cur) { /* mutt_prepare_template doesn't always flip on an application bit. * so fix that here */ - if (!(msg->security & (APPLICATION_SMIME | APPLICATION_PGP))) + if (!(e_new->security & (APPLICATION_SMIME | APPLICATION_PGP))) { if (((WithCrypto & APPLICATION_SMIME) != 0) && C_SmimeIsDefault) - msg->security |= APPLICATION_SMIME; + e_new->security |= APPLICATION_SMIME; else if (WithCrypto & APPLICATION_PGP) - msg->security |= APPLICATION_PGP; + e_new->security |= APPLICATION_PGP; else - msg->security |= APPLICATION_SMIME; + e_new->security |= APPLICATION_SMIME; } if (C_CryptOpportunisticEncrypt) { - msg->security |= SEC_OPPENCRYPT; - crypt_opportunistic_encrypt(msg); + e_new->security |= SEC_OPPENCRYPT; + crypt_opportunistic_encrypt(e_new); } } struct EmailList el = STAILQ_HEAD_INITIALIZER(el); - el_add_email(&el, cur); - int rc = ci_send_message(SEND_RESEND, msg, NULL, ctx, &el); + el_add_email(&el, e_cur); + int rc = ci_send_message(SEND_RESEND, e_new, NULL, ctx, &el); mutt_emaillist_free(&el); return rc; @@ -1555,7 +1555,7 @@ static bool search_attach_keyword(char *filename) /** * save_fcc - Save an Email to a 'sent mail' folder - * @param[in] msg Email to save + * @param[in] e Email to save * @param[in] fcc Folder to save to (can be comma-separated list) * @param[in] fcc_len Length of fcc buffer * @param[in] clear_content Cleartext content of Email @@ -1565,7 +1565,7 @@ static bool search_attach_keyword(char *filename) * @retval 0 Success * @retval -1 Error */ -static int save_fcc(struct Email *msg, char *fcc, size_t fcc_len, struct Body *clear_content, +static int save_fcc(struct Email *e, char *fcc, size_t fcc_len, struct Body *clear_content, char *pgpkeylist, SendFlags flags, char **finalpath) { int rc = 0; @@ -1593,7 +1593,7 @@ static int save_fcc(struct Email *msg, char *fcc, size_t fcc_len, struct Body *c if (!(*fcc && mutt_str_strcmp("/dev/null", fcc))) return rc; - struct Body *tmpbody = msg->content; + struct Body *tmpbody = e->content; struct Body *save_sig = NULL; struct Body *save_parts = NULL; @@ -1602,61 +1602,61 @@ static int save_fcc(struct Email *msg, char *fcc, size_t fcc_len, struct Body *c * Protected Headers. */ if (!C_FccBeforeSend) { - if ((WithCrypto != 0) && (msg->security & (SEC_ENCRYPT | SEC_SIGN)) && C_FccClear) + if ((WithCrypto != 0) && (e->security & (SEC_ENCRYPT | SEC_SIGN)) && C_FccClear) { - msg->content = clear_content; - msg->security &= ~(SEC_ENCRYPT | SEC_SIGN); - mutt_env_free(&msg->content->mime_headers); + e->content = clear_content; + e->security &= ~(SEC_ENCRYPT | SEC_SIGN); + mutt_env_free(&e->content->mime_headers); } /* check to see if the user wants copies of all attachments */ - if (msg->content->type == TYPE_MULTIPART) + if (e->content->type == TYPE_MULTIPART) { - if ((WithCrypto != 0) && (msg->security & (SEC_ENCRYPT | SEC_SIGN)) && - ((mutt_str_strcmp(msg->content->subtype, "encrypted") == 0) || - (mutt_str_strcmp(msg->content->subtype, "signed") == 0))) + if ((WithCrypto != 0) && (e->security & (SEC_ENCRYPT | SEC_SIGN)) && + ((mutt_str_strcmp(e->content->subtype, "encrypted") == 0) || + (mutt_str_strcmp(e->content->subtype, "signed") == 0))) { if ((clear_content->type == TYPE_MULTIPART) && (query_quadoption(C_FccAttach, _("Save attachments in Fcc?")) == MUTT_NO)) { - if (!(msg->security & SEC_ENCRYPT) && (msg->security & SEC_SIGN)) + if (!(e->security & SEC_ENCRYPT) && (e->security & SEC_SIGN)) { /* save initial signature and attachments */ - save_sig = msg->content->parts->next; + save_sig = e->content->parts->next; save_parts = clear_content->parts->next; } /* this means writing only the main part */ - msg->content = clear_content->parts; + e->content = clear_content->parts; - if (mutt_protect(msg, pgpkeylist) == -1) + if (mutt_protect(e, pgpkeylist) == -1) { /* we can't do much about it at this point, so * fallback to saving the whole thing to fcc */ - msg->content = tmpbody; + e->content = tmpbody; save_sig = NULL; goto full_fcc; } - save_content = msg->content; + save_content = e->content; } } else { if (query_quadoption(C_FccAttach, _("Save attachments in Fcc?")) == MUTT_NO) - msg->content = msg->content->parts; + e->content = e->content->parts; } } } full_fcc: - if (msg->content) + if (e->content) { /* update received time so that when storing to a mbox-style folder * the From_ line contains the current time instead of when the * message was first postponed. */ - msg->received = time(NULL); - rc = mutt_write_multiple_fcc(fcc, msg, NULL, false, NULL, finalpath); + e->received = time(NULL); + rc = mutt_write_multiple_fcc(fcc, e, NULL, false, NULL, finalpath); while (rc && !(flags & SEND_BATCH)) { mutt_clear_error(); @@ -1684,7 +1684,7 @@ full_fcc: /* fall through */ case 1: /* (r)etry */ - rc = mutt_write_multiple_fcc(fcc, msg, NULL, false, NULL, finalpath); + rc = mutt_write_multiple_fcc(fcc, e, NULL, false, NULL, finalpath); break; case -1: /* abort */ @@ -1697,7 +1697,7 @@ full_fcc: if (!C_FccBeforeSend) { - msg->content = tmpbody; + e->content = tmpbody; if ((WithCrypto != 0) && save_sig) { @@ -1710,8 +1710,8 @@ full_fcc: mutt_body_free(&save_content); /* restore old signature and attachments */ - msg->content->parts->next = save_sig; - msg->content->parts->parts->next = save_parts; + e->content->parts->next = save_sig; + e->content->parts->parts->next = save_parts; } else if ((WithCrypto != 0) && save_content) { @@ -1725,14 +1725,14 @@ full_fcc: /** * postpone_message - Save an Email for another day - * @param msg Email to postpone - * @param cur Current Email in the index - * @param fcc Folder for 'sent mail' - * @param flags Send mode, see #SendFlags + * @param e_post Email to postpone + * @param e_cur Current Email in the index + * @param fcc Folder for 'sent mail' + * @param flags Send mode, see #SendFlags * @retval 0 Success * @retval -1 Error */ -static int postpone_message(struct Email *msg, struct Email *cur, char *fcc, SendFlags flags) +static int postpone_message(struct Email *e_post, struct Email *e_cur, char *fcc, SendFlags flags) { char *pgpkeylist = NULL; char *encrypt_as = NULL; @@ -1744,67 +1744,67 @@ static int postpone_message(struct Email *msg, struct Email *cur, char *fcc, Sen return -1; } - if (msg->content->next) - msg->content = mutt_make_multipart(msg->content); + if (e_post->content->next) + e_post->content = mutt_make_multipart(e_post->content); - mutt_encode_descriptions(msg->content, true); + mutt_encode_descriptions(e_post->content, true); - if ((WithCrypto != 0) && C_PostponeEncrypt && (msg->security & SEC_ENCRYPT)) + if ((WithCrypto != 0) && C_PostponeEncrypt && (e_post->security & SEC_ENCRYPT)) { - if (((WithCrypto & APPLICATION_PGP) != 0) && (msg->security & APPLICATION_PGP)) + if (((WithCrypto & APPLICATION_PGP) != 0) && (e_post->security & APPLICATION_PGP)) encrypt_as = C_PgpDefaultKey; - else if (((WithCrypto & APPLICATION_SMIME) != 0) && (msg->security & APPLICATION_SMIME)) + else if (((WithCrypto & APPLICATION_SMIME) != 0) && (e_post->security & APPLICATION_SMIME)) encrypt_as = C_SmimeDefaultKey; if (!(encrypt_as && *encrypt_as)) encrypt_as = C_PostponeEncryptAs; if (encrypt_as && *encrypt_as) { - bool is_signed = (msg->security & SEC_SIGN); + bool is_signed = (e_post->security & SEC_SIGN); if (is_signed) - msg->security &= ~SEC_SIGN; + e_post->security &= ~SEC_SIGN; pgpkeylist = mutt_str_strdup(encrypt_as); - clear_content = msg->content; - if (mutt_protect(msg, pgpkeylist) == -1) + clear_content = e_post->content; + if (mutt_protect(e_post, pgpkeylist) == -1) { if (is_signed) - msg->security |= SEC_SIGN; + e_post->security |= SEC_SIGN; FREE(&pgpkeylist); - msg->content = mutt_remove_multipart(msg->content); - decode_descriptions(msg->content); + e_post->content = mutt_remove_multipart(e_post->content); + decode_descriptions(e_post->content); return -1; } if (is_signed) - msg->security |= SEC_SIGN; + e_post->security |= SEC_SIGN; FREE(&pgpkeylist); - mutt_encode_descriptions(msg->content, false); + mutt_encode_descriptions(e_post->content, false); } } /* make sure the message is written to the right part of a maildir * postponed folder. */ - msg->read = false; - msg->old = false; + e_post->read = false; + e_post->old = false; - mutt_prepare_envelope(msg->env, false); - mutt_env_to_intl(msg->env, NULL, NULL); /* Handle bad IDNAs the next time. */ + mutt_prepare_envelope(e_post->env, false); + mutt_env_to_intl(e_post->env, NULL, NULL); /* Handle bad IDNAs the next time. */ - if (mutt_write_fcc(NONULL(C_Postponed), msg, - (cur && (flags & SEND_REPLY)) ? cur->env->message_id : NULL, + if (mutt_write_fcc(NONULL(C_Postponed), e_post, + (e_cur && (flags & SEND_REPLY)) ? e_cur->env->message_id : NULL, true, fcc, NULL) < 0) { if (clear_content) { - mutt_body_free(&msg->content); - msg->content = clear_content; + mutt_body_free(&e_post->content); + e_post->content = clear_content; } - mutt_env_free(&msg->content->mime_headers); /* protected headers */ - msg->content = mutt_remove_multipart(msg->content); - decode_descriptions(msg->content); - mutt_unprepare_envelope(msg->env); + mutt_env_free(&e_post->content->mime_headers); /* protected headers */ + e_post->content = mutt_remove_multipart(e_post->content); + decode_descriptions(e_post->content); + mutt_unprepare_envelope(e_post->env); return -1; } @@ -1819,7 +1819,7 @@ static int postpone_message(struct Email *msg, struct Email *cur, char *fcc, Sen /** * ci_send_message - Send an email * @param flags Send mode, see #SendFlags - * @param msg Template to use for new message + * @param e_templ Template to use for new message * @param tempfile File specified by -i or -H * @param ctx Current mailbox * @param el List of Emails to send @@ -1827,7 +1827,7 @@ static int postpone_message(struct Email *msg, struct Email *cur, char *fcc, Sen * @retval -1 Message was aborted or an error occurred * @retval 1 Message was postponed */ -int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, +int ci_send_message(SendFlags flags, struct Email *e_templ, const char *tempfile, struct Context *ctx, struct EmailList *el) { char buf[1024]; @@ -1847,12 +1847,12 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, char *ctype = NULL; char *finalpath = NULL; struct EmailNode *en = NULL; - struct Email *cur = NULL; + struct Email *e_cur = NULL; if (el) en = STAILQ_FIRST(el); if (en) - cur = STAILQ_NEXT(en, entries) ? NULL : en->email; + e_cur = STAILQ_NEXT(en, entries) ? NULL : en->email; int rc = -1; @@ -1863,7 +1863,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, OptNewsSend = false; #endif - if (!flags && !msg && (C_Recall != MUTT_NO) && + if (!flags && !e_templ && (C_Recall != MUTT_NO) && mutt_num_postponed(ctx ? ctx->mailbox : NULL, true)) { /* If the user is composing a new message, check to see if there @@ -1889,13 +1889,13 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, * be necessary unless we are prompting the user or about to execute a * send-hook. */ - if (!msg) + if (!e_templ) { - msg = mutt_email_new(); + e_templ = mutt_email_new(); if (flags == SEND_POSTPONED) { - rc = mutt_get_postponed(ctx, msg, &cur, fcc, sizeof(fcc)); + rc = mutt_get_postponed(ctx, e_templ, &e_cur, fcc, sizeof(fcc)); if (rc < 0) { flags = SEND_POSTPONED; @@ -1905,7 +1905,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, #ifdef USE_NNTP /* If postponed message is a news article, it have * a "Newsgroups:" header line, then set appropriate flag. */ - if (msg->env->newsgroups) + if (e_templ->env->newsgroups) { flags |= SEND_NEWS; OptNewsSend = true; @@ -1920,25 +1920,25 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, if (flags & (SEND_POSTPONED | SEND_RESEND)) { - fp_tmp = mutt_file_fopen(msg->content->filename, "a+"); + fp_tmp = mutt_file_fopen(e_templ->content->filename, "a+"); if (!fp_tmp) { - mutt_perror(msg->content->filename); + mutt_perror(e_templ->content->filename); goto cleanup; } } - if (!msg->env) - msg->env = mutt_env_new(); + if (!e_templ->env) + e_templ->env = mutt_env_new(); } /* Parse and use an eventual list-post header */ - if ((flags & SEND_LIST_REPLY) && cur && cur->env && cur->env->list_post) + if ((flags & SEND_LIST_REPLY) && e_cur && e_cur->env && e_cur->env->list_post) { /* Use any list-post header as a template */ - mutt_parse_mailto(msg->env, NULL, cur->env->list_post); + mutt_parse_mailto(e_templ->env, NULL, e_cur->env->list_post); /* We don't let them set the sender's address. */ - mutt_addrlist_clear(&msg->env->from); + mutt_addrlist_clear(&e_templ->env->from); } if (!(flags & (SEND_KEY | SEND_POSTPONED | SEND_RESEND))) @@ -1948,44 +1948,44 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, if (!(flags & SEND_DRAFT_FILE)) { pbody = mutt_body_new(); - pbody->next = msg->content; /* don't kill command-line attachments */ - msg->content = pbody; + pbody->next = e_templ->content; /* don't kill command-line attachments */ + e_templ->content = pbody; ctype = mutt_str_strdup(C_ContentType); if (!ctype) ctype = mutt_str_strdup("text/plain"); - mutt_parse_content_type(ctype, msg->content); + mutt_parse_content_type(ctype, e_templ->content); FREE(&ctype); - msg->content->unlink = true; - msg->content->use_disp = false; - msg->content->disposition = DISP_INLINE; + e_templ->content->unlink = true; + e_templ->content->use_disp = false; + e_templ->content->disposition = DISP_INLINE; if (!tempfile) { mutt_mktemp(buf, sizeof(buf)); fp_tmp = mutt_file_fopen(buf, "w+"); - msg->content->filename = mutt_str_strdup(buf); + e_templ->content->filename = mutt_str_strdup(buf); } else { fp_tmp = mutt_file_fopen(tempfile, "a+"); - msg->content->filename = mutt_str_strdup(tempfile); + e_templ->content->filename = mutt_str_strdup(tempfile); } } else - fp_tmp = mutt_file_fopen(msg->content->filename, "a+"); + fp_tmp = mutt_file_fopen(e_templ->content->filename, "a+"); if (!fp_tmp) { mutt_debug(LL_DEBUG1, "can't create tempfile %s (errno=%d)\n", - msg->content->filename, errno); - mutt_perror(msg->content->filename); + e_templ->content->filename, errno); + mutt_perror(e_templ->content->filename); goto cleanup; } } /* this is handled here so that the user can match ~f in send-hook */ - if (cur && C_ReverseName && !(flags & (SEND_POSTPONED | SEND_RESEND))) + if (e_cur && C_ReverseName && !(flags & (SEND_POSTPONED | SEND_RESEND))) { /* We shouldn't have to worry about alias expansion here since we are * either replying to a real or postponed message, therefore no aliases @@ -1993,29 +1993,29 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, * addresses to the list. We just have to ensure the postponed messages * have their aliases expanded. */ - if (!TAILQ_EMPTY(&msg->env->from)) + if (!TAILQ_EMPTY(&e_templ->env->from)) { - mutt_debug(LL_DEBUG5, "msg->env->from before set_reverse_name: %s\n", - TAILQ_FIRST(&msg->env->from)->mailbox); - mutt_addrlist_clear(&msg->env->from); + mutt_debug(LL_DEBUG5, "e_templ->env->from before set_reverse_name: %s\n", + TAILQ_FIRST(&e_templ->env->from)->mailbox); + mutt_addrlist_clear(&e_templ->env->from); } - set_reverse_name(&msg->env->from, cur->env); + set_reverse_name(&e_templ->env->from, e_cur->env); } - if (cur && C_ReplyWithXorig && !(flags & (SEND_POSTPONED | SEND_RESEND | SEND_FORWARD))) + if (e_cur && C_ReplyWithXorig && !(flags & (SEND_POSTPONED | SEND_RESEND | SEND_FORWARD))) { - /* We shouldn't have to worry about freeing 'msg->env->from' before + /* We shouldn't have to worry about freeing 'e_templ->env->from' before * setting it here since this code will only execute when doing some * sort of reply. The pointer will only be set when using the -H command * line option. * - * If there is already a from address recorded in 'msg->env->from', + * If there is already a from address recorded in 'e_templ->env->from', * then it theoretically comes from C_ReverseName handling, and we don't use * the 'X-Orig-To header'. */ - if (!TAILQ_EMPTY(&cur->env->x_original_to) && TAILQ_EMPTY(&msg->env->from)) + if (!TAILQ_EMPTY(&e_cur->env->x_original_to) && TAILQ_EMPTY(&e_templ->env->from)) { - mutt_addrlist_copy(&msg->env->from, &cur->env->x_original_to, false); - mutt_debug(LL_DEBUG5, "msg->env->from extracted from X-Original-To: header: %s\n", - TAILQ_FIRST(&msg->env->from)->mailbox); + mutt_addrlist_copy(&e_templ->env->from, &e_cur->env->x_original_to, false); + mutt_debug(LL_DEBUG5, "e_templ->env->from extracted from X-Original-To: header: %s\n", + TAILQ_FIRST(&e_templ->env->from)->mailbox); } } @@ -2023,25 +2023,25 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, !((flags & SEND_DRAFT_FILE) && C_ResumeDraftFiles)) { if ((flags & (SEND_REPLY | SEND_FORWARD | SEND_TO_SENDER)) && ctx && - (envelope_defaults(msg->env, ctx->mailbox, el, flags) == -1)) + (envelope_defaults(e_templ->env, ctx->mailbox, el, flags) == -1)) { goto cleanup; } if (C_Hdrs) - process_user_recips(msg->env); + process_user_recips(e_templ->env); /* Expand aliases and remove duplicates/crossrefs */ - mutt_expand_aliases_env(msg->env); + mutt_expand_aliases_env(e_templ->env); if (flags & SEND_REPLY) - mutt_fix_reply_recipients(msg->env); + mutt_fix_reply_recipients(e_templ->env); #ifdef USE_NNTP if ((flags & SEND_NEWS) && ctx && (ctx->mailbox->magic == MUTT_NNTP) && - !msg->env->newsgroups) + !e_templ->env->newsgroups) { - msg->env->newsgroups = + e_templ->env->newsgroups = mutt_str_strdup(((struct NntpMboxData *) ctx->mailbox->mdata)->group); } #endif @@ -2049,7 +2049,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, if (!(flags & (SEND_MAILX | SEND_BATCH)) && !(C_Autoedit && C_EditHeaders) && !((flags & SEND_REPLY) && C_FastReply)) { - if (edit_envelope(msg->env, flags) == -1) + if (edit_envelope(e_templ->env, flags) == -1) goto cleanup; } @@ -2058,52 +2058,52 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, * patterns will work. if $use_from is unset, the from address is killed * after send-hooks are evaluated */ - const bool killfrom = TAILQ_EMPTY(&msg->env->from); + const bool killfrom = TAILQ_EMPTY(&e_templ->env->from); if (killfrom) { - mutt_addrlist_append(&msg->env->from, mutt_default_from()); + mutt_addrlist_append(&e_templ->env->from, mutt_default_from()); } - if ((flags & SEND_REPLY) && cur) + if ((flags & SEND_REPLY) && e_cur) { /* change setting based upon message we are replying to */ - mutt_message_hook(ctx ? ctx->mailbox : NULL, cur, MUTT_REPLY_HOOK); + mutt_message_hook(ctx ? ctx->mailbox : NULL, e_cur, MUTT_REPLY_HOOK); /* set the replied flag for the message we are generating so that the * user can use ~Q in a send-hook to know when reply-hook's are also * being used. */ - msg->replied = true; + e_templ->replied = true; } /* change settings based upon recipients */ - mutt_message_hook(NULL, msg, MUTT_SEND_HOOK); + mutt_message_hook(NULL, e_templ, MUTT_SEND_HOOK); /* Unset the replied flag from the message we are composing since it is * no longer required. This is done here because the FCC'd copy of * this message was erroneously get the 'R'eplied flag when stored in * a maildir-style mailbox. */ - msg->replied = false; + e_templ->replied = false; if (!(flags & SEND_KEY)) { - if (C_TextFlowed && (msg->content->type == TYPE_TEXT) && - (mutt_str_strcasecmp(msg->content->subtype, "plain") == 0)) + if (C_TextFlowed && (e_templ->content->type == TYPE_TEXT) && + (mutt_str_strcasecmp(e_templ->content->subtype, "plain") == 0)) { - mutt_param_set(&msg->content->parameter, "format", "flowed"); + mutt_param_set(&e_templ->content->parameter, "format", "flowed"); } } /* $use_from and/or $from might have changed in a send-hook */ if (killfrom) { - mutt_addrlist_clear(&msg->env->from); + mutt_addrlist_clear(&e_templ->env->from); if (C_UseFrom && !(flags & (SEND_POSTPONED | SEND_RESEND))) - mutt_addrlist_append(&msg->env->from, mutt_default_from()); + mutt_addrlist_append(&e_templ->env->from, mutt_default_from()); } if (C_Hdrs) - process_user_header(msg->env); + process_user_header(e_templ->env); if (flags & SEND_BATCH) mutt_file_copy_stream(stdin, fp_tmp); @@ -2116,7 +2116,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, /* include replies/forwarded messages, unless we are given a template */ if (!tempfile && (ctx || !(flags & (SEND_REPLY | SEND_FORWARD))) && - (generate_body(fp_tmp, msg, flags, ctx ? ctx->mailbox : NULL, el) == -1)) + (generate_body(fp_tmp, e_templ, flags, ctx ? ctx->mailbox : NULL, el) == -1)) { goto cleanup; } @@ -2131,12 +2131,12 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, /* This hook is even called for postponed messages, and can, e.g., be * used for setting the editor, the sendmail path, or the * envelope sender. */ - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e_templ, MUTT_SEND2_HOOK); /* wait until now to set the real name portion of our return address so * that $realname can be set in a send-hook */ { - struct Address *from = TAILQ_FIRST(&msg->env->from); + struct Address *from = TAILQ_FIRST(&e_templ->env->from); if (from && !from->personal && !(flags & (SEND_RESEND | SEND_POSTPONED))) from->personal = mutt_str_strdup(C_Realname); } @@ -2146,15 +2146,15 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, if (flags & SEND_MAILX) { - if (mutt_builtin_editor(msg->content->filename, msg, cur) == -1) + if (mutt_builtin_editor(e_templ->content->filename, e_templ, e_cur) == -1) goto cleanup; } else if (!(flags & SEND_BATCH)) { struct stat st; - time_t mtime = mutt_file_decrease_mtime(msg->content->filename, NULL); + time_t mtime = mutt_file_decrease_mtime(e_templ->content->filename, NULL); - mutt_update_encoding(msg->content); + mutt_update_encoding(e_templ->content); /* Select whether or not the user's editor should be called now. We * don't want to do this when: @@ -2169,52 +2169,52 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, (query_quadoption(C_ForwardEdit, _("Edit forwarded message?")) == MUTT_YES))) { /* If the this isn't a text message, look for a mailcap edit command */ - if (mutt_needs_mailcap(msg->content)) + if (mutt_needs_mailcap(e_templ->content)) { - if (!mutt_edit_attachment(msg->content)) + if (!mutt_edit_attachment(e_templ->content)) goto cleanup; } else if (!C_Editor || (mutt_str_strcmp("builtin", C_Editor) == 0)) - mutt_builtin_editor(msg->content->filename, msg, cur); + mutt_builtin_editor(e_templ->content->filename, e_templ, e_cur); else if (C_EditHeaders) { - mutt_env_to_local(msg->env); - mutt_edit_headers(C_Editor, msg->content->filename, msg, fcc, sizeof(fcc)); - mutt_env_to_intl(msg->env, NULL, NULL); + mutt_env_to_local(e_templ->env); + mutt_edit_headers(C_Editor, e_templ->content->filename, e_templ, fcc, sizeof(fcc)); + mutt_env_to_intl(e_templ->env, NULL, NULL); } else { - mutt_edit_file(C_Editor, msg->content->filename); - if (stat(msg->content->filename, &st) == 0) + mutt_edit_file(C_Editor, e_templ->content->filename); + if (stat(e_templ->content->filename, &st) == 0) { if (mtime != st.st_mtime) - fix_end_of_file(msg->content->filename); + fix_end_of_file(e_templ->content->filename); } else - mutt_perror(msg->content->filename); + mutt_perror(e_templ->content->filename); } /* If using format=flowed, perform space stuffing. Avoid stuffing when * recalling a postponed message where the stuffing was already * performed. If it has already been performed, the format=flowed * parameter will be present. */ - if (C_TextFlowed && (msg->content->type == TYPE_TEXT) && - (mutt_str_strcasecmp("plain", msg->content->subtype) == 0)) + if (C_TextFlowed && (e_templ->content->type == TYPE_TEXT) && + (mutt_str_strcasecmp("plain", e_templ->content->subtype) == 0)) { - char *p = mutt_param_get(&msg->content->parameter, "format"); + char *p = mutt_param_get(&e_templ->content->parameter, "format"); if (mutt_str_strcasecmp("flowed", p) != 0) - rfc3676_space_stuff(msg); + rfc3676_space_stuff(e_templ); } - mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK); + mutt_message_hook(NULL, e_templ, MUTT_SEND2_HOOK); } if (!(flags & (SEND_POSTPONED | SEND_FORWARD | SEND_KEY | SEND_RESEND | SEND_DRAFT_FILE))) { - if (stat(msg->content->filename, &st) == 0) + if (stat(e_templ->content->filename, &st) == 0) { /* if the file was not modified, bail out now */ - if ((mtime == st.st_mtime) && !msg->content->next && + if ((mtime == st.st_mtime) && !e_templ->content->next && (query_quadoption(C_AbortUnmodified, _("Abort unmodified message?")) == MUTT_YES)) { @@ -2223,13 +2223,13 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, } } else - mutt_perror(msg->content->filename); + mutt_perror(e_templ->content->filename); } } /* Set the message security unless: * 1) crypto support is not enabled (WithCrypto==0) - * 2) pgp: header field was present during message editing with $edit_headers (msg->security != 0) + * 2) pgp: header field was present during message editing with $edit_headers (e_templ->security != 0) * 3) we are resending a message * 4) we are recalling a postponed message (don't override the user's saved settings) * 5) we are in mailx mode @@ -2237,29 +2237,29 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, * * This is done after allowing the user to edit the message so that security * settings can be configured with send2-hook and $edit_headers. */ - if ((WithCrypto != 0) && (msg->security == 0) && + if ((WithCrypto != 0) && (e_templ->security == 0) && !(flags & (SEND_BATCH | SEND_MAILX | SEND_POSTPONED | SEND_RESEND))) { if (C_CryptAutosign) - msg->security |= SEC_SIGN; + e_templ->security |= SEC_SIGN; if (C_CryptAutoencrypt) - msg->security |= SEC_ENCRYPT; - if (C_CryptReplyencrypt && cur && (cur->security & SEC_ENCRYPT)) - msg->security |= SEC_ENCRYPT; - if (C_CryptReplysign && cur && (cur->security & SEC_SIGN)) - msg->security |= SEC_SIGN; - if (C_CryptReplysignencrypted && cur && (cur->security & SEC_ENCRYPT)) - msg->security |= SEC_SIGN; + e_templ->security |= SEC_ENCRYPT; + if (C_CryptReplyencrypt && e_cur && (e_cur->security & SEC_ENCRYPT)) + e_templ->security |= SEC_ENCRYPT; + if (C_CryptReplysign && e_cur && (e_cur->security & SEC_SIGN)) + e_templ->security |= SEC_SIGN; + if (C_CryptReplysignencrypted && e_cur && (e_cur->security & SEC_ENCRYPT)) + e_templ->security |= SEC_SIGN; if (((WithCrypto & APPLICATION_PGP) != 0) && - ((msg->security & (SEC_ENCRYPT | SEC_SIGN)) || C_CryptOpportunisticEncrypt)) + ((e_templ->security & (SEC_ENCRYPT | SEC_SIGN)) || C_CryptOpportunisticEncrypt)) { if (C_PgpAutoinline) - msg->security |= SEC_INLINE; - if (C_PgpReplyinline && cur && (cur->security & SEC_INLINE)) - msg->security |= SEC_INLINE; + e_templ->security |= SEC_INLINE; + if (C_PgpReplyinline && e_cur && (e_cur->security & SEC_INLINE)) + e_templ->security |= SEC_INLINE; } - if (msg->security || C_CryptOpportunisticEncrypt) + if (e_templ->security || C_CryptOpportunisticEncrypt) { /* When replying / forwarding, use the original message's * crypto system. According to the documentation, @@ -2268,35 +2268,35 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, * Problem: At least with forwarding, this doesn't really * make much sense. Should we have an option to completely * disable individual mechanisms at run-time? */ - if (cur) + if (e_cur) { if (((WithCrypto & APPLICATION_PGP) != 0) && C_CryptAutopgp && - (cur->security & APPLICATION_PGP)) + (e_cur->security & APPLICATION_PGP)) { - msg->security |= APPLICATION_PGP; + e_templ->security |= APPLICATION_PGP; } else if (((WithCrypto & APPLICATION_SMIME) != 0) && C_CryptAutosmime && - (cur->security & APPLICATION_SMIME)) + (e_cur->security & APPLICATION_SMIME)) { - msg->security |= APPLICATION_SMIME; + e_templ->security |= APPLICATION_SMIME; } } /* No crypto mechanism selected? Use availability + smime_is_default * for the decision. */ - if (!(msg->security & (APPLICATION_SMIME | APPLICATION_PGP))) + if (!(e_templ->security & (APPLICATION_SMIME | APPLICATION_PGP))) { if (((WithCrypto & APPLICATION_SMIME) != 0) && C_CryptAutosmime && C_SmimeIsDefault) { - msg->security |= APPLICATION_SMIME; + e_templ->security |= APPLICATION_SMIME; } else if (((WithCrypto & APPLICATION_PGP) != 0) && C_CryptAutopgp) { - msg->security |= APPLICATION_PGP; + e_templ->security |= APPLICATION_PGP; } else if (((WithCrypto & APPLICATION_SMIME) != 0) && C_CryptAutosmime) { - msg->security |= APPLICATION_SMIME; + e_templ->security |= APPLICATION_SMIME; } } } @@ -2307,26 +2307,26 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, /* If something has already enabled encryption, e.g. C_CryptAutoencrypt * or C_CryptReplyencrypt, then don't enable opportunistic encrypt for * the message. */ - if (!(msg->security & SEC_ENCRYPT)) + if (!(e_templ->security & SEC_ENCRYPT)) { - msg->security |= SEC_OPPENCRYPT; - crypt_opportunistic_encrypt(msg); + e_templ->security |= SEC_OPPENCRYPT; + crypt_opportunistic_encrypt(e_templ); } } /* No permissible mechanisms found. Don't sign or encrypt. */ - if (!(msg->security & (APPLICATION_SMIME | APPLICATION_PGP))) - msg->security = SEC_NO_FLAGS; + if (!(e_templ->security & (APPLICATION_SMIME | APPLICATION_PGP))) + e_templ->security = SEC_NO_FLAGS; } /* Deal with the corner case where the crypto module backend is not available. * This can happen if configured without pgp/smime and with gpgme, but * $crypt_use_gpgme is unset. */ - if (msg->security && !crypt_has_module_backend(msg->security)) + if (e_templ->security && !crypt_has_module_backend(e_templ->security)) { mutt_error(_( "No crypto backend configured. Disabling message security setting.")); - msg->security = SEC_NO_FLAGS; + e_templ->security = SEC_NO_FLAGS; } /* specify a default fcc. if we are in batchmode, only save a copy of @@ -2335,26 +2335,26 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, if (!fcc[0] && !(flags & SEND_POSTPONED_FCC) && (!(flags & SEND_BATCH) || (C_Copy & 0x1))) { /* set the default FCC */ - const bool killfrom = TAILQ_EMPTY(&msg->env->from); + const bool killfrom = TAILQ_EMPTY(&e_templ->env->from); if (killfrom) { - mutt_addrlist_append(&msg->env->from, mutt_default_from()); + mutt_addrlist_append(&e_templ->env->from, mutt_default_from()); } - mutt_select_fcc(fcc, sizeof(fcc), msg); + mutt_select_fcc(fcc, sizeof(fcc), e_templ); if (killfrom) { - mutt_addrlist_clear(&msg->env->from); + mutt_addrlist_clear(&e_templ->env->from); } } - mutt_update_encoding(msg->content); + mutt_update_encoding(e_templ->content); if (!(flags & (SEND_MAILX | SEND_BATCH))) { main_loop: mutt_pretty_mailbox(fcc, sizeof(fcc)); - i = mutt_compose_menu(msg, fcc, sizeof(fcc), cur, + i = mutt_compose_menu(e_templ, fcc, sizeof(fcc), e_cur, ((flags & SEND_NO_FREE_HEADER) ? MUTT_COMPOSE_NOFREEHEADER : 0)); if (i == -1) { @@ -2369,7 +2369,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, } else if (i == 1) { - if (postpone_message(msg, cur, fcc, flags) != 0) + if (postpone_message(e_templ, e_cur, fcc, flags) != 0) goto main_loop; mutt_message(_("Message postponed")); rc = 1; @@ -2380,9 +2380,9 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, #ifdef USE_NNTP if (!(flags & SEND_NEWS)) #endif - if ((mutt_addrlist_count_recips(&msg->env->to) == 0) && - (mutt_addrlist_count_recips(&msg->env->cc) == 0) && - (mutt_addrlist_count_recips(&msg->env->bcc) == 0)) + if ((mutt_addrlist_count_recips(&e_templ->env->to) == 0) && + (mutt_addrlist_count_recips(&e_templ->env->cc) == 0) && + (mutt_addrlist_count_recips(&e_templ->env->bcc) == 0)) { if (!(flags & SEND_BATCH)) { @@ -2396,7 +2396,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, } } - if (mutt_env_to_intl(msg->env, &tag, &err)) + if (mutt_env_to_intl(e_templ->env, &tag, &err)) { mutt_error(_("Bad IDN in '%s': '%s'"), tag, err); FREE(&err); @@ -2406,7 +2406,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, goto cleanup; } - if (!msg->env->subject && !(flags & SEND_BATCH) && + if (!e_templ->env->subject && !(flags & SEND_BATCH) && (query_quadoption(C_AbortNosubject, _("No subject, abort sending?")) != MUTT_NO)) { /* if the abort is automatic, print an error message */ @@ -2415,13 +2415,13 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, goto main_loop; } #ifdef USE_NNTP - if ((flags & SEND_NEWS) && !msg->env->subject) + if ((flags & SEND_NEWS) && !e_templ->env->subject) { mutt_error(_("No subject specified")); goto main_loop; } - if ((flags & SEND_NEWS) && !msg->env->newsgroups) + if ((flags & SEND_NEWS) && !e_templ->env->newsgroups) { mutt_error(_("No newsgroup specified")); goto main_loop; @@ -2429,9 +2429,9 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, #endif if (!(flags & SEND_BATCH) && (C_AbortNoattach != MUTT_NO) && - !msg->content->next && (msg->content->type == TYPE_TEXT) && - (mutt_str_strcasecmp(msg->content->subtype, "plain") == 0) && - search_attach_keyword(msg->content->filename) && + !e_templ->content->next && (e_templ->content->type == TYPE_TEXT) && + (mutt_str_strcasecmp(e_templ->content->subtype, "plain") == 0) && + search_attach_keyword(e_templ->content->filename) && (query_quadoption(C_AbortNoattach, _("No attachments, cancel sending?")) != MUTT_NO)) { @@ -2444,14 +2444,14 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, goto main_loop; } - if (msg->content->next) - msg->content = mutt_make_multipart(msg->content); + if (e_templ->content->next) + e_templ->content = mutt_make_multipart(e_templ->content); /* Ok, we need to do it this way instead of handling all fcc stuff in * one place in order to avoid going to main_loop with encoded "env" * in case of error. Ugh. */ - mutt_encode_descriptions(msg->content, true); + mutt_encode_descriptions(e_templ->content, true); /* Make sure that clear_content and free_clear_content are * properly initialized -- we may visit this particular place in @@ -2463,25 +2463,25 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, if (WithCrypto) { - if (msg->security & (SEC_ENCRYPT | SEC_SIGN)) + if (e_templ->security & (SEC_ENCRYPT | SEC_SIGN)) { /* save the decrypted attachments */ - clear_content = msg->content; + clear_content = e_templ->content; - if ((crypt_get_keys(msg, &pgpkeylist, 0) == -1) || - (mutt_protect(msg, pgpkeylist) == -1)) + if ((crypt_get_keys(e_templ, &pgpkeylist, 0) == -1) || + (mutt_protect(e_templ, pgpkeylist) == -1)) { - msg->content = mutt_remove_multipart(msg->content); + e_templ->content = mutt_remove_multipart(e_templ->content); FREE(&pgpkeylist); - decode_descriptions(msg->content); + decode_descriptions(e_templ->content); goto main_loop; } - mutt_encode_descriptions(msg->content, false); + mutt_encode_descriptions(e_templ->content, false); } - /* at this point, msg->content is one of the following three things: + /* at this point, e_templ->content is one of the following three things: * - multipart/signed. In this case, clear_content is a child * - multipart/encrypted. In this case, clear_content exists independently * - application/pgp. In this case, clear_content exists independently @@ -2490,42 +2490,43 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, /* This is ugly -- lack of "reporting back" from mutt_protect(). */ - if (clear_content && (msg->content != clear_content) && (msg->content->parts != clear_content)) + if (clear_content && (e_templ->content != clear_content) && + (e_templ->content->parts != clear_content)) free_clear_content = true; } if (!OptNoCurses && !(flags & SEND_MAILX)) mutt_message(_("Sending message...")); - mutt_prepare_envelope(msg->env, true); + mutt_prepare_envelope(e_templ->env, true); if (C_FccBeforeSend) - save_fcc(msg, fcc, sizeof(fcc), clear_content, pgpkeylist, flags, &finalpath); + save_fcc(e_templ, fcc, sizeof(fcc), clear_content, pgpkeylist, flags, &finalpath); - i = send_message(msg); + i = send_message(e_templ); if (i < 0) { if (!(flags & SEND_BATCH)) { if (!WithCrypto) ; - else if ((msg->security & SEC_ENCRYPT) || - ((msg->security & SEC_SIGN) && (msg->content->type == TYPE_APPLICATION))) + else if ((e_templ->security & SEC_ENCRYPT) || + ((e_templ->security & SEC_SIGN) && (e_templ->content->type == TYPE_APPLICATION))) { - mutt_body_free(&msg->content); /* destroy PGP data */ - msg->content = clear_content; /* restore clear text. */ + mutt_body_free(&e_templ->content); /* destroy PGP data */ + e_templ->content = clear_content; /* restore clear text. */ } - else if ((msg->security & SEC_SIGN) && (msg->content->type == TYPE_MULTIPART)) + else if ((e_templ->security & SEC_SIGN) && (e_templ->content->type == TYPE_MULTIPART)) { - mutt_body_free(&msg->content->parts->next); /* destroy sig */ - msg->content = mutt_remove_multipart(msg->content); + mutt_body_free(&e_templ->content->parts->next); /* destroy sig */ + e_templ->content = mutt_remove_multipart(e_templ->content); } FREE(&pgpkeylist); - mutt_env_free(&msg->content->mime_headers); /* protected headers */ - msg->content = mutt_remove_multipart(msg->content); - decode_descriptions(msg->content); - mutt_unprepare_envelope(msg->env); + mutt_env_free(&e_templ->content->mime_headers); /* protected headers */ + e_templ->content = mutt_remove_multipart(e_templ->content); + decode_descriptions(e_templ->content); + mutt_unprepare_envelope(e_templ->env); FREE(&finalpath); goto main_loop; } @@ -2537,7 +2538,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, } if (!C_FccBeforeSend) - save_fcc(msg, fcc, sizeof(fcc), clear_content, pgpkeylist, flags, &finalpath); + save_fcc(e_templ, fcc, sizeof(fcc), clear_content, pgpkeylist, flags, &finalpath); if (!OptNoCurses && !(flags & SEND_MAILX)) { @@ -2546,7 +2547,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, _("Mail sent")); #ifdef USE_NOTMUCH if (C_NmRecord) - nm_record_message(ctx ? ctx->mailbox : NULL, finalpath, cur); + nm_record_message(ctx ? ctx->mailbox : NULL, finalpath, e_cur); #endif mutt_sleep(0); } @@ -2565,7 +2566,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, { STAILQ_FOREACH(en, el, entries) { - mutt_set_flag(ctx->mailbox, en->email, MUTT_REPLIED, is_reply(en->email, msg)); + mutt_set_flag(ctx->mailbox, en->email, MUTT_REPLIED, is_reply(en->email, e_templ)); } } } @@ -2590,7 +2591,7 @@ cleanup: mutt_file_fclose(&fp_tmp); if (!(flags & SEND_NO_FREE_HEADER)) - mutt_email_free(&msg); + mutt_email_free(&e_templ); FREE(&finalpath); return rc; diff --git a/send.h b/send.h index 333251f92..17e631de4 100644 --- a/send.h +++ b/send.h @@ -100,7 +100,7 @@ typedef uint16_t SendFlags; ///< Flags for ci_send_message(), e.g. # #define SEND_GROUP_CHAT_REPLY (1 << 13) ///< Reply to all recipients preserving To/Cc #define SEND_NEWS (1 << 14) ///< Reply to a news article -int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, struct Context *ctx, struct EmailList *el); +int ci_send_message(SendFlags flags, struct Email *e_templ, const char *tempfile, struct Context *ctx, struct EmailList *el); 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); @@ -113,7 +113,7 @@ void mutt_make_forward_subject(struct Envelope *env, struct Mailbox * void mutt_make_misc_reply_headers(struct Envelope *env, struct Envelope *curenv); void mutt_make_post_indent(struct Mailbox *m, struct Email *e, FILE *fp_out); struct Address *mutt_remove_xrefs(struct Address *a, struct Address *b); -int mutt_resend_message(FILE *fp, struct Context *ctx, struct Email *cur); +int mutt_resend_message(FILE *fp, struct Context *ctx, struct Email *e_cur); void mutt_set_followup_to(struct Envelope *e); #endif /* MUTT_SEND_H */ diff --git a/sort.c b/sort.c index 729c6448f..ebab9247d 100644 --- a/sort.c +++ b/sort.c @@ -430,14 +430,14 @@ void mutt_sort_headers(struct Context *ctx, bool init) ctx->mailbox->vcount = 0; for (int i = 0; i < ctx->mailbox->msg_count; i++) { - struct Email *cur = ctx->mailbox->emails[i]; - if ((cur->vnum != -1) || (cur->collapsed && (!ctx->pattern || cur->limited))) + struct Email *e_cur = ctx->mailbox->emails[i]; + if ((e_cur->vnum != -1) || (e_cur->collapsed && (!ctx->pattern || e_cur->limited))) { - cur->vnum = ctx->mailbox->vcount; + e_cur->vnum = ctx->mailbox->vcount; ctx->mailbox->v2r[ctx->mailbox->vcount] = i; ctx->mailbox->vcount++; } - cur->msgno = i; + e_cur->msgno = i; } /* re-collapse threads marked as collapsed */ diff --git a/test/email/mutt_email_cmp_strict.c b/test/email/mutt_email_cmp_strict.c index a368c6e78..c0abd7084 100644 --- a/test/email/mutt_email_cmp_strict.c +++ b/test/email/mutt_email_cmp_strict.c @@ -32,12 +32,12 @@ void test_mutt_email_cmp_strict(void) // bool mutt_email_cmp_strict(const struct Email *e1, const struct Email *e2); { - struct Email email = { 0 }; - TEST_CHECK(!mutt_email_cmp_strict(NULL, &email)); + struct Email e = { 0 }; + TEST_CHECK(!mutt_email_cmp_strict(NULL, &e)); } { - struct Email email = { 0 }; - TEST_CHECK(!mutt_email_cmp_strict(&email, NULL)); + struct Email e = { 0 }; + TEST_CHECK(!mutt_email_cmp_strict(&e, NULL)); } } diff --git a/test/email/mutt_email_free.c b/test/email/mutt_email_free.c index 7722c372e..7144f615e 100644 --- a/test/email/mutt_email_free.c +++ b/test/email/mutt_email_free.c @@ -37,8 +37,8 @@ void test_mutt_email_free(void) } { - struct Email *email = NULL; - mutt_email_free(&email); - TEST_CHECK_(1, "mutt_email_free(&email)"); + struct Email *e = NULL; + mutt_email_free(&e); + TEST_CHECK_(1, "mutt_email_free(&e)"); } } diff --git a/test/parse/mutt_rfc822_parse_line.c b/test/parse/mutt_rfc822_parse_line.c index 21013cdd2..31113b5c8 100644 --- a/test/parse/mutt_rfc822_parse_line.c +++ b/test/parse/mutt_rfc822_parse_line.c @@ -33,8 +33,8 @@ void test_mutt_rfc822_parse_line(void) // int mutt_rfc822_parse_line(struct Envelope *env, struct Email *e, char *line, char *p, bool user_hdrs, bool weed, bool do_2047); { - struct Email email = { 0 }; - TEST_CHECK(mutt_rfc822_parse_line(NULL, &email, "apple", "banana", false, + struct Email e = { 0 }; + TEST_CHECK(mutt_rfc822_parse_line(NULL, &e, "apple", "banana", false, false, false) == 0); } @@ -48,16 +48,16 @@ void test_mutt_rfc822_parse_line(void) { struct Envelope envelope; memset(&envelope, 0, sizeof(struct Envelope)); - struct Email email = { 0 }; - TEST_CHECK(mutt_rfc822_parse_line(&envelope, &email, NULL, "banana", false, + struct Email e = { 0 }; + TEST_CHECK(mutt_rfc822_parse_line(&envelope, &e, NULL, "banana", false, false, false) == 0); } { struct Envelope envelope; memset(&envelope, 0, sizeof(struct Envelope)); - struct Email email = { 0 }; - TEST_CHECK(mutt_rfc822_parse_line(&envelope, &email, "apple", NULL, false, + struct Email e = { 0 }; + TEST_CHECK(mutt_rfc822_parse_line(&envelope, &e, "apple", NULL, false, false, false) == 0); } } diff --git a/test/parse/mutt_rfc822_read_header.c b/test/parse/mutt_rfc822_read_header.c index c5c4fcb63..ae324d938 100644 --- a/test/parse/mutt_rfc822_read_header.c +++ b/test/parse/mutt_rfc822_read_header.c @@ -32,8 +32,8 @@ void test_mutt_rfc822_read_header(void) // struct Envelope *mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed); { - struct Email email = { 0 }; - TEST_CHECK(!mutt_rfc822_read_header(NULL, &email, false, false)); + struct Email e = { 0 }; + TEST_CHECK(!mutt_rfc822_read_header(NULL, &e, false, false)); } { -- 2.49.0