RFC1524 Mailcap routines. More...
#include <stdbool.h>
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | MailcapEntry |
A mailcap entry. More... | |
Enumerations | |
enum | MailcapLookup { MUTT_MC_NO_FLAGS = 0 , MUTT_MC_EDIT , MUTT_MC_COMPOSE , MUTT_MC_PRINT , MUTT_MC_AUTOVIEW } |
Mailcap actions. More... | |
Functions | |
void | mailcap_entry_free (struct MailcapEntry **ptr) |
Deallocate an struct MailcapEntry. | |
struct MailcapEntry * | mailcap_entry_new (void) |
Allocate memory for a new rfc1524 entry. | |
int | mailcap_expand_command (struct Body *b, const char *filename, const char *type, struct Buffer *command) |
Expand expandos in a command. | |
void | mailcap_expand_filename (const char *nametemplate, const char *oldfile, struct Buffer *newfile) |
Expand a new filename from a template or existing filename. | |
bool | mailcap_lookup (struct Body *b, char *type, size_t typelen, struct MailcapEntry *entry, enum MailcapLookup opt) |
Find given type in the list of mailcap files. | |
RFC1524 Mailcap routines.
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 mailcap.h.
enum MailcapLookup |
Mailcap actions.
Enumerator | |
---|---|
MUTT_MC_NO_FLAGS | No flags set. |
MUTT_MC_EDIT | Mailcap edit field. |
MUTT_MC_COMPOSE | Mailcap compose field. |
MUTT_MC_PRINT | Mailcap print field. |
MUTT_MC_AUTOVIEW | Mailcap autoview field. |
Definition at line 55 of file mailcap.h.
void mailcap_entry_free | ( | struct MailcapEntry ** | ptr | ) |
Deallocate an struct MailcapEntry.
[out] | ptr | MailcapEntry to deallocate |
Definition at line 454 of file mailcap.c.
struct MailcapEntry * mailcap_entry_new | ( | void | ) |
Allocate memory for a new rfc1524 entry.
ptr | An un-initialized struct MailcapEntry |
Definition at line 445 of file mailcap.c.
int mailcap_expand_command | ( | struct Body * | b, |
const char * | filename, | ||
const char * | type, | ||
struct Buffer * | command | ||
) |
Expand expandos in a command.
b | Email Body |
filename | File containing the email text |
type | Type, e.g. "text/plain" |
command | Buffer containing command |
The command semantics include the following: s is the filename that contains the mail body data t is the content type, like text/plain %{parameter} is replaced by the parameter value from the content-type field % is % Unsupported rfc1524 parameters: these would probably require some doing by neomutt, and can probably just be done by piping the message to metamail n is the integer number of sub-parts in the multipart F is "content-type filename" repeated for each sub-part
Definition at line 69 of file mailcap.c.
void mailcap_expand_filename | ( | const char * | nametemplate, |
const char * | oldfile, | ||
struct Buffer * | newfile | ||
) |
Expand a new filename from a template or existing filename.
nametemplate | Template |
oldfile | Original filename |
newfile | Buffer for new filename |
If there is no nametemplate, the stripped oldfile name is used as the template for newfile.
If there is no oldfile, the stripped nametemplate name is used as the template for newfile.
If both a nametemplate and oldfile are specified, the template is checked for a "%s". If none is found, the nametemplate is used as the template for newfile. The first path component of the nametemplate and oldfile are ignored.
Definition at line 552 of file mailcap.c.
bool mailcap_lookup | ( | struct Body * | b, |
char * | type, | ||
size_t | typelen, | ||
struct MailcapEntry * | entry, | ||
enum MailcapLookup | opt | ||
) |
Find given type in the list of mailcap files.
b | Message body |
type | Text type in "type/subtype" format |
typelen | Length of the type |
entry | struct MailcapEntry to populate with results |
opt | Type of mailcap entry to lookup, see MailcapLookup |
true | If *entry is not NULL it populates it with the mailcap entry |
false | No matching entry is found |
Find the given type in the list of mailcap files.
Definition at line 483 of file mailcap.c.