Handling of email attachments. More...
Go to the source code of this file.
Enumerations | |
enum | ViewAttachMode { MUTT_VA_REGULAR = 1 , MUTT_VA_MAILCAP , MUTT_VA_AS_TEXT , MUTT_VA_PAGER } |
Options for mutt_view_attachment() More... | |
enum | SaveAttach { MUTT_SAVE_NO_FLAGS = 0 , MUTT_SAVE_APPEND , MUTT_SAVE_OVERWRITE } |
Options for saving attachments. More... | |
Functions | |
int | mutt_attach_display_loop (struct ConfigSubset *sub, struct Menu *menu, int op, struct Email *e, struct AttachCtx *actx, bool recv) |
Event loop for the Attachment menu. | |
void | mutt_save_attachment_list (struct AttachCtx *actx, FILE *fp, bool tag, struct Body *b, struct Email *e, struct Menu *menu) |
Save a list of attachments. | |
void | mutt_pipe_attachment_list (struct AttachCtx *actx, FILE *fp, bool tag, struct Body *b, bool filter) |
Pipe a list of attachments to a command. | |
void | mutt_print_attachment_list (struct AttachCtx *actx, FILE *fp, bool tag, struct Body *b) |
Print a list of Attachments. | |
int | mutt_view_attachment (FILE *fp, struct Body *b, enum ViewAttachMode mode, struct Email *e, struct AttachCtx *actx, struct MuttWindow *win) |
View an attachment. | |
void | mutt_check_lookup_list (struct Body *b, char *type, size_t len) |
Update the mime type. | |
int | mutt_compose_attachment (struct Body *b) |
Create an attachment. | |
int | mutt_decode_save_attachment (FILE *fp, struct Body *b, const char *path, StateFlags flags, enum SaveAttach opt) |
Decode, then save an attachment. | |
bool | mutt_edit_attachment (struct Body *b) |
Edit an attachment. | |
int | mutt_get_tmp_attachment (struct Body *b) |
Get a temporary copy of an attachment. | |
int | mutt_pipe_attachment (FILE *fp, struct Body *b, const char *path, const char *outfile) |
Pipe an attachment to a command. | |
int | mutt_print_attachment (FILE *fp, struct Body *b) |
Print out an attachment. | |
int | mutt_save_attachment (FILE *fp, struct Body *b, const char *path, enum SaveAttach opt, struct Email *e) |
Save an attachment. | |
void | mutt_add_temp_attachment (const char *filename) |
Add file to list of temporary attachments. | |
void | mutt_temp_attachments_cleanup (void) |
Delete all temporary attachments. | |
Handling of email attachments.
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 mutt_attach.h.
enum ViewAttachMode |
Options for mutt_view_attachment()
Definition at line 42 of file mutt_attach.h.
enum SaveAttach |
Options for saving attachments.
Enumerator | |
---|---|
MUTT_SAVE_NO_FLAGS | No flags set. |
MUTT_SAVE_APPEND | Append to existing file. |
MUTT_SAVE_OVERWRITE | Overwrite existing file. |
Definition at line 56 of file mutt_attach.h.
int mutt_attach_display_loop | ( | struct ConfigSubset * | sub, |
struct Menu * | menu, | ||
int | op, | ||
struct Email * | e, | ||
struct AttachCtx * | actx, | ||
bool | recv | ||
) |
Event loop for the Attachment menu.
sub | Config Subset |
menu | Menu listing Attachments |
op | Operation, e.g. OP_ATTACHMENT_VIEW |
e | |
actx | Attachment context |
recv | true if these are received attachments (rather than in compose) |
num | Operation performed |
Definition at line 962 of file recvattach.c.
void mutt_save_attachment_list | ( | struct AttachCtx * | actx, |
FILE * | fp, | ||
bool | tag, | ||
struct Body * | b, | ||
struct Email * | e, | ||
struct Menu * | menu | ||
) |
Save a list of attachments.
actx | Attachment context |
fp | File handle for the attachment (OPTIONAL) |
tag | If true, only save the tagged attachments |
b | First Attachment |
e | |
menu | Menu listing attachments |
Definition at line 433 of file recvattach.c.
void mutt_pipe_attachment_list | ( | struct AttachCtx * | actx, |
FILE * | fp, | ||
bool | tag, | ||
struct Body * | b, | ||
bool | filter | ||
) |
Pipe a list of attachments to a command.
actx | Attachment context |
fp | File handle to the attachment (OPTIONAL) |
tag | If true, only save the tagged attachments |
b | First Attachment |
filter | Is this command a filter? |
Definition at line 725 of file recvattach.c.
Print a list of Attachments.
actx | Attachment context |
fp | File handle to the attachment (OPTIONAL) |
tag | Apply to all tagged Attachments |
b | First Attachment |
Definition at line 888 of file recvattach.c.
int mutt_view_attachment | ( | FILE * | fp, |
struct Body * | b, | ||
enum ViewAttachMode | mode, | ||
struct Email * | e, | ||
struct AttachCtx * | actx, | ||
struct MuttWindow * | win | ||
) |
View an attachment.
fp | Source file stream. Can be NULL |
b | The message body containing the attachment |
mode | How the attachment should be viewed, see ViewAttachMode |
e | Current Email. Can be NULL |
actx | Attachment context |
win | Window |
0 | The viewer is run and exited successfully |
-1 | Error |
num | Return value of mutt_do_pager() when it is used |
Display a message attachment using the viewer program configured in mailcap. If there is no mailcap entry for a file type, view the image as text. Viewer processes are opened and waited on synchronously so viewing an attachment this way will block the main neomutt process until the viewer process exits.
Definition at line 419 of file mutt_attach.c.
void mutt_check_lookup_list | ( | struct Body * | b, |
char * | type, | ||
size_t | len | ||
) |
Update the mime type.
b | Message attachment body |
type | Buffer with mime type of attachment in "type/subtype" format |
len | Buffer length |
Definition at line 343 of file mutt_attach.c.
int mutt_compose_attachment | ( | struct Body * | b | ) |
Create an attachment.
b | Body of email |
1 | Require full screen redraw |
0 | Otherwise |
Definition at line 120 of file mutt_attach.c.
int mutt_decode_save_attachment | ( | FILE * | fp, |
struct Body * | b, | ||
const char * | path, | ||
StateFlags | flags, | ||
enum SaveAttach | opt | ||
) |
Decode, then save an attachment.
fp | File to read from (OPTIONAL) |
b | Attachment |
path | Path to save the Attachment to |
flags | Flags, e.g. STATE_DISPLAY |
opt | Save option, see SaveAttach |
0 | Success |
-1 | Error |
Definition at line 1041 of file mutt_attach.c.
bool mutt_edit_attachment | ( | struct Body * | b | ) |
Edit an attachment.
b | Email containing attachment |
true | Editor found |
false | Editor not found |
Currently, this only works for send mode, as it assumes that the Body->filename actually contains the information. I'm not sure we want to deal with editing attachments we've already received, so this should be ok.
Returning 0 is useful to tell the calling menu to redraw
Definition at line 265 of file mutt_attach.c.
int mutt_get_tmp_attachment | ( | struct Body * | b | ) |
Get a temporary copy of an attachment.
b | Attachment to copy |
0 | Success |
-1 | Error |
Definition at line 72 of file mutt_attach.c.
int mutt_pipe_attachment | ( | FILE * | fp, |
struct Body * | b, | ||
const char * | path, | ||
const char * | outfile | ||
) |
Pipe an attachment to a command.
fp | File to pipe into the command |
b | Attachment |
path | Path to command |
outfile | File to save output to |
1 | Success |
0 | Error |
Definition at line 739 of file mutt_attach.c.
int mutt_print_attachment | ( | FILE * | fp, |
struct Body * | b | ||
) |
Print out an attachment.
fp | File to write to |
b | Attachment |
1 | Success |
0 | Error |
Ok, the difference between send and receive: recv: Body->filename is a suggested name, and Mailbox|Email points to the attachment in mailbox which is encoded send: Body->filename points to the un-encoded file which contains the attachment
Definition at line 1141 of file mutt_attach.c.
int mutt_save_attachment | ( | FILE * | fp, |
struct Body * | b, | ||
const char * | path, | ||
enum SaveAttach | opt, | ||
struct Email * | e | ||
) |
Save an attachment.
fp | Source file stream. Can be NULL |
b | Email Body |
path | Where to save the attachment |
opt | Save option, see SaveAttach |
e | Current Email. Can be NULL |
0 | Success |
-1 | Error |
Definition at line 907 of file mutt_attach.c.
void mutt_add_temp_attachment | ( | const char * | filename | ) |
Add file to list of temporary attachments.
filename | filename with full path |
Definition at line 1301 of file mutt_attach.c.
void mutt_temp_attachments_cleanup | ( | void | ) |
Delete all temporary attachments.
Definition at line 1309 of file mutt_attach.c.