58 char encoded[11] = { 0 };
74 for (
size_t i = 0; i < rc; i++)
76 fputc(encoded[i], fp_out);
115 if (istext && (ch ==
'\n') && (ch1 !=
'\r'))
153 char line[77], savechar;
158 if ((
linelen == 76) && ((istext && (c !=
'\n')) || !istext))
167 fputs(
"=\n", fp_out);
197 else if ((
linelen == 1) && (line[0] ==
'.'))
203 if ((c ==
'\n') && istext)
210 sprintf(line +
linelen - 1,
"=%2.2X", (
unsigned char) line[
linelen - 1]);
215 int savechar2 = line[
linelen - 1];
220 fprintf(fp_out,
"\n=%2.2X", (
unsigned char) savechar2);
231 else if ((c != 9) && ((c < 32) || (c > 126) || (c ==
'=')))
243 sprintf(line +
linelen,
"=%2.2X", (
unsigned char) c);
262 sprintf(line +
linelen - 1,
"=%2.2X", (
unsigned char) line[
linelen - 1]);
271 snprintf(line,
sizeof(line),
"=%2.2X", (
unsigned char) savechar);
313 mutt_error(
_(
"No boundary parameter found [report this error]"));
316 char boundary[128] = { 0 };
321 fprintf(
fp,
"\n--%s\n", boundary);
328 fprintf(
fp,
"\n--%s--\n", boundary);
329 return ferror(
fp) ? -1 : 0;
336 fputs(
"Version: 1\n",
fp);
350 char send_charset[128] = { 0 };
379 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(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.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
SIG_ATOMIC_VOLATILE_T SigInt
true after SIGINT is received
#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(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 *a, 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.
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.