* please see the file GPL in the top level source directory.
*/
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <stdio.h>
-
-#include <lib-lib/mem.h>
-#include <lib-lib/str.h>
-#include <lib-lib/ascii.h>
-#include <lib-lib/macros.h>
-#include <lib-lib/buffer.h>
-#include <lib-lib/date.h>
-#include <lib-lib/url.h>
+#include <lib-lib/lib-lib.h>
#include "recvattach.h"
}
}
-static PARAMETER *parse_parameters(const char *s)
+static parameter_t *parse_parameters(const char *s)
{
- PARAMETER *res = NULL;
- PARAMETER **list = &res;
+ parameter_t *res = NULL;
+ parameter_t **list = &res;
while (*s) {
const char *p;
- PARAMETER *new;
+ parameter_t *new;
int i;
s = skipspaces(s);
/* Some pre-RFC1521 gateways still use the "name=filename" convention,
* but if a filename has already been set in the content-disposition,
* let that take precedence, and don't set it here */
- pc = mutt_get_parameter("name", ct->parameter);
+ pc = parameter_getval(ct->parameter, "name");
if (pc && !ct->filename)
ct->filename = m_strdup(pc);
}
/* Default character set for text types. */
if (ct->type == TYPETEXT) {
- pc = mutt_get_parameter("charset", ct->parameter);
+ pc = parameter_getval(ct->parameter, "charset");
if (!pc) {
- mutt_set_parameter("charset",
- option(OPTSTRICTMIME) ? "us-ascii" :
- mutt_get_first_charset(AssumedCharset),
- &ct->parameter);
+ parameter_setval(&ct->parameter, "charset",
+ option(OPTSTRICTMIME)
+ ? "us-ascii"
+ : charset_getfirst(AssumedCharset));
}
}
}
-static void parse_content_disposition(char *s, BODY *ct)
+static void parse_content_disposition(const char *s, BODY *ct)
{
if (!ascii_strncasecmp(s, "inline", 6)) {
ct->disposition = DISPINLINE;
/* Check to see if a default filename was given */
if ((s = strchr (s, ';'))) {
- PARAMETER *parms = parse_parameters(vskipspaces(s));
+ parameter_t *parms = parse_parameters(vskipspaces(s));
- if ((s = mutt_get_parameter("filename", parms)))
+ if ((s = parameter_getval(parms, "filename")))
m_strreplace(&ct->filename, s);
- if ((s = mutt_get_parameter ("name", parms)))
+ if ((s = parameter_getval(parms, "name")))
ct->form_name = m_strdup(s);
parameter_list_wipe(&parms);
*/
BODY *mutt_read_mime_header(FILE *fp, int digest)
{
- BODY *body = mutt_new_body ();
+ BODY *body = body_new();
char *line = p_new(char, LONG_STRING);
ssize_t linelen = LONG_STRING;
char *p;
switch (b->type) {
case TYPEMULTIPART:
- bound = mutt_get_parameter("boundary", b->parameter);
+ bound = parameter_getval(b->parameter, "boundary");
fseeko(fp, b->offset, SEEK_SET);
b->parts = mutt_parse_multipart(fp, bound, b->offset + b->length,
mime_which_token(b->subtype, -1) == MIME_DIGEST);
*/
if (new->offset > end_off) {
- mutt_free_body(&new);
+ body_list_wipe(&new);
break;
}
case MIME_LIST_POST:
/* RFC 2369. FIXME: We should ignore whitespace, but don't. */
- if (strncmp(p, "NO", 2)) {
+ if (m_strncmp(p, "NO", 2)) {
char *beg, *end;
for (beg = strchr (p, '<'); beg; beg = strchr (end, ',')) {
off_t loc;
if (hdr && !hdr->content) {
- hdr->content = mutt_new_body ();
+ hdr->content = body_new();
/* set the defaults from RFC1521 */
hdr->content->type = TYPETEXT;
break; /* end of header */
}
- if (mutt_match_spam_list(line, SpamList, buf, sizeof(buf))) {
- if (!rx_list_match(NoSpamList, line)) {
- /* if spam tag already exists, figure out how to amend it */
- if (e->spam && *buf) {
- if (SpamSep) {
- /* If SpamSep defined, append with separator */
- mutt_buffer_addstr(e->spam, SpamSep);
- mutt_buffer_addstr(e->spam, buf);
- } else {
- /* else overwrite */
- mutt_buffer_reset(e->spam);
- mutt_buffer_addstr(e->spam, buf);
- }
- }
- else if (!e->spam && *buf) {
- /* spam tag is new, and match expr is non-empty; copy */
- e->spam = mutt_buffer_from(NULL, buf);
- }
- else if (!e->spam) {
- /* match expr is empty; plug in null string if no existing tag */
- e->spam = mutt_buffer_from(NULL, "");
+ if (rx_list_match2(SpamList, line, buf, sizeof(buf))
+ && !rx_list_match(NoSpamList, line))
+ {
+ /* if spam tag already exists, figure out how to amend it */
+ if (e->spam && *buf) {
+ if (SpamSep) {
+ /* If SpamSep defined, append with separator */
+ mutt_buffer_addstr(e->spam, SpamSep);
+ mutt_buffer_addstr(e->spam, buf);
+ } else {
+ /* else overwrite */
+ mutt_buffer_reset(e->spam);
+ mutt_buffer_addstr(e->spam, buf);
}
}
+
+ if (!e->spam) {
+ e->spam = mutt_buffer_from(NULL, buf);
+ }
}
*p++ = '\0';