#include <stddef.h>
#include <iconv.h>
#include <stdbool.h>
Go to the source code of this file.
Decide how to display email content
- Authors
-
- Copyright
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file handler.h.
◆ mutt_body_handler()
int mutt_body_handler |
( |
struct Body * |
b, |
|
|
struct State * |
s |
|
) |
| |
Handler for the Body of an email.
- Parameters
-
- Return values
-
Definition at line 1595 of file handler.c.
1600 bool plaintext =
false;
1604 static unsigned short recurse_level = 0;
1606 int oflags = s->
flags;
1631 handler = encrypted_handler;
1671 mutt_error(
_(
"Error: multipart/signed has no protocol"));
1678 handler = encrypted_handler;
1683 handler = encrypted_handler;
1706 handler = encrypted_handler;
1711 handler = encrypted_handler;
1718 (plaintext || handler))
1738 char keystroke[128] = { 0 };
1745 mutt_buffer_printf(&msg,
_(
"[-- This is an attachment (use '%s' to view this part) --]\n"),
1752 mutt_buffer_printf(&msg,
_(
"[-- %s/%s is unsupported (use '%s' to view this part) --]\n"),
1761 "'view-attachments' bound to key) --]\n"));
1766 mutt_buffer_printf(&msg,
_(
"[-- %s/%s is unsupported (need 'view-attachments' bound to key) --]\n"),
◆ mutt_can_decode()
bool mutt_can_decode |
( |
struct Body * |
a | ) |
|
Will decoding the attachment produce any output.
- Parameters
-
- Return values
-
true | Decoding the attachment will produce output |
Definition at line 1805 of file handler.c.
◆ mutt_decode_attachment()
void mutt_decode_attachment |
( |
struct Body * |
b, |
|
|
struct State * |
s |
|
) |
| |
Decode an email's attachment.
- Parameters
-
b | Body of the email |
s | State of text being processed |
Definition at line 1845 of file handler.c.
1848 iconv_t cd = (iconv_t)(-1);
1852 const char *charset = b->
charset;
1892 if (cd != (iconv_t)(-1))
◆ mutt_decode_base64()
void mutt_decode_base64 |
( |
struct State * |
s, |
|
|
size_t |
len, |
|
|
bool |
istext, |
|
|
iconv_t |
cd |
|
) |
| |
Decode base64-encoded text.
- Parameters
-
s | State to work with |
len | Length of text to decode |
istext | Mime part is plain text |
cd | Iconv conversion descriptor |
Definition at line 1496 of file handler.c.
1511 for (i = 0; (i < 4) && (len > 0); len--)
1513 ch = fgetc(s->
fp_in);
1516 if ((ch >= 0) && (ch < 128) && ((
base64val(ch) != -1) || (ch ==
'=')))
1531 ch = (c1 << 2) | (c2 >> 4);
1533 if (cr && (ch !=
'\n'))
1538 if (istext && (ch ==
'\r'))
1547 ch = ((c2 & 0xf) << 4) | (c3 >> 2);
1549 if (cr && (ch !=
'\n'))
1554 if (istext && (ch ==
'\r'))
1563 ch = ((c3 & 0x3) << 6) | c4;
1565 if (cr && (ch !=
'\n'))
1570 if (istext && (ch ==
'\r'))
1575 if ((l + 8) >=
sizeof(bufi))
◆ C_HonorDisposition
Config: Don't display MIME parts inline if they have a disposition of 'attachment'.
Definition at line 65 of file handler.c.
◆ C_ImplicitAutoview
Config: Display MIME attachments inline if a 'copiousoutput' mailcap entry exists.
Definition at line 66 of file handler.c.
◆ C_IncludeEncrypted
Config: Whether to include encrypted content when replying.
Definition at line 67 of file handler.c.
◆ C_IncludeOnlyFirst
Config: Only include the first attachment when replying.
Definition at line 68 of file handler.c.
◆ C_PreferredLanguages
struct Slist* C_PreferredLanguages |
Config: Preferred languages for multilingual MIME.
Definition at line 69 of file handler.c.
◆ C_ReflowText
Config: Reformat paragraphs of 'format=flowed' text.
Definition at line 70 of file handler.c.
◆ C_ShowMultipartAlternative
char* C_ShowMultipartAlternative |
Config: How to display 'multipart/alternative' MIME parts.
Definition at line 71 of file handler.c.
static void decode_uuencoded(struct State *s, long len, bool istext, iconv_t cd)
Decode uuencoded text.
@ ENC_QUOTED_PRINTABLE
Quoted-printable text.
FILE * fp_in
File to read from.
@ ENC_UUENCODED
UUEncoded text.
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
#define MUTT_DISPLAY
Output is displayed to the user.
String manipulation buffer.
LOFF_T offset
offset where the actual data begins
SecurityFlags mutt_is_malformed_multipart_pgp_encrypted(struct Body *b)
Check for malformed layout.
struct Body * next
next attachment in the list
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
@ LL_DEBUG1
Log at debug level 1.
int mutt_is_valid_multipart_pgp_encrypted(struct Body *b)
Is this a valid multi-part encrypted message?
unsigned int disposition
content-disposition, ContentDisposition
void mutt_decode_base64(struct State *s, size_t len, bool istext, iconv_t cd)
Decode base64-encoded text.
int(* handler_t)(struct Body *b, struct State *s)
Manage a PGP or S/MIME encrypted MIME part.
unsigned int encoding
content-transfer-encoding, ContentEncoding
@ DISP_ATTACH
Content is attached.
char * mutt_ch_get_default_charset(void)
Get the default character set.
static void decode_quoted(struct State *s, long len, bool istext, iconv_t cd)
Decode an attachment encoded with quoted-printable.
char * subtype
content-type subtype
int text_enriched_handler(struct Body *a, struct State *s)
Handler for enriched text - Implements handler_t.
iconv_t mutt_ch_iconv_open(const char *tocode, const char *fromcode, uint8_t flags)
Set up iconv for conversions.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
#define MUTT_ICONV_HOOK_FROM
apply charset-hooks to fromcode
SecurityFlags mutt_is_application_pgp(struct Body *m)
Does the message use PGP?
bool C_ReflowText
Config: Reformat paragraphs of 'format=flowed' text.
bool mutt_can_decode(struct Body *a)
Will decoding the attachment produce any output.
static int malformed_pgp_encrypted_handler(struct Body *b, struct State *s)
Handler for invalid pgp-encrypted emails - Implements handler_t.
struct Keymap * km_find_func(enum MenuType menu, int func)
Find a function's mapping in a Menu.
#define MUTT_CHARCONV
Do character set conversions.
#define MUTT_VERIFY
Perform signature verification.
LOFF_T length
length (in bytes) of attachment
#define APPLICATION_PGP
Use PGP to encrypt/sign.
int mutt_signed_handler(struct Body *a, struct State *s)
Verify a "multipart/signed" body - Implements handler_t.
WHERE bool OptDontHandlePgpKeys
(pseudo) used to extract PGP keys
#define MUTT_FIRSTDONE
The first attachment has been done.
static int valid_pgp_encrypted_handler(struct Body *b, struct State *s)
Handler for valid pgp-encrypted emails - Implements handler_t.
int km_expand_key(char *s, size_t len, struct Keymap *map)
Get the key string bound to a Keymap.
#define MUTT_REPLYING
Are we replying?
bool mutt_is_message_type(int type, const char *subtype)
Determine if a mime type matches a message or not.
struct Body * parts
parts of a multipart or message/rfc822
@ TYPE_MESSAGE
Type: 'message/*'.
char * charset
Send mode: charset of attached file as stored on disk.
#define mutt_debug(LEVEL,...)
int state_printf(struct State *s, const char *fmt,...)
Write a formatted string to the State.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
static int message_handler(struct Body *a, struct State *s)
Handler for message/rfc822 body parts - Implements handler_t.
int crypt_pgp_application_handler(struct Body *m, struct State *s)
Wrapper for CryptModuleSpecs::application_handler()
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
static int multilingual_handler(struct Body *a, struct State *s)
Handler for multi-lingual emails - Implements handler_t.
@ TYPE_APPLICATION
Type: 'application/*'.
@ ENC_BASE64
Base-64 encoded text.
@ TYPE_TEXT
Type: 'text/*'.
static int run_decode_and_handler(struct Body *b, struct State *s, handler_t handler, bool plaintext)
Run an appropriate decoder for an email.
@ DISP_INLINE
Content is inline.
char * C_AssumedCharset
Config: If a message is missing a character set, assume this character set.
char * C_ShowMultipartAlternative
Config: How to display 'multipart/alternative' MIME parts.
unsigned int type
content-type primary type, ContentType
static int multipart_handler(struct Body *a, struct State *s)
Handler for multipart emails - Implements handler_t.
WHERE bool OptViewAttach
(pseudo) signals that we are viewing attachments
#define MUTT_MIME_MAX_DEPTH
bool C_IncludeEncrypted
Config: Whether to include encrypted content when replying.
#define state_set_prefix(state)
static int external_body_handler(struct Body *b, struct State *s)
Handler for external-body emails - Implements handler_t.
bool mutt_is_text_part(struct Body *b)
Is this part of an email in plain text?
int rfc3676_handler(struct Body *a, struct State *s)
Body handler implementing RFC3676 for format=flowed - Implements handler_t.
bool C_HonorDisposition
Config: Don't display MIME parts inline if they have a disposition of 'attachment'.
struct ParameterList parameter
parameters of the content-type
StateFlags flags
Flags, e.g. MUTT_DISPLAY.
char * C_Charset
Config: Default character set for displaying text on screen.
@ TYPE_MULTIPART
Type: 'multipart/*'.
static void decode_xbit(struct State *s, long len, bool istext, iconv_t cd)
Decode xbit-encoded text.
static int autoview_handler(struct Body *a, struct State *s)
Handler for autoviewable attachments - Implements handler_t.
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
static bool is_autoview(struct Body *b)
Should email body be filtered by mailcap.
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
#define state_reset_prefix(state)
static int alternative_handler(struct Body *a, struct State *s)
Handler for multipart alternative emails - Implements handler_t.
static int text_plain_handler(struct Body *b, struct State *s)
Handler for plain text - Implements handler_t.
@ MENU_PAGER
Pager pager (email viewer)
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
static void convert_to_state(iconv_t cd, char *bufi, size_t *l, struct State *s)
Convert text and write it to a file.
@ LL_DEBUG2
Log at debug level 2.
SecurityFlags mutt_is_application_smime(struct Body *m)
Does the message use S/MIME?
int crypt_smime_application_handler(struct Body *m, struct State *s)
Wrapper for CryptModuleSpecs::application_handler()
void state_mark_attach(struct State *s)
Write a unique marker around content.