* @param fp File handle to attachment
* @param actx Attachment Context
* @param cur Attachment to forward (OPTIONAL)
- * @param flags Send mode, e.g. #SEND_RESEND
+ * @param flags Send mode, see #SendFlags
*
* This is different from the previous function since we want to mimic the
* index menu's behavior.
* context structure to find messages, while, on the attachment menu, messages
* are referenced through the attachment index.
*/
-static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, struct Body *cur, int flags)
+static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx,
+ struct Body *cur, SendFlags flags)
{
struct Email *e_cur = NULL;
struct Email *e_tmp = NULL;
* @param e Email
* @param actx Attachment Context
* @param cur Current message
- * @param flags Send mode, e.g. #SEND_RESEND
+ * @param flags Send mode, see #SendFlags
*/
void mutt_attach_forward(FILE *fp, struct Email *e, struct AttachCtx *actx,
- struct Body *cur, int flags)
+ struct Body *cur, SendFlags flags)
{
if (check_all_msg(actx, cur, false))
attach_forward_msgs(fp, actx, cur, flags);
* @param env Envelope to fill in
* @param actx Attachment Context
* @param parent Parent Email
- * @param flags Flags, e.g. #SEND_LIST_REPLY
+ * @param flags Flags, see #SendFlags
* @retval 0 Success
* @retval -1 Error
*
* Note that this code is horribly similar to envelope_defaults() from send.c.
*/
static int attach_reply_envelope_defaults(struct Envelope *env, struct AttachCtx *actx,
- struct Email *parent, int flags)
+ struct Email *parent, SendFlags flags)
{
struct Envelope *curenv = NULL;
struct Email *e = NULL;
* @param e Email
* @param actx Attachment Context
* @param cur Current message
- * @param flags Send mode, e.g. #SEND_RESEND
+ * @param flags Send mode, see #SendFlags
*/
void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx,
- struct Body *cur, int flags)
+ struct Body *cur, SendFlags flags)
{
bool mime_reply_any = false;
/**
* edit_envelope - Edit Envelope fields
* @param en Envelope to edit
- * @param flags Flags, e.g. #SEND_LIST_REPLY
+ * @param flags Flags, see #SendFlags
* @retval 0 Success
* @retval -1 Failure
*/
-static int edit_envelope(struct Envelope *en, int flags)
+static int edit_envelope(struct Envelope *en, SendFlags flags)
{
char buf[8192];
* default_to - Generate default email addresses
* @param[out] to 'To' address
* @param[in] env Envelope to populate
- * @param[in] flags Flags, e.g. #SEND_LIST_REPLY
+ * @param[in] flags Flags, see #SendFlags
* @param[in] hmfupto If true, add 'followup-to' address to 'to' address
* @retval 0 Success
* @retval -1 Aborted
*/
-static int default_to(struct Address **to, struct Envelope *env, int flags, int hmfupto)
+static int default_to(struct Address **to, struct Envelope *env, SendFlags flags, int hmfupto)
{
char prompt[256];
* mutt_fetch_recips - Generate recpients for a reply email
* @param out Envelope to populate
* @param in Envelope of source email
- * @param flags Flags, e.g. SEND_LIST_REPLY
+ * @param flags Flags, see #SendFlags
* @retval 0 Success
* @retval -1 Failure
*/
-int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, int flags)
+int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, SendFlags flags)
{
struct Address *tmp = NULL;
int hmfupto = -1;
* @param env Envelope for result
* @param m Mailbox
* @param el List of Emails to use
- * @param flags Flags, e.g. #SEND_REPLY
+ * @param flags Flags, see #SendFlags
* @retval 0 Success
* @retval -1 Failure
*/
static int envelope_defaults(struct Envelope *env, struct Mailbox *m,
- struct EmailList *el, int flags)
+ struct EmailList *el, SendFlags flags)
{
if (!el || STAILQ_EMPTY(el))
return -1;
* generate_body - Create a new email body
* @param tempfp Stream for outgoing message
* @param msg Header for outgoing message
- * @param flags Compose mode
+ * @param flags Compose mode, see #SendFlags
* @param m Mailbox
* @param el List of Emails to use
* @retval 0 Success
* @retval -1 Error
*/
-static int generate_body(FILE *tempfp, struct Email *msg, int flags,
+static int generate_body(FILE *tempfp, struct Email *msg, SendFlags flags,
struct Mailbox *m, struct EmailList *el)
{
int i;
* @param[in] fcc_len Length of fcc buffer
* @param[in] clear_content Cleartext content of Email
* @param[in] pgpkeylist List of pgp keys
- * @param[in] flags Send mode, e.g. #SEND_RESEND
+ * @param[in] flags Send mode, see #SendFlags
* @param[out] finalpath Path of final folder
* @retval 0 Success
* @retval -1 Error
*/
static int save_fcc(struct Email *msg, char *fcc, size_t fcc_len, struct Body *clear_content,
- char *pgpkeylist, int flags, char **finalpath)
+ char *pgpkeylist, SendFlags flags, char **finalpath)
{
int rc = 0;
struct Body *save_content = NULL;
* @param msg Email to postpone
* @param cur Current Email in the index
* @param fcc Folder for 'sent mail'
- * @param flags Send mode, e.g. #SEND_RESEND
+ * @param flags Send mode, see #SendFlags
* @retval 0 Success
* @retval -1 Error
*/
-static int postpone_message(struct Email *msg, struct Email *cur, char *fcc, int flags)
+static int postpone_message(struct Email *msg, struct Email *cur, char *fcc, SendFlags flags)
{
char *pgpkeylist = NULL;
char *encrypt_as = NULL;
/**
* ci_send_message - Send an email
- * @param flags send mode, e.g. #SEND_RESEND
- * @param msg template to use for new message
- * @param tempfile file specified by -i or -H
- * @param ctx current mailbox
+ * @param flags Send mode, see #SendFlags
+ * @param msg 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 0 Message was successfully sent
* @retval -1 Message was aborted or an error occurred
* @retval 1 Message was postponed
*/
-int ci_send_message(int flags, struct Email *msg, const char *tempfile,
+int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile,
struct Context *ctx, struct EmailList *el)
{
char buf[1024];
if (flags == SEND_POSTPONED)
{
- flags = mutt_get_postponed(ctx, msg, &cur, fcc, sizeof(fcc));
- if (flags < 0)
+ rc = mutt_get_postponed(ctx, msg, &cur, fcc, sizeof(fcc));
+ if (rc < 0)
{
flags = SEND_POSTPONED;
goto cleanup;
}
+ flags = rc;
#ifdef USE_NNTP
/* If postponed message is a news article, it have
* a "Newsgroups:" header line, then set appropriate flag.
extern bool C_SigOnTop;
extern bool C_UseFrom;
-/* flags to ci_send_message() */
+typedef uint16_t SendFlags; ///< Flags for ci_send_message(), e.g. #SEND_REPLY
+#define SEND_NO_FLAGS 0 ///< No flags are set
#define SEND_REPLY (1 << 0) ///< Reply to sender
#define SEND_GROUP_REPLY (1 << 1) ///< Reply to all
#define SEND_LIST_REPLY (1 << 2) ///< Reply to mailing list
#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(int flags, struct Email *msg, const char *tempfile, struct Context *ctx, struct EmailList *el);
+int ci_send_message(SendFlags flags, struct Email *msg, 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);
-int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, int flags);
+int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, SendFlags flags);
void mutt_fix_reply_recipients(struct Envelope *env);
void mutt_forward_intro(struct Mailbox *m, struct Email *e, FILE *fp);
void mutt_forward_trailer(struct Mailbox *m, struct Email *e, FILE *fp);