]> granicus.if.org Git - neomutt/blob - copy.h
merge: light refactoring
[neomutt] / copy.h
1 /**
2  * @file
3  * Duplicate the structure of an entire email
4  *
5  * @authors
6  * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.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_COPY_H
24 #define MUTT_COPY_H
25
26 #include "config.h"
27 #include <stdint.h>
28 #include <stdio.h>
29
30 struct Email;
31 struct Mailbox;
32
33 typedef uint16_t CopyMessageFlags;     ///< Flags for mutt_copy_message(), e.g. #MUTT_CM_NOHEADER
34 #define MUTT_CM_NO_FLAGS           0   ///< No flags are set
35 #define MUTT_CM_NOHEADER     (1 << 0)  ///< Don't copy the message header
36 #define MUTT_CM_PREFIX       (1 << 1)  ///< Quote the header and body
37 #define MUTT_CM_DECODE       (1 << 2)  ///< Decode the message body into text/plain
38 #define MUTT_CM_DISPLAY      (1 << 3)  ///< Output is displayed to the user
39 #define MUTT_CM_UPDATE       (1 << 4)  ///< Update structs on sync
40 #define MUTT_CM_WEED         (1 << 5)  ///< Weed message/rfc822 attachment headers
41 #define MUTT_CM_CHARCONV     (1 << 6)  ///< Perform character set conversions
42 #define MUTT_CM_PRINTING     (1 << 7)  ///< Printing the message - display light
43 #define MUTT_CM_REPLYING     (1 << 8)  ///< Replying the message
44 #define MUTT_CM_DECODE_PGP   (1 << 9)  ///< Used for decoding PGP messages
45 #define MUTT_CM_DECODE_SMIME (1 << 10) ///< Used for decoding S/MIME messages
46 #define MUTT_CM_VERIFY       (1 << 11) ///< Do signature verification
47 #define MUTT_CM_DECODE_CRYPT (MUTT_CM_DECODE_PGP | MUTT_CM_DECODE_SMIME)
48
49 typedef uint32_t CopyHeaderFlags;   ///< Flags for mutt_copy_header(), e.g. #CH_UPDATE
50 #define CH_NO_FLAGS             0   ///< No flags are set
51 #define CH_UPDATE         (1 << 0)  ///< Update the status and x-status fields?
52 #define CH_WEED           (1 << 1)  ///< Weed the headers?
53 #define CH_DECODE         (1 << 2)  ///< Do RFC2047 header decoding
54 #define CH_XMIT           (1 << 3)  ///< Transmitting this message? (Ignore Lines: and Content-Length:)
55 #define CH_FROM           (1 << 4)  ///< Retain the "From " message separator?
56 #define CH_PREFIX         (1 << 5)  ///< Quote header using #C_IndentString string?
57 #define CH_NOSTATUS       (1 << 6)  ///< Suppress the status and x-status fields
58 #define CH_REORDER        (1 << 7)  ///< Re-order output of headers (specified by 'hdr_order')
59 #define CH_NONEWLINE      (1 << 8)  ///< Don't output terminating newline after the header
60 #define CH_MIME           (1 << 9)  ///< Ignore MIME fields
61 #define CH_UPDATE_LEN     (1 << 10) ///< Update Lines: and Content-Length:
62 #define CH_TXTPLAIN       (1 << 11) ///< Generate text/plain MIME headers
63 #define CH_NOLEN          (1 << 12) ///< Don't write Content-Length: and Lines:
64 #define CH_WEED_DELIVERED (1 << 13) ///< Weed eventual Delivered-To headers
65 #define CH_FORCE_FROM     (1 << 14) ///< Give CH_FROM precedence over CH_WEED?
66 #define CH_NOQFROM        (1 << 15) ///< Ignore ">From " line
67 #define CH_UPDATE_IRT     (1 << 16) ///< Update In-Reply-To:
68 #define CH_UPDATE_REFS    (1 << 17) ///< Update References:
69 #define CH_DISPLAY        (1 << 18) ///< Display result to user
70 #define CH_UPDATE_LABEL   (1 << 19) ///< Update X-Label: from email->env->x_label?
71 #define CH_UPDATE_SUBJECT (1 << 20) ///< Update Subject: protected header update
72 #define CH_VIRTUAL        (1 << 21) ///< Write virtual header lines too
73
74 int mutt_copy_hdr(FILE *fp_in, FILE *fp_out, LOFF_T off_start, LOFF_T off_end, CopyHeaderFlags chflags, const char *prefix, int wraplen);
75
76 int mutt_copy_header(FILE *fp_in, struct Email *e, FILE *fp_out, CopyHeaderFlags chflags, const char *prefix, int wraplen);
77
78 int mutt_copy_message_fp(FILE *fp_out, FILE *fp_in,       struct Email *e, CopyMessageFlags cmflags, CopyHeaderFlags chflags, int wraplen);
79 int mutt_copy_message   (FILE *fp_out, struct Mailbox *m, struct Email *e, CopyMessageFlags cmflags, CopyHeaderFlags chflags, int wraplen);
80
81 int mutt_append_message(struct Mailbox *dest, struct Mailbox *src, struct Email *e, CopyMessageFlags cmflags, CopyHeaderFlags chflags);
82
83 #endif /* MUTT_COPY_H */