m->encoding = saved_encoding;
if (saved_parts)
{
- mutt_free_header(&m->hdr);
+ mutt_header_free(&m->hdr);
m->parts = saved_parts;
m->hdr = saved_hdr;
}
{
/* Don't free twice (b->hdr->content = b->parts) */
b->hdr->content = NULL;
- mutt_free_header(&b->hdr);
+ mutt_header_free(&b->hdr);
}
if (b->parts)
if (fseek_last_message(f) == -1)
return 0;
- hdr = mutt_new_header();
+ hdr = mutt_header_new();
tmp_envelope = mutt_read_rfc822_header(f, hdr, 0, 0);
if (!(hdr->read || hdr->old))
result = 1;
mutt_env_free(&tmp_envelope);
- mutt_free_header(&hdr);
+ mutt_header_free(&hdr);
return result;
}
{
structure_changed = 1;
b->hdr->content = NULL;
- mutt_free_header(&b->hdr);
+ mutt_header_free(&b->hdr);
}
if (fp && !b->parts && (is_multipart(b) || mutt_is_message_type(b->type, b->subtype)))
struct Header *mutt_hcache_restore(const unsigned char *d)
{
int off = 0;
- struct Header *h = mutt_new_header();
+ struct Header *h = mutt_header_new();
bool convert = !CharsetIsUtf8;
/* skip validate */
* @param d Data retrieved using mutt_hcache_fetch or mutt_hcache_fetch_raw
* @retval Pointer to the restored header (cannot be NULL)
* @note The returned Header must be free'd by caller code with
- * mutt_free_header().
+ * mutt_header_free().
*/
struct Header *mutt_hcache_restore(const unsigned char *d);
label_ref_dec(ctx, hdr->env->x_label);
}
-void mutt_free_header(struct Header **h)
+void mutt_header_free(struct Header **h)
{
if (!h || !*h)
return;
FREE(h);
}
-struct Header *mutt_new_header(void)
+struct Header *mutt_header_new(void)
{
struct Header *h = mutt_mem_calloc(1, sizeof(struct Header));
#ifdef MIXMASTER
char *maildir_flags; /**< unknown maildir flags */
};
+void mutt_header_free(struct Header **h);
+struct Header *mutt_header_new(void);
+
int mbox_strict_cmp_headers(const struct Header *h1, const struct Header *h2);
-struct Header *mutt_new_header(void);
-void mutt_free_header(struct Header **h);
#endif /* _MUTT_HEADER_H */
continue;
}
- ctx->hdrs[idx] = mutt_new_header();
+ ctx->hdrs[idx] = mutt_header_new();
idata->max_msn = MAX(idata->max_msn, h.data->msn);
idata->msn_index[h.data->msn - 1] = ctx->hdrs[idx];
if (!STAILQ_EMPTY(&cc_list) || !STAILQ_EMPTY(&bcc_list))
{
- msg = mutt_new_header();
+ msg = mutt_header_new();
msg->env = mutt_env_new();
struct ListNode *np = NULL;
mutt_flushinp();
if (!msg)
- msg = mutt_new_header();
+ msg = mutt_header_new();
if (!msg->env)
msg->env = mutt_env_new();
/* Set up a "context" header with just enough information so that
* mutt_prepare_template() can parse the message in fin.
*/
- context_hdr = mutt_new_header();
+ context_hdr = mutt_header_new();
context_hdr->offset = 0;
context_hdr->content = mutt_body_new();
if (fstat(fileno(fin), &st) != 0)
{
mutt_error(_("Cannot parse message template: %s"), draft_file);
mutt_env_free(&opts_env);
- mutt_free_header(&context_hdr);
+ mutt_header_free(&context_hdr);
goto main_curses;
}
mutt_str_replace(&msg->env->subject, opts_env->subject);
mutt_env_free(&opts_env);
- mutt_free_header(&context_hdr);
+ mutt_header_free(&context_hdr);
}
/* Editing the include_file: pass it directly in.
* Note that SENDNOFREEHEADER is set above so it isn't unlinked.
mutt_file_fclose(&fout);
}
- mutt_free_header(&msg);
+ mutt_header_free(&msg);
}
/* !edit_infile && draft_file will leave the tempfile around */
if (ctx->msgcount == ctx->hdrmax)
mx_alloc_memory(ctx);
- ctx->hdrs[ctx->msgcount] = hdr = mutt_new_header();
+ ctx->hdrs[ctx->msgcount] = hdr = mutt_header_new();
hdr->offset = loc;
hdr->index = ctx->msgcount;
if (ctx->msgcount == ctx->hdrmax)
mx_alloc_memory(ctx);
- curhdr = ctx->hdrs[ctx->msgcount] = mutt_new_header();
+ curhdr = ctx->hdrs[ctx->msgcount] = mutt_header_new();
curhdr->received = t - mutt_date_local_tz(t);
curhdr->offset = loc;
curhdr->index = ctx->msgcount;
if (ctx->readonly)
{
for (i = 0; i < ctx->msgcount; i++)
- mutt_free_header(&(ctx->hdrs[i])); /* nothing to do! */
+ mutt_header_free(&(ctx->hdrs[i])); /* nothing to do! */
FREE(&ctx->hdrs);
}
else
{
/* free the old headers */
for (j = 0; j < old_msgcount; j++)
- mutt_free_header(&(old_hdrs[j]));
+ mutt_header_free(&(old_hdrs[j]));
FREE(&old_hdrs);
ctx->quiet = false;
mutt_set_flag(ctx, ctx->hdrs[i], MUTT_TAG, old_hdrs[j]->tagged);
/* we don't need this header any more */
- mutt_free_header(&(old_hdrs[j]));
+ mutt_header_free(&(old_hdrs[j]));
}
}
{
if (old_hdrs[j])
{
- mutt_free_header(&(old_hdrs[j]));
+ mutt_header_free(&(old_hdrs[j]));
msg_mod = true;
}
}
FREE(&(*md)->canon_fname);
if ((*md)->h)
- mutt_free_header(&(*md)->h);
+ mutt_header_free(&(*md)->h);
FREE(md);
}
struct stat st;
if (!h)
- h = mutt_new_header();
+ h = mutt_header_new();
h->env = mutt_read_rfc822_header(f, h, 0, 0);
fstat(fileno(f), &st);
/* FOO - really ignore the return value? */
mutt_debug(2, "queueing %s\n", de->d_name);
- h = mutt_new_header();
+ h = mutt_header_new();
h->old = is_old;
if (ctx->magic == MUTT_MAILDIR)
maildir_parse_flags(h, de->d_name);
struct Header *h = mutt_hcache_restore((unsigned char *) data);
h->old = p->h->old;
h->path = mutt_str_strdup(p->h->path);
- mutt_free_header(&p->h);
+ mutt_header_free(&p->h);
p->h = h;
if (ctx->magic == MUTT_MAILDIR)
maildir_parse_flags(p->h, fn);
#endif
}
else
- mutt_free_header(&p->h);
+ mutt_header_free(&p->h);
#ifdef USE_HCACHE
}
mutt_hcache_free(hc, &data);
ctx->hdrs[i]->trash = p->h->trash;
/* this is a duplicate of an existing header, so remove it */
- mutt_free_header(&p->h);
+ mutt_header_free(&p->h);
}
/* This message was not in the list of messages we just scanned.
* Check to see if we have enough information to know if the
if (maildir_update_flags(ctx, ctx->hdrs[i], p->h))
flags_changed = true;
- mutt_free_header(&p->h);
+ mutt_header_free(&p->h);
}
else /* message has disappeared */
occult = true;
}
if (init_header(h, newpath ? newpath : path, msg) != 0)
{
- mutt_free_header(&h);
+ mutt_header_free(&h);
mutt_debug(1, "nm: failed to append header!\n");
goto done;
}
alias = mutt_lookup_alias(s + 1);
if (alias)
{
- h = mutt_new_header();
+ h = mutt_header_new();
h->env = mutt_env_new();
h->env->from = h->env->to = alias;
mutt_default_save(p, sizeof(p), h);
h->env->from = h->env->to = NULL;
- mutt_free_header(&h);
+ mutt_header_free(&h);
/* Avoid infinite recursion if the resulting folder starts with '@' */
if (*p != '@')
recurse = true;
mutt_hash_destroy(&ctx->label_hash);
mutt_clear_threads(ctx);
for (int i = 0; i < ctx->msgcount; i++)
- mutt_free_header(&ctx->hdrs[i]);
+ mutt_header_free(&ctx->hdrs[i]);
FREE(&ctx->hdrs);
FREE(&ctx->v2r);
FREE(&ctx->path);
*/
if (ctx->last_tag == ctx->hdrs[i])
ctx->last_tag = NULL;
- mutt_free_header(&ctx->hdrs[i]);
+ mutt_header_free(&ctx->hdrs[i]);
}
}
ctx->msgcount = j;
mx_alloc_memory(ctx);
/* parse header */
- hdr = ctx->hdrs[ctx->msgcount] = mutt_new_header();
+ hdr = ctx->hdrs[ctx->msgcount] = mutt_header_new();
hdr->env = mutt_read_rfc822_header(fp, hdr, 0, 0);
hdr->env->newsgroups = mutt_str_strdup(nntp_data->group);
hdr->received = hdr->date_sent;
if (hdata)
{
mutt_debug(2, "mutt_hcache_fetch %s\n", buf);
- mutt_free_header(&hdr);
+ mutt_header_free(&hdr);
ctx->hdrs[ctx->msgcount] = hdr = mutt_hcache_restore(hdata);
mutt_hcache_free(fc->hc, &hdata);
hdr->data = 0;
nntp_data->last_loaded = anum;
}
else
- mutt_free_header(&hdr);
+ mutt_header_free(&hdr);
/* progress */
if (!ctx->quiet)
/* skip header marked as deleted in cache */
if (hdr->deleted && !restore)
{
- mutt_free_header(&hdr);
+ mutt_header_free(&hdr);
if (nntp_data->bcache)
{
mutt_debug(2, "#2 mutt_bcache_del %s\n", buf);
}
/* parse header */
- hdr = ctx->hdrs[ctx->msgcount] = mutt_new_header();
+ hdr = ctx->hdrs[ctx->msgcount] = mutt_header_new();
hdr->env = mutt_read_rfc822_header(fp, hdr, 0, 0);
hdr->received = hdr->date_sent;
mutt_file_fclose(&fp);
if (nntp_data->last_message < nntp_data->last_loaded)
{
for (int i = 0; i < ctx->msgcount; i++)
- mutt_free_header(&ctx->hdrs[i]);
+ mutt_header_free(&ctx->hdrs[i]);
ctx->msgcount = 0;
ctx->tagged = 0;
hdr->data = 0;
deleted = hdr->deleted;
flagged = hdr->flagged;
- mutt_free_header(&hdr);
+ mutt_header_free(&hdr);
/* header marked as deleted, removing from context */
if (deleted)
{
mutt_set_flag(ctx, ctx->hdrs[i], MUTT_TAG, 0);
- mutt_free_header(&ctx->hdrs[i]);
+ mutt_header_free(&ctx->hdrs[i]);
continue;
}
}
hdr->data = 0;
if (hdr->deleted)
{
- mutt_free_header(&hdr);
+ mutt_header_free(&hdr);
if (nntp_data->bcache)
{
mutt_debug(2, "mutt_bcache_del %s\n", buf);
/* parse header */
if (ctx->msgcount == ctx->hdrmax)
mx_alloc_memory(ctx);
- hdr = ctx->hdrs[ctx->msgcount] = mutt_new_header();
+ hdr = ctx->hdrs[ctx->msgcount] = mutt_header_new();
hdr->data = mutt_mem_calloc(1, sizeof(struct NntpHeaderData));
hdr->env = mutt_read_rfc822_header(fp, hdr, 0, 0);
mutt_file_fclose(&fp);
snprintf(buf, sizeof(buf), "STAT %s\r\n", msgid);
if (nntp_query(nntp_data, buf, sizeof(buf)) < 0)
{
- mutt_free_header(&hdr);
+ mutt_header_free(&hdr);
return -1;
}
sscanf(buf + 4, ANUM, &NHDR(hdr)->article_num);
{
struct Body *msg = NULL;
- parent->hdr = mutt_new_header();
+ parent->hdr = mutt_header_new();
parent->hdr->offset = ftello(fp);
parent->hdr->env = mutt_read_rfc822_header(fp, parent->hdr, 0, 0);
msg = parent->hdr->content;
mx_alloc_memory(ctx);
ctx->msgcount++;
- ctx->hdrs[i] = mutt_new_header();
+ ctx->hdrs[i] = mutt_header_new();
ctx->hdrs[i]->data = mutt_str_strdup(line);
}
else if (ctx->hdrs[i]->index != index - 1)
*/
struct Header *h = mutt_hcache_restore((unsigned char *) data);
mutt_hcache_free(hc, &data);
- mutt_free_header(&ctx->hdrs[i]);
+ mutt_header_free(&ctx->hdrs[i]);
ctx->hdrs[i] = h;
ctx->hdrs[i]->refno = refno;
ctx->hdrs[i]->index = index;
if (ret < 0)
{
for (int i = ctx->msgcount; i < new_count; i++)
- mutt_free_header(&ctx->hdrs[i]);
+ mutt_header_free(&ctx->hdrs[i]);
return ret;
}
}
/* fallthrough */
case OP_MAIL:
- msg = mutt_new_header();
+ msg = mutt_header_new();
msg->env = mutt_env_new();
if (!menu->tagprefix)
{
parent_fp = actx->root_fp;
}
- tmphdr = mutt_new_header();
+ tmphdr = mutt_header_new();
tmphdr->env = mutt_env_new();
mutt_make_forward_subject(tmphdr->env, Context, parent_hdr);
if (!tmpfp)
{
mutt_error(_("Can't open temporary file %s."), tmpbody);
- mutt_free_header(&tmphdr);
+ mutt_header_free(&tmphdr);
return;
}
mutt_file_unlink(tmpbody);
}
- mutt_free_header(&tmphdr);
+ mutt_header_free(&tmphdr);
}
/**
}
}
- tmphdr = mutt_new_header();
+ tmphdr = mutt_header_new();
tmphdr->env = mutt_env_new();
mutt_make_forward_subject(tmphdr->env, Context, curhdr);
if (!tmpfp)
{
mutt_error(_("Can't create %s."), tmpbody);
- mutt_free_header(&tmphdr);
+ mutt_header_free(&tmphdr);
return;
}
}
}
else
- mutt_free_header(&tmphdr);
+ mutt_header_free(&tmphdr);
ci_send_message(flags, tmphdr, *tmpbody ? tmpbody : NULL, NULL, curhdr);
}
else if (nattach == 1)
mime_reply_any = true;
- tmphdr = mutt_new_header();
+ tmphdr = mutt_header_new();
tmphdr->env = mutt_env_new();
if (attach_reply_envelope_defaults(
tmphdr->env, actx, parent_hdr ? parent_hdr : (cur ? cur->hdr : NULL), flags) == -1)
{
- mutt_free_header(&tmphdr);
+ mutt_header_free(&tmphdr);
return;
}
if (!tmpfp)
{
mutt_error(_("Can't create %s."), tmpbody);
- mutt_free_header(&tmphdr);
+ mutt_header_free(&tmphdr);
return;
}
if (mime_reply_any && !cur &&
copy_problematic_attachments(&tmphdr->content, actx, 0) == NULL)
{
- mutt_free_header(&tmphdr);
+ mutt_header_free(&tmphdr);
mutt_file_fclose(&tmpfp);
return;
}
int mutt_compose_to_sender(struct Header *hdr)
{
- struct Header *msg = mutt_new_header();
+ struct Header *msg = mutt_header_new();
msg->env = mutt_env_new();
if (!hdr)
int mutt_resend_message(FILE *fp, struct Context *ctx, struct Header *cur)
{
- struct Header *msg = mutt_new_header();
+ struct Header *msg = mutt_header_new();
if (mutt_prepare_template(fp, ctx, msg, cur, 1) < 0)
{
- mutt_free_header(&msg);
+ mutt_header_free(&msg);
return -1;
}
if (!msg)
{
- msg = mutt_new_header();
+ msg = mutt_header_new();
if (flags == SENDPOSTPONED)
{
mutt_file_fclose(&tempfp);
if (!(flags & SENDNOFREEHEADER))
- mutt_free_header(&msg);
+ mutt_header_free(&msg);
FREE(&finalpath);
return rc;
fflush(fp);
rewind(fp);
- body->hdr = mutt_new_header();
+ body->hdr = mutt_header_new();
body->hdr->offset = 0;
/* we don't need the user headers here */
body->hdr->env = mutt_read_rfc822_header(fp, body->hdr, 0, 0);