Beispiel #1
0
void
mu_msg_close_file_backend (MuMsg *msg)
{
	g_return_if_fail (msg);

	mu_msg_file_destroy (msg->_file);
	msg->_file = NULL;
}
Beispiel #2
0
void
mu_msg_unload_msg_file (MuMsg *msg)
{
	g_return_if_fail (msg);

	mu_msg_file_destroy (msg->_file);
	msg->_file = NULL;
}
Beispiel #3
0
static void
mu_msg_destroy (MuMsg *self)
{
	if (!self)
		return;

	mu_msg_file_destroy (self->_file);
	mu_msg_doc_destroy  (self->_doc);

	mu_msg_cache_destroy (self->_cache);

	g_slice_free (MuMsg, self);
}
Beispiel #4
0
static void
mu_msg_destroy (MuMsg *self)
{
	if (!self)
		return;

	mu_msg_file_destroy (self->_file);
	mu_msg_doc_destroy  (self->_doc);

	{ /* cleanup the strings / lists we stored */
	 	mu_str_free_list (self->_free_later_str);
		g_slist_foreach (self->_free_later_lst,
				 (GFunc)mu_str_free_list, NULL);
		g_slist_free (self->_free_later_lst);
	}

	g_slice_free (MuMsg, self);
}
Beispiel #5
0
/*
 * move a msg to another maildir, trying to maintain 'integrity',
 * ie. msg in 'new/' will go to new/, one in cur/ goes to cur/. be
 * super-paranoid here...
 */
gboolean
mu_msg_move_to_maildir (MuMsg *self, const char *maildir,
			MuFlags flags, gboolean ignore_dups, gboolean new_name,
			GError **err)
{
	char *newfullpath;
	char *targetmdir;

	g_return_val_if_fail (self, FALSE);
	g_return_val_if_fail (maildir, FALSE);     /* i.e. "/inbox" */

	/* targetmdir is the full path to maildir, i.e.,
	 * /home/foo/Maildir/inbox */
	targetmdir = get_target_mdir (self, maildir, err);
	if (!targetmdir)
		return FALSE;

	newfullpath = mu_maildir_move_message (mu_msg_get_path (self),
					       targetmdir, flags,
					       ignore_dups, new_name, err);
	/* update the message path and the flags; they may have
	 * changed */
	if (!newfullpath) {
		g_free (targetmdir);
		return FALSE;
	}

	/* clear the old backends */
	mu_msg_doc_destroy  (self->_doc);
	self->_doc = NULL;

	mu_msg_file_destroy (self->_file);

	/* and create a new one */
	self->_file = mu_msg_file_new (newfullpath, maildir, err);
	g_free (targetmdir);

	return self->_file ? TRUE : FALSE;
}