* some mu_store_store => mu_store_store_msg and the consequences

This commit is contained in:
Dirk-Jan C. Binnema 2011-08-03 23:03:22 +03:00
parent 82be4974b7
commit d291c5a9f5
5 changed files with 18 additions and 18 deletions

View File

@ -150,7 +150,7 @@ insert_or_update_maybe (const char* fullpath, const char* mdir,
}
/* we got a valid id; scan the message contents as well */
if (G_UNLIKELY((mu_store_store (data->_store, msg, TRUE) != MU_OK))) {
if (G_UNLIKELY((!mu_store_store_msg (data->_store, msg, TRUE)))) {
g_warning ("%s: storing content %s failed", __FUNCTION__,
fullpath);
return MU_ERROR;
@ -426,7 +426,7 @@ foreach_doc_cb (const char* path, CleanupData *cudata)
if (access (path, R_OK) != 0) {
if (errno != EACCES)
g_debug ("cannot access %s: %s", path, strerror(errno));
if (!mu_store_remove (cudata->_store, path))
if (!mu_store_remove_path (cudata->_store, path))
return MU_ERROR; /* something went wrong... bail out */
if (cudata->_stats)
++cudata->_stats->_cleaned_up;

View File

@ -246,8 +246,8 @@ process_file (const char* fullpath, const gchar* mdir,
if (result == MU_STOP)
g_debug ("callback said 'MU_STOP' for %s", fullpath);
else if (result == MU_ERROR)
g_warning ("%s: failed %d in callback (%s)",
__FUNCTION__, result, fullpath);
g_warning ("%s: error in callback (%s)",
__FUNCTION__, fullpath);
return result;
}

View File

@ -623,7 +623,7 @@ get_message_uid (MuMsg *msg)
}
gboolean
mu_store_store (MuStore *store, MuMsg *msg, gboolean replace)
mu_store_store_msg (MuStore *store, MuMsg *msg, gboolean replace)
{
g_return_val_if_fail (store, FALSE);
g_return_val_if_fail (msg, FALSE);
@ -693,7 +693,7 @@ mu_store_store_path (MuStore *store, const char *path)
return FALSE;
}
rv = mu_store_store (store, msg, TRUE);
rv = mu_store_store_msg (store, msg, TRUE);
if (!rv)
g_warning ("failed to store %s", path);
@ -704,7 +704,7 @@ mu_store_store_path (MuStore *store, const char *path)
gboolean
mu_store_remove (MuStore *store, const char *msgpath)
mu_store_remove_path (MuStore *store, const char *msgpath)
{
g_return_val_if_fail (store, FALSE);
g_return_val_if_fail (msgpath, FALSE);

View File

@ -109,7 +109,7 @@ void mu_store_flush (MuStore *store);
*
* @return TRUE if it succeeded, FALSE otherwise
*/
gboolean mu_store_store (MuStore *store, MuMsg *msg, gboolean replace);
gboolean mu_store_store_msg (MuStore *store, MuMsg *msg, gboolean replace);
/**
@ -133,7 +133,7 @@ gboolean mu_store_store_path (MuStore *store, const char *path);
*
* @return TRUE if it succeeded, FALSE otherwise
*/
gboolean mu_store_remove (MuStore *store, const char* msgpath);
gboolean mu_store_remove_path (MuStore *store, const char* msgpath);
/**

View File

@ -80,7 +80,7 @@ test_mu_store_version (void)
static void
test_mu_store_store_and_count (void)
test_mu_store_store_msg_and_count (void)
{
MuMsg *msg;
MuStore *store;
@ -97,7 +97,7 @@ test_mu_store_store_and_count (void)
/* add one */
msg = mu_msg_new_from_file (MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,", NULL, NULL);
g_assert (msg);
g_assert_cmpuint (mu_store_store (store, msg, TRUE), ==, MU_OK);
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, TRUE);
g_assert_cmpuint (1,==,mu_store_count (store));
g_assert_cmpuint (TRUE,==,mu_store_contains_message
(store, MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,"));
@ -106,7 +106,7 @@ test_mu_store_store_and_count (void)
/* add another one */
msg = mu_msg_new_from_file (MU_TESTMAILDIR2 "bar/cur/mail3", NULL, NULL);
g_assert (msg);
g_assert_cmpuint (mu_store_store (store, msg, TRUE), ==, MU_OK);
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, TRUE);
g_assert_cmpuint (2,==,mu_store_count (store));
g_assert_cmpuint (TRUE,==,mu_store_contains_message (store, MU_TESTMAILDIR2 "bar/cur/mail3"));
mu_msg_unref (msg);
@ -114,7 +114,7 @@ test_mu_store_store_and_count (void)
/* try to add the first one again. count should be 2 still */
msg = mu_msg_new_from_file (MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,", NULL, NULL);
g_assert (msg);
g_assert_cmpuint (mu_store_store (store, msg, TRUE), ==, MU_OK);
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, TRUE);
g_assert_cmpuint (2,==,mu_store_count (store));
mu_msg_unref (msg);
@ -124,7 +124,7 @@ test_mu_store_store_and_count (void)
static void
test_mu_store_store_remove_and_count (void)
test_mu_store_store_msg_remove_and_count (void)
{
MuMsg *msg;
MuStore *store;
@ -144,12 +144,12 @@ test_mu_store_store_remove_and_count (void)
msg = mu_msg_new_from_file (MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,",
NULL, &err);
g_assert (msg);
g_assert_cmpuint (mu_store_store (store, msg, TRUE), ==, MU_OK);
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, MU_OK);
g_assert_cmpuint (1,==,mu_store_count (store));
mu_msg_unref (msg);
/* remove one */
mu_store_remove (store, MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,");
mu_store_remove_path (store, MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,");
g_assert_cmpuint (0,==,mu_store_count (store));
g_assert_cmpuint (FALSE,==,mu_store_contains_message
(store, MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,"));
@ -169,9 +169,9 @@ main (int argc, char *argv[])
g_test_add_func ("/mu-store/mu-store-version",
test_mu_store_version);
g_test_add_func ("/mu-store/mu-store-store-and-count",
test_mu_store_store_and_count);
test_mu_store_store_msg_and_count);
g_test_add_func ("/mu-store/mu-store-store-remove-and-count",
test_mu_store_store_remove_and_count);
test_mu_store_store_msg_remove_and_count);
g_log_set_handler (NULL,
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
(GLogFunc)black_hole, NULL);