/**
* 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];
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.
*
* 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;
}
}
/**
* 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;
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 */
}
}
- 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);
}
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);
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))
{
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);
}
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);
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);
/**
* 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];
init_header_padding();
- rd.email = msg;
+ rd.email = e;
rd.fcc = fcc;
struct Menu *menu = mutt_menu_new(MENU_COMPOSE);
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)
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:
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:
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:
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();
}
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();
}
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();
}
#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:
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 */
{
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
{
* 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)
}
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:
menu->redraw |= REDRAW_STATUS;
- mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
+ mutt_message_hook(NULL, e, MUTT_SEND2_HOOK);
break;
}
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;
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;
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)
}
/* 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;
/* 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++;
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)
}
/* 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;
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;
}
/* 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;
}
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:
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;
}
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:
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);
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:
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:
}
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:
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:
}
#ifdef MIXMASTER
- if (!STAILQ_EMPTY(&msg->chain) && (mix_check_message(msg) != 0))
+ if (!STAILQ_EMPTY(&e->chain) && (mix_check_message(e) != 0))
break;
#endif
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:
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);
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:
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;
}
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:
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:
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;
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"));
}
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:
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
}
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);
/* 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 */
/**
* 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;
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"));
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':
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])));
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,
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)
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);
/* 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 */
struct Email;
/**
- * struct MuttThread - An email conversation
+ * struct MuttThread - An Email conversation
*/
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);
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
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;
*/
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);
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;
}
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();
/* 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;
* 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;
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"));
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);
!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;
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"));
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);
*/
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)
{
/**
* 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;
* 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
#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);
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);
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;
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)
{
/* 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. */
if (!STAILQ_EMPTY(&attach))
{
- struct Body *b = msg->content;
+ struct Body *b = e->content;
while (b && b->next)
b = b->next;
else
{
b = mutt_make_file_attach(np->data);
- msg->content = b;
+ e->content = b;
}
if (!b)
{
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)
if (edit_infile)
{
if (include_file)
- msg->content->unlink = false;
+ e->content->unlink = false;
else if (draft_file)
{
if (truncate(expanded_infile, 0) == -1)
* 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
mutt_file_fclose(&fp_out);
}
- mutt_email_free(&msg);
+ mutt_email_free(&e);
}
/* !edit_infile && draft_file will leave the tempfile around */
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;
C_Sort = old_sort;
}
- old_hdrs = NULL;
+ e_old = NULL;
old_msg_count = 0;
/* simulate a close */
{
/* save the old headers */
old_msg_count = m->msg_count;
- old_hdrs = m->emails;
+ e_old = m->emails;
m->emails = NULL;
}
{
/* 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;
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;
{
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;
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;
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;
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)
{
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;
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;
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))
{
mutt_email_free(&m->email);
m->parts = saved_parts;
- m->email = saved_hdr;
+ m->email = e_saved;
}
mutt_file_fclose(&s.fp_in);
}
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);
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 */
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);
}
}
}
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 };
* 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 */
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;
{
/* 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;
/* 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)
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;
}
}
* 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;
}
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)
{
cur = cur->next;
if (!cur)
return -1;
- tmp = find_virtual(cur, 0);
- } while (!tmp);
+ e_tmp = find_virtual(cur, 0);
+ } while (!e_tmp);
}
else
{
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;
}
/**
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)
{
/* 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"));
mutt_error(_("Parent message is not visible in this limited view"));
return -1;
}
- return parent->vnum;
+ return e_parent->vnum;
}
/**
struct Mailbox *m = ctx->mailbox;
- struct Email *cur = NULL;
+ struct Email *e = NULL;
m->vcount = 0;
ctx->vsize = 0;
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;
}
}
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++;
}
#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)
/**
* 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
* 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;
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)
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)
/**
* 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;
}
}
/**
* 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;
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)
{
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 */
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);
}
/**
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);
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);
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
/**
* 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;
}
/**
* 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;
}
/* 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);
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);
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 */
/**
* 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;
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. */
* 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) */
{
/* 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) */
/* 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) */
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;
}
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 */
/**
* 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;
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 "
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();
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) "
}
}
- return msg->security;
+ return e->security;
}
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);
{
/* 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)
/* 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)) \
void mutt_clear_pager_position(void)
{
TopLine = 0;
- OldHdr = NULL;
+ OldEmail = NULL;
}
/**
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)
continue;
}
else
- OldHdr = NULL;
+ OldEmail = NULL;
ch = km_dokey(MENU_PAGER);
if (ch >= 0)
break;
default:
TopLine = rd.topline;
- OldHdr = extra->email;
+ OldEmail = extra->email;
break;
}
}
* 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
* @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;
/* 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)
{
/* 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;
}
}
* 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 */
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");
{
if (!crypt_valid_passphrase(APPLICATION_SMIME))
goto bail;
- crypt_smime_getkeys(newhdr->env);
+ crypt_smime_getkeys(e_new->env);
mutt_message(_("Decrypting message..."));
}
goto bail;
}
- newhdr->security |= sec_type;
+ e_new->security |= sec_type;
b->type = TYPE_TEXT;
mutt_str_replace(&b->subtype, "plain");
}
}
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;
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;
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);
/* 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);
}
}
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;
}
* 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;
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);
}
/**
* @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;
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;
}
}
- 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. "
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;
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++)
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
{
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);
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);
/**
* 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;
*/
struct Address *a = NULL;
- TAILQ_FOREACH(a, &msg->env->to, entries)
+ TAILQ_FOREACH(a, &e->env->to, entries)
{
if (!a->group && !strchr(a->mailbox, '@'))
{
}
/* 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;
};
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 */
/**
* 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;
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,
/**
* 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)
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
* 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;
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);
}
/**
* 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;
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)
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);
}
#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
#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;
}
/**
* 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;
}
{
/* 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;
/**
* 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
* @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;
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;
* 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();
/* 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 */
if (!C_FccBeforeSend)
{
- msg->content = tmpbody;
+ e->content = tmpbody;
if ((WithCrypto != 0) && save_sig)
{
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)
{
/**
* 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;
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;
}
/**
* 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
* @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];
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;
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
* 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;
#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;
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)))
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
* 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);
}
}
!((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
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;
}
* 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);
/* 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;
}
/* 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);
}
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:
(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))
{
}
}
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
*
* 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,
* 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;
}
}
}
/* 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
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)
{
}
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;
#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))
{
}
}
- 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);
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 */
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;
#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))
{
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
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
/* 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;
}
}
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))
{
_("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);
}
{
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));
}
}
}
mutt_file_fclose(&fp_tmp);
if (!(flags & SEND_NO_FREE_HEADER))
- mutt_email_free(&msg);
+ mutt_email_free(&e_templ);
FREE(&finalpath);
return rc;
#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);
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 */
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 */
// 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));
}
}
}
{
- 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)");
}
}
// 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);
}
{
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);
}
}
// 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));
}
{