1 /**
2  * @file
3  * RFC1524 Mailcap routines
4  *
5  * @authors
6  * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
7  *
8  * @copyright
9  * This program is free software: you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License as published by the Free Software
11  * Foundation, either version 2 of the License, or (at your option) any later
12  * version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  * details.
18  *
19  * You should have received a copy of the GNU General Public License along with
20  * this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef MUTT_MAILCAP_H
24 #define MUTT_MAILCAP_H
25 
26 #include <stddef.h>
27 #include <stdbool.h>
28 
29 struct Body;
30 struct Buffer;
31 
32 /**
33  * struct MailcapEntry - A mailcap entry
34  */
35 struct MailcapEntry
36 {
37   char *command;
38   char *testcommand;
39   char *composecommand;
40   char *composetypecommand;
41   char *editcommand;
42   char *printcommand;
43   char *nametemplate;
44   char *convert;
45   bool needsterminal : 1; ///< endwin() and system
46   bool copiousoutput : 1; ///< needs pager, basically
47   bool xneomuttkeep  : 1; ///< do not remove the file on command exit
48   bool xneomuttnowrap: 1; ///< do not wrap the output in the pager
49 };
50 
51 /**
52  * enum MailcapLookup - Mailcap actions
53  */
54 enum MailcapLookup
55 {
56   MUTT_MC_NO_FLAGS = 0, ///< No flags set
57   MUTT_MC_EDIT,         ///< Mailcap edit field
58   MUTT_MC_COMPOSE,      ///< Mailcap compose field
59   MUTT_MC_PRINT,        ///< Mailcap print field
60   MUTT_MC_AUTOVIEW,     ///< Mailcap autoview field
61 };
62 
63 void                 mailcap_entry_free(struct MailcapEntry **ptr);
64 struct MailcapEntry *mailcap_entry_new(void);
65 int                  mailcap_expand_command(struct Body *a, const char *filename, const char *type, struct Buffer *command);
66 void                 mailcap_expand_filename(const char *nametemplate, const char *oldfile, struct Buffer *newfile);
67 bool                 mailcap_lookup(struct Body *a, char *type, size_t typelen, struct MailcapEntry *entry, enum MailcapLookup opt);
68 
69 #endif /* MUTT_MAILCAP_H */
70