aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-movemail.c
diff options
context:
space:
mode:
authornobody <nobody@localhost>2000-11-07 05:40:14 +0800
committernobody <nobody@localhost>2000-11-07 05:40:14 +0800
commit4882b9f898a1e44b7462f0eb1cdc0c8d11897c6a (patch)
tree786145ed8b82796d89e41d2ed37058c0097ace13 /tests/test-movemail.c
parentb4c61eba8055f666fd8a2270879a6f9722faa2b3 (diff)
downloadgsoc2013-evolution-BONOBO_0_31.tar
gsoc2013-evolution-BONOBO_0_31.tar.gz
gsoc2013-evolution-BONOBO_0_31.tar.bz2
gsoc2013-evolution-BONOBO_0_31.tar.lz
gsoc2013-evolution-BONOBO_0_31.tar.xz
gsoc2013-evolution-BONOBO_0_31.tar.zst
gsoc2013-evolution-BONOBO_0_31.zip
This commit was manufactured by cvs2svn to create tag 'BONOBO_0_31'.BONOBO_0_31
svn path=/tags/BONOBO_0_31/; revision=6435
Diffstat (limited to 'tests/test-movemail.c')
-rw-r--r--tests/test-movemail.c164
1 files changed, 0 insertions, 164 deletions
diff --git a/tests/test-movemail.c b/tests/test-movemail.c
deleted file mode 100644
index bcd5334b5a..0000000000
--- a/tests/test-movemail.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <camel.h>
-#include <e-util/e-setup.h>
-
-static char *
-auth_callback (char *prompt, gboolean secret, CamelService *service,
- char *item, CamelException *ex)
-{
- char buf[80];
-
- printf ("%s\n", prompt);
- if (secret)
- printf ("(Warning: your input will be displayed)\n");
- if (fgets (buf, sizeof (buf), stdin) == NULL) {
- camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
- "User cancelled input.");
- return NULL;
- }
- return g_strdup (buf);
-}
-
-extern char *evolution_folders_dir;
-
-int main (int argc, char **argv)
-{
- CamelSession *session;
- CamelException *ex;
- CamelStore *store, *outstore;
- CamelFolder *folder, *outfolder;
- int nmsgs, i;
- CamelMimeMessage *msg;
- char *url;
- gboolean delete = FALSE;
-
- gtk_init (&argc, &argv);
- camel_init ();
-
- if (argc == 3) {
- if (!strcmp (argv[1], "--delete") ||
- !strcmp (argv[1], "-d")) {
- delete = TRUE;
- argc--;
- argv++;
- }
- }
- if (argc != 2) {
- fprintf (stderr, "Usage: test-movemail [--delete] url\n");
- exit (1);
- }
- e_setup_base_dir ();
- session = camel_session_new (auth_callback);
-
- ex = camel_exception_new ();
- store = camel_session_get_store (session, argv[1], ex);
- if (!store) {
- fprintf(stderr, "Could not open store %s:\n%s\n", argv[1],
- camel_exception_get_description (ex));
- exit (1);
- }
- camel_service_connect_with_url (CAMEL_SERVICE (store), argv[1], ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- printf ("Couldn't connect to %s:\n%s\n", argv[1],
- camel_exception_get_description (ex));
- exit (1);
- }
-
- folder = camel_store_get_folder (store, "inbox", ex);
- if (!folder) {
- fprintf(stderr, "Could not get inbox:\n%s\n",
- camel_exception_get_description (ex));
- exit (1);
- }
- camel_folder_open (folder, FOLDER_OPEN_READ, ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- printf ("Couldn't open folder: %s\n",
- camel_exception_get_description (ex));
- exit (1);
- }
-
- nmsgs = camel_folder_get_message_count (folder, ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- printf ("Couldn't get message count: %s\n",
- camel_exception_get_description (ex));
- exit (1);
- }
- printf ("Inbox contains %d messages.\n", nmsgs);
-
-#ifdef DISPLAY_ONLY
- stdout_stream = camel_stream_fs_new_with_fd (1);
-#else
- url = g_strdup_printf ("mbox://%s", evolution_folders_dir);
- outstore = camel_session_get_store (session, url, ex);
- g_free (url);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- printf ("Couldn't open output store: %s\n",
- camel_exception_get_description (ex));
- exit (1);
- }
- outfolder = camel_store_get_folder (outstore, "inbox", ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- printf ("Couldn't make output folder: %s\n",
- camel_exception_get_description (ex));
- exit (1);
- }
- camel_folder_open (outfolder, FOLDER_OPEN_WRITE, ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- printf ("Couldn't open output folder: %s\n",
- camel_exception_get_description (ex));
- exit (1);
- }
-#endif
-
- for (i = 1; i <= nmsgs; i++) {
- msg = camel_folder_get_message_by_number (folder, i, ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- printf ("Couldn't get message: %s\n",
- camel_exception_get_description (ex));
- exit (1);
- }
-
-#ifdef DISPLAY_ONLY
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (msg),
- stdout_stream);
-#else
- camel_folder_append_message (outfolder, msg, ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- printf ("Couldn't write message: %s\n",
- camel_exception_get_description (ex));
- exit (1);
- }
-
- if (delete) {
- camel_folder_delete_message_by_number (folder, i, ex);
- if (camel_exception_get_id (ex) !=
- CAMEL_EXCEPTION_NONE) {
- printf ("Couldn't delete message: %s\n",
- camel_exception_get_description (ex));
- exit (1);
- }
- }
-#endif
- }
-
-#ifndef DISPLAY_ONLY
- camel_folder_close (outfolder, FALSE, ex);
-#endif
- camel_folder_close (folder, TRUE, ex);
-
- camel_service_disconnect (CAMEL_SERVICE (store), ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- printf ("Couldn't disconnect: %s\n",
- camel_exception_get_description (ex));
- exit (1);
- }
-
- return 0;
-}
-
-void
-gratuitous_dependency_generator()
-{
- xmlSetProp();
-}