示例#1
0
文件: mu-msg.c 项目: bonega/mu
static const GSList*
get_str_list_field (MuMsg *self, MuMsgFieldId mfid)
{
	gboolean do_free;
	GSList *val;

	/* first we try the cache */
	if (mu_msg_cache_cached (self->_cache, mfid))
		return mu_msg_cache_str_list (self->_cache, mfid);

	/* if it's not in the cache but it is a value retrievable from
	 * the doc backend, use that */
	val = NULL;
	if (self->_doc && mu_msg_field_xapian_value (mfid))
		val = mu_msg_doc_get_str_list_field (self->_doc,
						     mfid, &do_free);
	else {
		/* if we don't have a file object yet, we need to
		 * create it from the file on disk */
		if (!self->_file)
			self->_file = get_msg_file (self);
		if (!self->_file && !(self->_file = get_msg_file (self)))
			return NULL;
		val = mu_msg_file_get_str_list_field (self->_file, mfid,
						      &do_free);
	}

	/* if we get a string that needs freeing, we tell the cache to
	 * mark the string as such, so it will be freed when the cache
	 * is freed (or when the value is overwritten) */
	return mu_msg_cache_set_str_list (self->_cache, mfid, val,
					  do_free);
}
示例#2
0
文件: mu-msg.c 项目: akonring/mu
static const GSList*
get_str_list_field (MuMsg *self, MuMsgFieldId mfid)
{
	GSList *val;

	val = NULL;

	if (self->_doc && mu_msg_field_xapian_value (mfid))
		val = mu_msg_doc_get_str_list_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_list_field (self->_file, mfid);
	}

	return free_later_lst (self, val);
}