Beispiel #1
0
/* use this instead of mu_msg_get_path so we don't get into infinite
 * regress...*/
static const char*
get_path (MuMsg *self)
{
	char *val;
	gboolean do_free;

	do_free = TRUE;
	val     = NULL;

	if (self->_doc)
		val = mu_msg_doc_get_str_field
			(self->_doc, MU_MSG_FIELD_ID_PATH);

	/* not in the cache yet? try to get it from the file backend,
	 * in case we are using that */
	if (!val && self->_file)
		val = mu_msg_file_get_str_field
			(self->_file, MU_MSG_FIELD_ID_PATH, &do_free);

	/* shouldn't happen */
	if (!val)
		g_warning ("%s: cannot find path", __func__);

	return free_later_str (self, val);
}
Beispiel #2
0
Datei: mu-msg.c Projekt: nd/mu
static const char*
get_str_field (MuMsg *self, MuMsgFieldId mfid)
{
	char *val;
	gboolean do_free;

	do_free = TRUE;
	val     = NULL;

	if (self->_doc && mu_msg_field_xapian_value (mfid))
		val = mu_msg_doc_get_str_field (self->_doc, mfid);

	else if (mu_msg_field_gmime (mfid)) {
		/* if we don't have a file object yet, we need to
		 * create it from the file on disk */
		if (!mu_msg_load_msg_file (self, NULL))
			return NULL;
		val = mu_msg_file_get_str_field (self->_file, mfid, &do_free);
	} else {
		g_warning ("%s: cannot retrieve field", __FUNCTION__);
		val = NULL;
	}

	return do_free ? free_later_str (self, val) : val;
}
Beispiel #3
0
const char*
mu_msg_get_header (MuMsg *self, const char *header)
{
	g_return_val_if_fail (self, NULL);
	g_return_val_if_fail (header, NULL);

	/* if we don't have a file object yet, we need to
	 * create it from the file on disk */
	if (!mu_msg_load_msg_file (self, NULL))
		return NULL;

	return free_later_str
		(self, mu_msg_file_get_header (self->_file, header));
}
Beispiel #4
0
const char*
mu_msg_get_body_text (MuMsg *self, MuMsgOptions opts)
{
	g_return_val_if_fail (self, NULL);
	return free_later_str (self, get_body (self, opts, FALSE));
}