57 char encoded[11] = { 0 };
73 for (
size_t i = 0; i < rc; i++)
75 fputc(encoded[i], fp_out);
114 if (istext && (ch ==
'\n') && (ch1 !=
'\r'))
152 char line[77] = { 0 };
157 if ((
linelen == 76) && ((istext && (c !=
'\n')) || !istext))
166 fputs(
"=\n", fp_out);
175 char savechar = line[
linelen - 1];
196 else if ((
linelen == 1) && (line[0] ==
'.'))
202 if ((c ==
'\n') && istext)
209 sprintf(line +
linelen - 1,
"=%2.2X", (
unsigned char) line[
linelen - 1]);
214 int savechar2 = line[
linelen - 1];
219 fprintf(fp_out,
"\n=%2.2X", (
unsigned char) savechar2);
230 else if ((c != 9) && ((c < 32) || (c > 126) || (c ==
'=')))
242 sprintf(line +
linelen,
"=%2.2X", (
unsigned char) c);
261 sprintf(line +
linelen - 1,
"=%2.2X", (
unsigned char) line[
linelen - 1]);
265 char savechar = line[
linelen - 1];
270 snprintf(line,
sizeof(line),
"=%2.2X", (
unsigned char) savechar);
312 mutt_error(
_(
"No boundary parameter found [report this error]"));
315 char boundary[128] = { 0 };
320 fprintf(
fp,
"\n--%s\n", boundary);
327 fprintf(
fp,
"\n--%s--\n", boundary);
328 return ferror(
fp) ? -1 : 0;
335 fputs(
"Version: 1\n",
fp);
349 char send_charset[128] = { 0 };
378 return ferror(
fp) ? -1 : 0;
size_t mutt_b64_encode(const char *in, size_t inlen, char *out, size_t outlen)
Convert raw bytes to null-terminated base64 string.
SecurityFlags mutt_is_application_pgp(const struct Body *b)
Does the message use PGP?
char * mutt_body_get_charset(struct Body *b, char *buf, size_t buflen)
Get a body's character set.
Structs that make up an email.
int mutt_file_copy_stream(FILE *fp_in, FILE *fp_out)
Copy the contents of one file into another.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
#define mutt_debug(LEVEL,...)
@ LL_DEBUG1
Log at debug level 1.
@ ENC_BASE64
Base-64 encoded text.
@ ENC_QUOTED_PRINTABLE
Quoted-printable text.
@ TYPE_MULTIPART
Type: 'multipart/*'.
@ TYPE_APPLICATION
Type: 'application/*'.
@ TYPE_TEXT
Type: 'text/*'.
int mutt_ch_fgetconv(struct FgetConv *fc)
Convert a file's character set.
struct FgetConv * mutt_ch_fgetconv_open(FILE *fp, const char *from, const char *to, uint8_t flags)
Prepare a file for charset conversion.
void mutt_ch_fgetconv_close(struct FgetConv **ptr)
Close an fgetconv handle.
#define MUTT_ICONV_NO_FLAGS
No flags are set.
Convenience wrapper for the library headers.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
bool mutt_is_text_part(const struct Body *b)
Is this part of an email in plain text?
Some miscellaneous functions.
API for encryption/signing of emails.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
static void encode_quoted(struct FgetConv *fc, FILE *fp_out, bool istext)
Encode text as quoted printable.
static bool write_as_text_part(struct Body *b)
Should the Body be written as a text MIME part.
static void encode_base64(struct FgetConv *fc, FILE *fp_out, int istext)
Base64-encode some data.
int mutt_write_mime_body(struct Body *b, FILE *fp, struct ConfigSubset *sub)
Write a MIME part.
static void encode_8bit(struct FgetConv *fc, FILE *fp_out)
Write the data as raw 8-bit data.
static void b64_flush(struct B64Context *bctx, FILE *fp_out)
Save the bytes to the file.
static void b64_putc(struct B64Context *bctx, char c, FILE *fp_out)
Base64-encode one character.
Convenience wrapper for the send headers.
volatile sig_atomic_t SigInt
true after SIGINT is received
void mutt_sig_allow_interrupt(bool allow)
Allow/disallow Ctrl-C (SIGINT)
Cursor for the Base64 conversion.
struct Body * parts
parts of a multipart or message/rfc822
bool noconv
Don't do character set conversion.
char * charset
Send mode: charset of attached file as stored on disk.
struct ParameterList parameter
Parameters of the content-type.
struct Body * next
next attachment in the list
char * subtype
content-type subtype
unsigned int encoding
content-transfer-encoding, ContentEncoding
unsigned int type
content-type primary type, ContentType
char * filename
When sending a message, this is the file to which this structure refers.
A set of inherited config items.
Cursor for converting a file's encoding.