1 /**
2  * @file
3  * Prepare and send an email
4  *
5  * @authors
6  * Copyright (C) 2018 Richard Russon <rich@flatcap.org>
7  *
8  * @copyright
9  * This program is free software: you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License as published by the Free Software
11  * Foundation, either version 2 of the License, or (at your option) any later
12  * version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  * details.
18  *
19  * You should have received a copy of the GNU General Public License along with
20  * this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef MUTT_SEND_H
24 #define MUTT_SEND_H
25 
26 #include <stdbool.h>
27 #include <stdint.h>
28 #include <stdio.h>
29 
30 struct AddressList;
31 struct Body;
32 struct ConfigSubset;
33 struct Email;
34 struct EmailList;
35 struct Envelope;
36 struct Mailbox;
37 
38 typedef uint16_t SendFlags;             ///< Flags for mutt_send_message(), e.g. #SEND_REPLY
39 #define SEND_NO_FLAGS               0   ///< No flags are set
40 #define SEND_REPLY            (1 << 0)  ///< Reply to sender
41 #define SEND_GROUP_REPLY      (1 << 1)  ///< Reply to all
42 #define SEND_LIST_REPLY       (1 << 2)  ///< Reply to mailing list
43 #define SEND_FORWARD          (1 << 3)  ///< Forward email
44 #define SEND_POSTPONED        (1 << 4)  ///< Recall a postponed email
45 #define SEND_BATCH            (1 << 5)  ///< Send email in batch mode (without user interaction)
46 #define SEND_KEY              (1 << 6)  ///< Mail a PGP public key
47 #define SEND_RESEND           (1 << 7)  ///< Reply using the current email as a template
48 #define SEND_POSTPONED_FCC    (1 << 8)  ///< Used by mutt_get_postponed() to signal that the x-mutt-fcc header field was present
49 #define SEND_NO_FREE_HEADER   (1 << 9)  ///< Used by the -E flag
50 #define SEND_DRAFT_FILE       (1 << 10) ///< Used by the -H flag
51 #define SEND_TO_SENDER        (1 << 11) ///< Compose new email to sender
52 #define SEND_GROUP_CHAT_REPLY (1 << 12) ///< Reply to all recipients preserving To/Cc
53 #define SEND_NEWS             (1 << 13) ///< Reply to a news article
54 
55 void            mutt_add_to_reference_headers(struct Envelope *env, struct Envelope *curenv, struct ConfigSubset *sub);
56 struct Address *mutt_default_from(struct ConfigSubset *sub);
57 int             mutt_edit_address(struct AddressList *al, const char *field, bool expand_aliases);
58 void            mutt_encode_descriptions(struct Body *b, bool recurse, struct ConfigSubset *sub);
59 int             mutt_fetch_recips(struct Envelope *out, struct Envelope *in, SendFlags flags, struct ConfigSubset *sub);
60 void            mutt_fix_reply_recipients(struct Envelope *env, struct ConfigSubset *sub);
61 void            mutt_forward_intro(struct Email *e, FILE *fp, struct ConfigSubset *sub);
62 void            mutt_forward_trailer(struct Email *e, FILE *fp, struct ConfigSubset *sub);
63 void            mutt_make_attribution(struct Email *e, FILE *fp_out, struct ConfigSubset *sub);
64 void            mutt_make_forward_subject(struct Envelope *env, struct Email *e, struct ConfigSubset *sub);
65 void            mutt_make_misc_reply_headers(struct Envelope *env, struct Envelope *curenv, struct ConfigSubset *sub);
66 void            mutt_make_post_indent(struct Email *e, FILE *fp_out, struct ConfigSubset *sub);
67 int             mutt_resend_message(FILE *fp, struct Mailbox *m, struct Email *e_cur, struct ConfigSubset *sub);
68 int             mutt_send_message(SendFlags flags, struct Email *e_templ, const char *tempfile, struct Mailbox *m, struct EmailList *el, struct ConfigSubset *sub);
69 void            mutt_set_followup_to(struct Envelope *env, struct ConfigSubset *sub);
70 bool            mutt_send_list_subscribe(struct Mailbox *m, const struct Email *e);
71 bool            mutt_send_list_unsubscribe(struct Mailbox *m, const struct Email *e);
72 
73 #endif /* MUTT_SEND_H */
74