aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-03-29 01:38:32 +0800
committerDan Winship <danw@src.gnome.org>2000-03-29 01:38:32 +0800
commited8e120bf0d4a9ce00235fcf62a8e82856aa39c4 (patch)
treeb913297b21aa7e6cfdb5b7afaabcca4f9216978d /tests
parentec31e6ec847c1a9c27571467696a2396a33919f2 (diff)
downloadgsoc2013-evolution-ed8e120bf0d4a9ce00235fcf62a8e82856aa39c4.tar.gz
gsoc2013-evolution-ed8e120bf0d4a9ce00235fcf62a8e82856aa39c4.tar.zst
gsoc2013-evolution-ed8e120bf0d4a9ce00235fcf62a8e82856aa39c4.zip
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
Diffstat (limited to 'tests')
-rw-r--r--tests/test-movemail.c39
1 files changed, 27 insertions, 12 deletions
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 <camel.h>
-#include "camel-pop3-store.h"
-#include "camel-pop3-folder.h"
+#include <e-util/e-setup.h>
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,15 +130,17 @@ 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
}
#ifndef DISPLAY_ONLY
@@ -146,5 +162,4 @@ void
gratuitous_dependency_generator()
{
xmlSetProp();
- e_sexp_add_function();
}