X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-mime%2Frfc1524.c;h=576f2122fdc19f43e108b1c4923d8fd3bfc28c56;hp=c2c8058b8325a0291ea89d59c8a5c8f6cc3be21c;hb=c8b8b9539aaf11b48c4c1e5baba434db09722111;hpb=49081299c673ceebc38d9a4f0985608cb3aecfce diff --git a/lib-mime/rfc1524.c b/lib-mime/rfc1524.c index c2c8058..576f212 100644 --- a/lib-mime/rfc1524.c +++ b/lib-mime/rfc1524.c @@ -35,24 +35,7 @@ * rfc1524. */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include +#include #include @@ -60,6 +43,43 @@ #include "mime.h" #include "attach.h" +void rfc1524_entry_wipe(rfc1524_entry *p) +{ + p_delete(&p->command); + p_delete(&p->testcommand); + p_delete(&p->composecommand); + p_delete(&p->composetypecommand); + p_delete(&p->editcommand); + p_delete(&p->printcommand); + p_delete(&p->nametemplate); + p_delete(&p->convert); +} + +/* returns 1 if Mutt can't display this type of data, 0 otherwise */ +int rfc1524_mailcap_isneeded(BODY * m) +{ + int tok; + + switch (m->type) { + case TYPEMULTIPART: + case TYPEMESSAGE: + return 0; + + case TYPEAPPLICATION: + return !(mutt_is_application_pgp(m) || mutt_is_application_smime(m)); + + case TYPETEXT: + tok = mime_which_token(m->subtype, -1); + if (tok == MIME_PLAIN + || tok == MIME_RFC822_HEADERS + || tok == MIME_ENRICHED) + return 0; + break; + } + + return 1; +} + /* The command semantics include the following: * %s is the filename that contains the mail body data * %t is the content type, like text/plain @@ -106,7 +126,7 @@ int rfc1524_expand_command(BODY *a, const char *filename, const char *mtype, param[z] = '\0'; m_strcpy(pval, sizeof(pval), - mutt_get_parameter(param, a->parameter)); + parameter_getval(a->parameter, param)); if (option(OPTMAILCAPSANITIZE)) mutt_sanitize_filename(pval, 0); @@ -417,9 +437,8 @@ int rfc1524_expand_filename (char *nametemplate, m_strcpy(newfile, nflen, oldfile); } else if (!oldfile) { - mutt_expand_fmt (newfile, nflen, nametemplate, "mutt"); - } - else { /* oldfile && nametemplate */ + m_snsubst(newfile, nflen, nametemplate, "mutt"); + } else { /* oldfile && nametemplate */ /* first, compare everything left from the "%s"