Ejemplo n.º 1
0
static int init_header(HEADER *h, const char *path, notmuch_message_t *msg)
{
    const char *id;

    if (h->data)
        return 0;

    id = notmuch_message_get_message_id(msg);

    h->data = safe_calloc(1, sizeof(struct nm_hdrdata));
    h->free_cb = deinit_header;

    /*
     * Notmuch ensures that message Id exists (if not notmuch Notmuch will
     * generate an ID), so it's more safe than use mutt HEADER->env->id
     */
    ((struct nm_hdrdata *) h->data)->virtual_id = safe_strdup( id );

    dprint(2, (debugfile, "nm: initialize header data: [hdr=%p, data=%p] (%s)\n",
               h, h->data, id));

    if (!h->env->message_id)
        h->env->message_id = nm2mutt_message_id( id );

    if (update_message_path(h, path))
        return -1;

    update_header_tags(h, msg);

    return 0;
}
Ejemplo n.º 2
0
static int init_header(HEADER *h, const char *path, notmuch_message_t *msg)
{
	if (h->data)
		return 0;

	h->data = safe_calloc(1, sizeof(struct nm_hdrdata));
	h->free_cb = deinit_header;

	dprint(2, (debugfile, "nm: initialize header data: [hdr=%p, data=%p] (%s)\n",
				h, h->data, h->env->message_id));

	if (update_message_path(h, path))
		return -1;

	update_header_tags(h, msg);
	return 0;
}