Make a copy of a message from a FILE pointer.
645 LOFF_T new_offset = -1;
669 int rc_attach_del = -1;
670 LOFF_T new_length = body->
length;
671 struct Buffer *quoted_date = NULL;
681 goto attach_del_cleanup;
687 goto attach_del_cleanup;
689 new_lines = e->
lines - del;
693 goto attach_del_cleanup;
694 fprintf(fp_out,
"Content-Length: " OFF_T_FMT
"\n", new_length);
698 fprintf(fp_out,
"Lines: %d\n", new_lines);
701 if (ferror(fp_out) || feof(fp_out))
702 goto attach_del_cleanup;
703 new_offset = ftello(fp_out);
707 goto attach_del_cleanup;
709 goto attach_del_cleanup;
713 LOFF_T fail = ((ftello(fp_out) - new_offset) - new_length);
716 mutt_error(ngettext(
"The length calculation was wrong by %ld byte",
717 "The length calculation was wrong by %ld bytes", fail),
726 e->
lines = new_lines;
727 body->
offset = new_offset;
729 body->
length = new_length;
737 return rc_attach_del;
741 (chflags &
CH_PREFIX) ? prefix : NULL, wraplen) == -1)
746 new_offset = ftello(fp_out);
752 struct State s = { 0 };
778 struct Body *cur = NULL;
786 fputs(
"MIME-Version: 1.0\n", fp_out);
798 mutt_error(
_(
"No decryption engine available for message"));
823 size_t bytes = body->
length;
825 fputs(prefix, fp_out);
827 while (((c = fgetc(fp_in)) != EOF) && bytes--)
832 fputs(prefix, fp_out);
843 body->
offset = new_offset;
size_t mutt_buffer_len(const struct Buffer *buf)
Calculate the length of a Buffer.
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
int mutt_copy_header(FILE *fp_in, struct Email *e, FILE *fp_out, CopyHeaderFlags chflags, const char *prefix, int wraplen)
Copy Email header.
#define MUTT_CM_WEED
Weed message/rfc822 attachment headers.
#define MUTT_CM_REPLYING
Replying the message.
#define MUTT_CM_PREFIX
Quote the header and body.
#define MUTT_CM_UPDATE
Update structs on sync.
#define MUTT_CM_VERIFY
Do signature verification.
#define MUTT_CM_DECODE_PGP
Used for decoding PGP messages.
#define MUTT_CM_DECODE
Decode the message body into text/plain.
#define MUTT_CM_CHARCONV
Perform character set conversions.
#define MUTT_CM_DECODE_SMIME
Used for decoding S/MIME messages.
#define MUTT_CM_PRINTING
Printing the message - display light.
#define MUTT_CM_DECODE_CRYPT
#define MUTT_CM_NOHEADER
Don't copy the message header.
#define MUTT_CM_DISPLAY
Output is displayed to the user.
int crypt_smime_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur)
Wrapper for CryptModuleSpecs::decrypt_mime()
int crypt_pgp_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur)
Wrapper for CryptModuleSpecs::decrypt_mime()
void mutt_date_make_date(struct Buffer *buf, bool local)
Write a date in RFC822 format to a buffer.
void mutt_body_free(struct Body **ptr)
Free a Body.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
int mutt_body_handler(struct Body *b, struct State *s)
Handler for the Body of an email.
void mutt_make_string(char *buf, size_t buflen, int cols, const char *s, struct Mailbox *m, int inpgr, struct Email *e, MuttFormatFlags flags, const char *progress)
Create formatted strings using mailbox expandos.
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
@ TYPE_MULTIPART
Type: 'multipart/*'.
@ TYPE_APPLICATION
Type: 'application/*'.
#define MUTT_WEED
Weed headers even when not in display mode.
#define MUTT_VERIFY
Perform signature verification.
#define MUTT_CHARCONV
Do character set conversions.
#define MUTT_DISPLAY
Output is displayed to the user.
#define MUTT_REPLYING
Are we replying?
#define MUTT_PRINTING
Are we printing? - MUTT_DISPLAY "light".
#define APPLICATION_PGP
Use PGP to encrypt/sign.
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
#define SEC_ENCRYPT
Email is encrypted.
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
unsigned int type
content-type primary type, ContentType
String manipulation buffer.
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
bool attach_del
Has an attachment marked for deletion.
Keep track when processing files.
int wraplen
Width to wrap lines to (when flags & MUTT_DISPLAY)
StateFlags flags
Flags, e.g. MUTT_DISPLAY.
FILE * fp_out
File to write to.
char * prefix
String to add to the beginning of each output line.
FILE * fp_in
File to read from.