static void *
worker(void *d)
{
	int i;
	CamelException *ex = camel_exception_new();
	CamelStore *store;
	CamelFolder *folder;

	for (i=0;i<MAX_LOOP;i++) {
		store = camel_session_get_store(session, path, ex);
		camel_exception_clear(ex);
		folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
		camel_exception_clear(ex);
		if (testid == 0) {
			camel_object_unref(folder);
			camel_object_unref(store);
		} else {
			camel_object_unref(store);
			camel_object_unref(folder);
		}
	}

	camel_exception_free(ex);

	return NULL;
}
Example #2
0
CamelFolder *
mail_tool_get_inbox (const gchar *url, CamelException *ex)
{
	CamelStore *store;
	CamelFolder *folder;

	store = camel_session_get_store (session, url, ex);
	if (!store)
		return NULL;

	folder = camel_store_get_inbox (store, ex);
	camel_object_unref (store);

	return folder;
}
Example #3
0
CamelFolder *
mail_tool_get_trash (const gchar *url, int connect, CamelException *ex)
{
	CamelStore *store;
	CamelFolder *trash;

	if (connect)
		store = camel_session_get_store (session, url, ex);
	else
		store = (CamelStore *) camel_session_get_service (session, url, CAMEL_PROVIDER_STORE, ex);

	if (!store)
		return NULL;

	if (connect || ((CamelService *) store)->status == CAMEL_SERVICE_CONNECTED)
		trash = camel_store_get_trash (store, ex);
	else
		trash = NULL;

	camel_object_unref (store);

	return trash;
}
Example #4
0
/* this should probably take a folder instead of a session ... */
void
test_folder_message_ops (CamelSession *session, const gchar *name, gint local, const gchar *mailbox)
{
	CamelStore *store;
	CamelFolder *folder;
	CamelMimeMessage *msg;
	gint j;
	gint indexed, max;
	GPtrArray *uids;
	CamelMessageInfo *info;
	GError *error = NULL;

	max=local?2:1;

	for (indexed = 0;indexed<max;indexed++) {
		gchar *what = g_strdup_printf ("folder ops: %s %s", name, local?(indexed?"indexed":"non-indexed"):"");
		gint flags;

		camel_test_start (what);
		test_free (what);

		push ("getting store");
		store = camel_session_get_store (session, name, &error);
		check_msg (error == NULL, "getting store: %s", error->message);
		check (store != NULL);
		g_clear_error (&error);
		pull ();

		push ("creating %sindexed folder", indexed?"":"non-");
		if (indexed)
			flags = CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX;
		else
			flags = CAMEL_STORE_FOLDER_CREATE;
		folder = camel_store_get_folder_sync (
			store, mailbox, flags, NULL, &error);

		/* we can't create mailbox outside of namespace, since we have no api for it, try
		   using inbox namespace, works for courier */
		if (folder == NULL) {
			gchar *mbox = g_strdup_printf ("INBOX/%s", mailbox);
			mailbox = mbox;
			g_clear_error (&error);
			folder = camel_store_get_folder_sync (
				store, mailbox, flags, NULL, &error);
		}

		check_msg (error == NULL, "%s", error->message);
		check (folder != NULL);

		/* verify empty/can't get nonexistant stuff */
		test_folder_counts (folder, 0, 0);
		test_folder_not_message (folder, "0");
		test_folder_not_message (folder, "");

		for (j=0;j<10;j++) {
			gchar *content, *subject;

			push ("creating test message");
			msg = test_message_create_simple ();
			content = g_strdup_printf ("Test message %d contents\n\n", j);
			test_message_set_content_simple ((CamelMimePart *)msg, 0, "text/plain",
							content, strlen (content));
			test_free (content);
			subject = g_strdup_printf ("Test message %d", j);
			camel_mime_message_set_subject (msg, subject);
			pull ();

			push ("appending simple message %d", j);
			camel_folder_append_message_sync (
				folder, msg, NULL, NULL, NULL, &error);
			check_msg (error == NULL, "%s", error->message);

#if 0
			/* sigh, this shouldn't be required, but the imap code is too dumb to do it itself */
			if (!local) {
				push ("forcing a refresh of folder updates");
				camel_folder_refresh_info (folder, ex);
				check_msg (error == NULL, "%s", error->message);
				pull ();
			}
#endif
			/*if (!local)
			  camel_test_nonfatal ("unread counts dont seem right for imap");*/

			test_folder_counts (folder, j+1, j+1);

			/*if (!local)
			  camel_test_fatal ();*/

			push ("checking it is in the right uid slot & exists");
			uids = camel_folder_get_uids (folder);
			check (uids != NULL);
			check (uids->len == j+1);
			if (uids->len > j)
				test_folder_message (folder, uids->pdata[j]);
			pull ();

			push ("checking it is the right message (subject): %s", subject);
			if (uids->len > j) {
				info = camel_folder_get_message_info (folder, uids->pdata[j]);
				check (info != NULL);
				check_msg (strcmp (camel_message_info_subject (info), subject)==0,
					  "info->subject %s", camel_message_info_subject (info));
				camel_folder_free_message_info (folder, info);
			}
			camel_folder_free_uids (folder, uids);
			pull ();

			test_free (subject);

			/*if (!local)
			  camel_test_fatal ();*/

			check_unref (msg, 1);
			pull ();
		}

		if (local)
			check_unref (folder, 1);
		else
			check_unref (folder, 2);
		pull ();

#if 0
		push ("deleting test folder, with messages in it");
		camel_store_delete_folder (store, mailbox, ex);
		check (camel_exception_is_set (ex));
		camel_exception_clear (ex);
		pull ();
#endif

		push ("re-opening folder");
		folder = camel_store_get_folder_sync (
			store, mailbox, flags, NULL, &error);
		check_msg (error == NULL, "%s", error->message);
		check (folder != NULL);
		g_clear_error (&error);

			/* verify counts */
		test_folder_counts (folder, 10, 10);

		/* re-check uid's, after a reload */
		uids = camel_folder_get_uids (folder);
		check (uids != NULL);
		check (uids->len == 10);
		for (j=0;j<10;j++) {
			gchar *subject = g_strdup_printf ("Test message %d", j);

			push ("verify reload of %s", subject);
			test_folder_message (folder, uids->pdata[j]);

			info = camel_folder_get_message_info (folder, uids->pdata[j]);
			check_msg (strcmp (camel_message_info_subject (info), subject)==0,
				  "info->subject %s", camel_message_info_subject (info));
			test_free (subject);
			camel_folder_free_message_info (folder, info);
			pull ();
		}

		push ("deleting first message & expunging");
		camel_folder_delete_message (folder, uids->pdata[0]);
		test_folder_counts (folder, 10, 9);
		camel_folder_expunge_sync (folder, NULL, &error);
		check_msg (error == NULL, "%s", error->message);
		g_clear_error (&error);
		test_folder_not_message (folder, uids->pdata[0]);
		test_folder_counts (folder, 9, 9);

		camel_folder_free_uids (folder, uids);

		uids = camel_folder_get_uids (folder);
		check (uids != NULL);
		check (uids->len == 9);
		for (j=0;j<9;j++) {
			gchar *subject = g_strdup_printf ("Test message %d", j+1);

			push ("verify after expunge of %s", subject);
			test_folder_message (folder, uids->pdata[j]);

			info = camel_folder_get_message_info (folder, uids->pdata[j]);
			check_msg (strcmp (camel_message_info_subject (info), subject)==0,
				  "info->subject %s", camel_message_info_subject (info));
			test_free (subject);
			camel_folder_free_message_info (folder, info);
			pull ();
		}
		pull ();

		push ("deleting last message & expunging");
		camel_folder_delete_message (folder, uids->pdata[8]);
		/* sync? */
		test_folder_counts (folder, 9, 8);
		camel_folder_expunge_sync (folder, NULL, &error);
		check_msg (error == NULL, "%s", error->message);
		g_clear_error (&error);
		test_folder_not_message (folder, uids->pdata[8]);
		test_folder_counts (folder, 8, 8);

		camel_folder_free_uids (folder, uids);

		uids = camel_folder_get_uids (folder);
		check (uids != NULL);
		check (uids->len == 8);
		for (j=0;j<8;j++) {
			gchar *subject = g_strdup_printf ("Test message %d", j+1);

			push ("verify after expunge of %s", subject);
			test_folder_message (folder, uids->pdata[j]);

			info = camel_folder_get_message_info (folder, uids->pdata[j]);
			check_msg (strcmp (camel_message_info_subject (info), subject)==0,
				  "info->subject %s", camel_message_info_subject (info));
			test_free (subject);
			camel_folder_free_message_info (folder, info);
			pull ();
		}
		pull ();

		push ("deleting all messages & expunging");
		for (j=0;j<8;j++) {
			camel_folder_delete_message (folder, uids->pdata[j]);
		}
		/* sync? */
		test_folder_counts (folder, 8, 0);
		camel_folder_expunge_sync (folder, NULL, &error);
		check_msg (error == NULL, "%s", error->message);
		g_clear_error (&error);
		for (j=0;j<8;j++) {
			test_folder_not_message (folder, uids->pdata[j]);
		}
		test_folder_counts (folder, 0, 0);

		camel_folder_free_uids (folder, uids);
		pull ();

		if (local)
			check_unref (folder, 1);
		else
			check_unref (folder, 2);
		pull (); /* re-opening folder */

		if (g_ascii_strcasecmp (mailbox, "INBOX") != 0) {
			push ("deleting test folder, with no messages in it");
			camel_store_delete_folder_sync (
				store, mailbox, NULL, &error);
			check_msg (error == NULL, "%s", error->message);
			g_clear_error (&error);
			pull ();
		}

		if (!local) {
			push ("disconneect service");
			camel_service_disconnect_sync (
				CAMEL_SERVICE (store), TRUE, &error);
			check_msg (error == NULL, "%s", error->message);
			g_clear_error (&error);
			pull ();
		}

		check_unref (store, 1);
		camel_test_end ();
	}
}
Example #5
0
/* TODO: Add subscription stuff */
void
test_folder_basic (CamelSession *session, const gchar *storename, gint local, gint spool)
{
	CamelStore *store;
	CamelFolder *folder;
	gchar *what = g_strdup_printf ("testing store: %s", storename);
	GError *error = NULL;

	camel_test_start (what);
	test_free (what);

	push ("getting store");
	store = camel_session_get_store (session, storename, &error);
	check_msg (error == NULL, "getting store: %s", error->message);
	check (store != NULL);
	g_clear_error (&error);
	pull ();

	/* local providers == no inbox */
	push ("getting inbox folder");
	folder = camel_store_get_inbox_folder_sync (store, NULL, &error);
	if (local) {
		/* Well, maildir can have an inbox */
		if (folder) {
			check (error == NULL);
			check_unref (folder, 1);
		} else {
			check (error != NULL);
		}
	} else {
		check_msg (error == NULL, "%s", error->message);
		check (folder != NULL);
		check_unref (folder, 2);
	}
	g_clear_error (&error);
	pull ();

	push ("getting a non-existant folder, no create");
	folder = camel_store_get_folder_sync (
		store, "unknown", 0, NULL, &error);
	check (error != NULL);
	check (folder == NULL);
	g_clear_error (&error);
	pull ();

	if (!spool) {
		push ("getting a non-existant folder, with create");
		folder = camel_store_get_folder_sync (
			store, "testbox", CAMEL_STORE_FOLDER_CREATE,
			NULL, &error);
		check_msg (error == NULL, "%s", error->message);
		check (folder != NULL);
		if (local)
			check_unref (folder, 1);
		else
			check_unref (folder, 2);
		g_clear_error (&error);
		pull ();

		push ("getting an existing folder");
		folder = camel_store_get_folder_sync (
			store, "testbox", 0, NULL, &error);
		check_msg (error == NULL, "%s", error->message);
		check (folder != NULL);
		if (local)
			check_unref (folder, 1);
		else
			check_unref (folder, 2);
		g_clear_error (&error);
		pull ();

		push ("renaming a non-existant folder");
		camel_store_rename_folder_sync (
			store, "unknown1", "unknown2", NULL, &error);
		check (error != NULL);
		g_clear_error (&error);
		pull ();

		push ("renaming an existing folder");
		camel_store_rename_folder_sync (
			store, "testbox", "testbox2", NULL, &error);
		check_msg (error == NULL, "%s", error->message);
		g_clear_error (&error);
		pull ();

		push ("opening the old name of a renamed folder");
		folder = camel_store_get_folder_sync (
			store, "testbox", 0, NULL, &error);
		check (error != NULL);
		check (folder == NULL);
		g_clear_error (&error);
		pull ();

		push ("opening the new name of a renamed folder");
		folder = camel_store_get_folder_sync (
			store, "testbox2", 0, NULL, &error);
		check_msg (error == NULL, "%s", error->message);
		check (folder != NULL);
		if (local)
			check_unref (folder, 1);
		else
			check_unref (folder, 2);
		pull ();
	}

	push ("deleting a non-existant folder");
	camel_store_delete_folder_sync (store, "unknown", NULL, &error);
	check (error != NULL);
	g_clear_error (&error);
	pull ();

	if (!spool) {
		push ("deleting an existing folder");
		camel_store_delete_folder_sync (
			store, "testbox2", NULL, &error);
		check_msg (error == NULL, "%s", error->message);
		g_clear_error (&error);
		pull ();
	}

	push ("opening a folder that has been deleted");
	folder = camel_store_get_folder_sync (
		store, "testbox2", 0, NULL, &error);
	check (error != NULL);
	check (folder == NULL);
	g_clear_error (&error);
	pull ();

	check_unref (store, 1);

	camel_test_end ();
}
/* The worker thread function with all the complex
 * logic in it! Big fat beast! Please watch your
 * children ... */
static void
synch_worker (struct account_synch_msg *m)
{
    ScalixAccountSynch *sxas;
    ScalixAccountSynchPrivate *priv;
    CamelException ex;
    CamelStore *store;
    CamelFolderInfo *ftree;
    CamelFolderInfo *sf;
    CamelSession *cs;
    const char *uri;
    gboolean res;
    char *sversion;
    char *markup;

    sxas = SCALIX_ACCOUNT_SYNCH (m->sxas);
    priv = SCALIX_ACCOUNT_SYNCH_GET_PRIVATE (sxas);

    uri = e_account_get_string (priv->account, E_ACCOUNT_SOURCE_URL);

    g_print ("SxAS: starting synch for %s\n", uri);

    signal_progress (sxas, 1, _("Trying to connect to server"));

    camel_exception_init (&ex);
    cs = scalix_camel_session_get_default ();
    camel_session_set_online (cs, TRUE);

    store = camel_session_get_store (cs, uri, &ex);

    if (store == NULL) {
        signal_error (sxas, _("Authentication failed. Check for correct hostname, username and password."));
        return;
    }

    /* Must be online! */
    camel_offline_store_set_network_state (CAMEL_OFFLINE_STORE (store),
                                           CAMEL_OFFLINE_STORE_NETWORK_AVAIL,
                                           &ex);

    camel_service_connect (CAMEL_SERVICE (store), &ex);

    if (camel_exception_is_set (&ex)) {
        signal_error (sxas, _("Error while trying to connect to server."));
        return;
    }

    /* Always check for minimal required server version  */
    signal_progress (sxas, 10, _("Checking version of Scalix server"));
    g_print ("SxAS: Checking for minimal server version\n");

    sversion = NULL;
    camel_object_get (store, NULL,
                      CAMEL_SCALIX_STORE_SERVER_VERSION, &sversion, NULL);

    res = scalix_check_min_server_version (sversion);

    if (res == FALSE) {
        signal_error (sxas, _("Wrong version of Scalix server detected"));
        return;
    }

    m->sversion = g_strdup (sversion);
    g_print ("SxAS: sversion:%s\n", m->sversion);

    markup = g_markup_printf_escaped (MSG_SVER, sversion);
    signal_info (sxas, markup);
    g_free (markup);

    signal_progress (sxas, 20, _("Getting list of folders"));
    ftree = camel_store_get_folder_info (store,
                                         NULL,
                                         CAMEL_STORE_FOLDER_INFO_RECURSIVE |
                                         CAMEL_SCALIX_STORE_SHOW_SFOLDER, &ex);

    if (ftree == NULL) {
        camel_object_unref (store);
        signal_error (sxas, _("Could not obtain folder listening"));
        return;

    }

    /* Calendar  */
    signal_progress (sxas, 30, _("Loading calendar data..."));
    synch_data (sxas, ftree, CAMEL_SCALIX_FOLDER_CALENDAR, 30);

    m->esg_cals = create_group (priv->account, "Calendar");
    sync_source_group (priv->account,
                       m->esg_cals, CAMEL_SCALIX_FOLDER_CALENDAR, ftree);

    /* Contacts */
    signal_progress (sxas, 60, _("Loading contacts..."));
    synch_data (sxas, ftree, CAMEL_SCALIX_FOLDER_CONTACT, 60);

    m->esg_cnts = create_group (priv->account, "Contacts");
    sync_source_group (priv->account,
                       m->esg_cnts, CAMEL_SCALIX_FOLDER_CONTACT, ftree);

    create_ldap_source (priv->account, m->esg_cnts);

    /* Sent Items and Drafts Folder */
    if (priv->synch_dfolder) {
        char *url_str;
	CamelURL *url;

	url = camel_url_new (uri, NULL);

        signal_progress (sxas, 95, _("Synchronizing additional data"));

        sf = folder_tree_find_special (ftree, CAMEL_SCALIX_FOLDER_SENT);

        if (url && sf) {
	    url_str = url_set_path_and_get_string (url, sf->full_name);

            e_account_set_string (priv->account,
                                  E_ACCOUNT_SENT_FOLDER_URI, url_str);
            g_free (url_str);
        }

        sf = folder_tree_find_special (ftree, CAMEL_SCALIX_FOLDER_DRAFTS);

        if (url && sf) {
	    url_str = url_set_path_and_get_string (url, sf->full_name);
            e_account_set_string (priv->account,
                                  E_ACCOUNT_DRAFTS_FOLDER_URI, url_str);

            g_free (url_str);
        }

        if (url) {
            gboolean save_pw;

            camel_url_set_path (url, NULL);

            if (url->authmech == NULL) {
		    camel_url_set_authmech (url, "PLAIN");
            }

	    url_str = camel_url_to_string (url, 0);
            e_account_set_string (priv->account,
                                  E_ACCOUNT_TRANSPORT_URL, url_str);

            save_pw = e_account_get_bool (priv->account,
                                          E_ACCOUNT_SOURCE_SAVE_PASSWD);

            e_account_set_bool (priv->account,
                                E_ACCOUNT_TRANSPORT_SAVE_PASSWD, save_pw);
        }

        if (url) {
		camel_url_free (url);
        }
    }

    m->success = TRUE;

    g_print ("SxAS: DONE!\n");

    camel_object_unref (store);
    signal_progress (sxas, 100, _("Done loading"));
    signal_info (sxas, _("Initial loading complete. Please click Forward."));
    g_print ("SxAS: Freeing DONE\n");
    return;
}
int main(int argc, char **argv)
{
    CamelSession *session;
    CamelStore *store;
    CamelException *ex;
    CamelFolder *folder;
    CamelMimeMessage *msg;
    int i, j;
    CamelStream *mbox;
    CamelFilterDriver *driver;

    camel_test_init(argc, argv);
    camel_test_provider_init(1, local_drivers);

    ex = camel_exception_new();

    /* clear out any camel-test data */
    system("/bin/rm -rf /tmp/camel-test");

    camel_test_start("Simple filtering of mbox");

    session = camel_test_session_new ("/tmp/camel-test");

    /* todo: cross-check everything with folder_info checks as well */
    /* todo: work out how to do imap/pop/nntp tests */

    push("getting store");
    store = camel_session_get_store(session, "mbox:///tmp/camel-test/mbox", ex);
    check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
    check(store != NULL);
    pull();

    push("Creating output folders");
    for (i=0; i<ARRAY_LEN(mailboxes); i++) {
        push("creating %s", mailboxes[i].name);
        mailboxes[i].folder = folder = camel_store_get_folder(store, mailboxes[i].name, CAMEL_STORE_FOLDER_CREATE, ex);
        check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
        check(folder != NULL);

        /* we need an empty folder for this to work */
        test_folder_counts(folder, 0, 0);
        pull();
    }
    pull();

    /* append a bunch of messages with specific content */
    push("creating 100 test message mbox");
    mbox = camel_stream_fs_new_with_name("/tmp/camel-test/inbox", O_WRONLY|O_CREAT|O_EXCL, 0600);
    for (j=0; j<100; j++) {
        char *content, *subject;

        push("creating test message");
        msg = test_message_create_simple();
        content = g_strdup_printf("data%d content\n", j);
        test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain",
                                        content, strlen(content));
        test_free(content);
        subject = g_strdup_printf("Test%d message%d subject", j, 100-j);
        camel_mime_message_set_subject(msg, subject);

        camel_mime_message_set_date(msg, j*60*24, 0);
        pull();

        camel_stream_printf(mbox, "From \n");
        check(camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, mbox) != -1);
#if 0
        push("appending simple message %d", j);
        camel_folder_append_message(folder, msg, NULL, ex);
        check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
        pull();
#endif
        test_free(subject);

        check_unref(msg, 1);
    }
    check(camel_stream_close(mbox) != -1);
    check_unref(mbox, 1);
    pull();

    push("Building filters");
    driver = camel_filter_driver_new(session);
    camel_filter_driver_set_folder_func(driver, get_folder, NULL);
    for (i=0; i<ARRAY_LEN(rules); i++) {
        camel_filter_driver_add_rule(driver, rules[i].name, rules[i].match, rules[i].action);
    }
    pull();

    push("Executing filters");
    camel_filter_driver_set_default_folder(driver, mailboxes[0].folder);
    camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex);
    check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));

    /* now need to check the folder counts/etc */

    check_unref(driver, 1);
    pull();

    /* this tests that invalid rules are caught */
    push("Testing broken match rules");
    for (i=0; i<ARRAY_LEN(brokens); i++) {
        push("rule %s", brokens[i].match);
        driver = camel_filter_driver_new(session);
        camel_filter_driver_set_folder_func(driver, get_folder, NULL);
        camel_filter_driver_add_rule(driver, brokens[i].name, brokens[i].match, brokens[i].action);
        camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex);
        check(camel_exception_is_set(ex));
        camel_exception_clear(ex);
        check_unref(driver, 1);
        pull();
    }
    pull();

    push("Testing broken action rules");
    for (i=0; i<ARRAY_LEN(brokena); i++) {
        push("rule %s", brokena[i].action);
        driver = camel_filter_driver_new(session);
        camel_filter_driver_set_folder_func(driver, get_folder, NULL);
        camel_filter_driver_add_rule(driver, brokena[i].name, brokena[i].match, brokena[i].action);
        camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex);
        check(camel_exception_is_set(ex));
        camel_exception_clear(ex);
        check_unref(driver, 1);
        pull();
    }
    pull();


    for (i=0; i<ARRAY_LEN(mailboxes); i++) {
        check_unref(mailboxes[i].folder, 1);
    }

    check_unref(store, 1);

    check_unref(session, 1);
    camel_exception_free(ex);

    camel_test_end();

    return 0;
}
Example #8
0
gint
main (gint argc, gchar **argv)
{
	CamelFolder *f1, *f2;
	CamelStore *store;
	CamelFolderInfo *fi;
	GError *error = NULL;

	camel_test_init (argc, argv);
	camel_test_provider_init (1, local_drivers);

	/* clear out any camel-test data */
	system ("/bin/rm -rf /tmp/camel-test");

	session = camel_test_session_new ("/tmp/camel-test");
	store = camel_session_get_store (session, "maildir:///tmp/camel-test/maildir", NULL);

	camel_test_start ("Maildir backward compatability tests");

	camel_test_push ("./ prefix path, one level");
	f1 = camel_store_get_folder_sync (
		store, "testbox",
		CAMEL_STORE_FOLDER_CREATE, NULL, &error);
	check_msg (error == NULL, "%s", error->message);
	g_clear_error (&error);
	f2 = camel_store_get_folder_sync (
		store, "./testbox",
		CAMEL_STORE_FOLDER_CREATE, NULL, &error);
	check_msg (error == NULL, "%s", error->message);
	g_clear_error (&error);
	check (f1 == f2);
	check_unref (f2, 2);
	check_unref (f1, 1);
	camel_test_pull ();

	camel_test_push ("./ prefix path, one level, no create");
	f1 = camel_store_get_folder_sync (
		store, "testbox2",
		CAMEL_STORE_FOLDER_CREATE, NULL, &error);
	check_msg (error == NULL, "%s", error->message);
	g_clear_error (&error);
	f2 = camel_store_get_folder_sync (
		store, "./testbox2", 0, NULL, &error);
	check_msg (error == NULL, "%s", error->message);
	g_clear_error (&error);
	check (f1 == f2);
	check_unref (f2, 2);
	check_unref (f1, 1);
	camel_test_pull ();

	camel_test_push ("./ prefix path, two levels");
	f1 = camel_store_get_folder_sync (
		store, "testbox/foo",
		CAMEL_STORE_FOLDER_CREATE, NULL, &error);
	check_msg (error == NULL, "%s", error->message);
	g_clear_error (&error);
	f2 = camel_store_get_folder_sync (
		store, "./testbox/foo",
		CAMEL_STORE_FOLDER_CREATE, NULL, &error);
	check_msg (error == NULL, "%s", error->message);
	g_clear_error (&error);
	check (f1 == f2);
	check_unref (f2, 2);
	check_unref (f1, 1);
	camel_test_pull ();

	camel_test_push ("'.' == Inbox");
	f2 = camel_store_get_inbox_folder_sync (store, NULL, &error);
	check_msg (error == NULL, "%s", error->message);
	g_clear_error (&error);
	f1 = camel_store_get_folder_sync (store, ".", 0, NULL, &error);
	check_msg (error == NULL, "%s", error->message);
	g_clear_error (&error);
	check (f1 == f2);
	check_unref (f2, 2);
	check_unref (f1, 1);
	camel_test_pull ();

	camel_test_push ("folder info, recursive");
	fi = camel_store_get_folder_info_sync (
		store, "",
		CAMEL_STORE_FOLDER_INFO_RECURSIVE,
		NULL, &error);
	check_msg (error == NULL, "%s", error->message);
	g_clear_error (&error);
	check (fi != NULL);
	check_fi (fi, fi_list_1, G_N_ELEMENTS (fi_list_1));
	camel_test_pull ();

	camel_test_push ("folder info, flat");
	fi = camel_store_get_folder_info_sync (store, "", 0, NULL, &error);
	check_msg (error == NULL, "%s", error->message);
	g_clear_error (&error);
	check (fi != NULL);
	check_fi (fi, fi_list_2, G_N_ELEMENTS (fi_list_2));
	camel_test_pull ();

	camel_test_push ("folder info, recursive, non root");
	fi = camel_store_get_folder_info_sync (
		store, "testbox",
		CAMEL_STORE_FOLDER_INFO_RECURSIVE,
		NULL, &error);
	check_msg (error == NULL, "%s", error->message);
	g_clear_error (&error);
	check (fi != NULL);
	check_fi (fi, fi_list_3, G_N_ELEMENTS (fi_list_3));
	camel_test_pull ();

	check_unref (store, 1);
	check_unref (session, 1);

	camel_test_end ();

	return 0;
}