From ed8e120bf0d4a9ce00235fcf62a8e82856aa39c4 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 28 Mar 2000 17:38:32 +0000 Subject: make it put mail in ~ instead of always /home/danw. (oops :) also add an option to delete the mail off the server svn path=/trunk/; revision=2214 --- tests/test-movemail.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'tests/test-movemail.c') diff --git a/tests/test-movemail.c b/tests/test-movemail.c index 553f7a3f5f..679e71ec7a 100644 --- a/tests/test-movemail.c +++ b/tests/test-movemail.c @@ -1,8 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ #include -#include "camel-pop3-store.h" -#include "camel-pop3-folder.h" +#include static char * auth_callback (char *prompt, gboolean secret, CamelService *service, @@ -21,6 +20,8 @@ auth_callback (char *prompt, gboolean secret, CamelService *service, return g_strdup (buf); } +extern char *evolution_folders_dir; + int main (int argc, char **argv) { CamelSession *session; @@ -29,14 +30,25 @@ int main (int argc, char **argv) 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 url\n"); + fprintf (stderr, "Usage: test-movemail [--delete] url\n"); exit (1); } + e_setup_base_dir (); camel_provider_scan (); session = camel_session_new (auth_callback); @@ -78,7 +90,9 @@ int main (int argc, char **argv) #ifdef DISPLAY_ONLY stdout_stream = camel_stream_fs_new_with_fd (1); #else - outstore = camel_session_get_store (session, "mbox:///home/danw/evolution/folders", ex); + 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)); @@ -116,14 +130,16 @@ int main (int argc, char **argv) camel_exception_get_description (ex)); exit (1); } -#if 0 - 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); + + 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 #endif } @@ -146,5 +162,4 @@ void gratuitous_dependency_generator() { xmlSetProp(); - e_sexp_add_function(); } -- cgit