aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-03-28 12:25:31 +0800
committerDan Winship <danw@src.gnome.org>2000-03-28 12:25:31 +0800
commit9d0c0def4a16839bca1c688317b29718f5128e84 (patch)
treed3b1363f96f579568b8962d6620fb4016f009d06 /tests
parent7301e78bde90188847bc5348e19ac565622a765a (diff)
downloadgsoc2013-evolution-9d0c0def4a16839bca1c688317b29718f5128e84.tar.gz
gsoc2013-evolution-9d0c0def4a16839bca1c688317b29718f5128e84.tar.zst
gsoc2013-evolution-9d0c0def4a16839bca1c688317b29718f5128e84.zip
new test program. Can be used to copy POP mail into your evolution inbox.
* tests/test-movemail.c: new test program. Can be used to copy POP mail into your evolution inbox. svn path=/trunk/; revision=2208
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am10
-rw-r--r--tests/test-movemail.c150
2 files changed, 159 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3291d6035c..d91c0cb660 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,7 @@
# process this file with automake to create Makefile.in
INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) -I$(top_srcdir)/camel/providers/MH \
+ -I$(includedir) -I$(top_srcdir)/camel/providers/pop3 \
-I$(top_srcdir)/camel/providers/mbox
LDADD = \
$(top_builddir)/camel/libcamel.la \
@@ -31,6 +31,13 @@ test9_LDADD = \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
+test_movemail_LDADD = \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/libibex/libibex.la \
+ $(GNOME_LIBDIR) \
+ $(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
+
if ENABLE_THREADS
THREAD_RELATED_TESTS=test8
else
@@ -47,4 +54,5 @@ noinst_PROGRAMS = \
test10 \
test11 \
test-formatter \
+ test-movemail \
$(THREAD_RELATED_TESTS)
diff --git a/tests/test-movemail.c b/tests/test-movemail.c
new file mode 100644
index 0000000000..553f7a3f5f
--- /dev/null
+++ b/tests/test-movemail.c
@@ -0,0 +1,150 @@
+/* -*- 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"
+
+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);
+}
+
+int main (int argc, char **argv)
+{
+ CamelSession *session;
+ CamelException *ex;
+ CamelStore *store, *outstore;
+ CamelFolder *folder, *outfolder;
+ int nmsgs, i;
+ CamelMimeMessage *msg;
+
+ gtk_init (&argc, &argv);
+ camel_init ();
+
+ if (argc != 2) {
+ fprintf (stderr, "Usage: test-movemail url\n");
+ exit (1);
+ }
+ camel_provider_scan ();
+ 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
+ outstore = camel_session_get_store (session, "mbox:///home/danw/evolution/folders", ex);
+ 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 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);
+ }
+#endif
+#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();
+ e_sexp_add_function();
+}
tpwuid_r from the patch. Build getpwuid_r partmbr2003-04-0417-1224/+595 * Fix crash in Autopilot->Report.mbr2003-04-0417-0/+187 * Update to version 9.3n.gj2003-04-034-4/+12 * Update to 1.0.5.marcus2003-04-034-13/+30 * Update to 2.42kevlo2003-04-032-2/+2 * This snapshot has a different path for the userdir.mbr2003-04-0117-67/+67 * Update to Vim 6.1 patchlevel 405.obrien2003-04-012-12/+38 * Update to srx644_ooo20030412.mbr2003-04-0168-255/+68 * Readd previous deleted part. It is still needed for 4.xmbr2003-04-0117-34/+510 * SOLARINI pointed to the wrong file. ssrx644.ini itself has stillmbr2003-03-3151-510/+901 * Uups. Committed to the wrong dir.mbr2003-03-3117-0/+0 * Check for m_pLockfile != NULL to fix crash during startup if no lockfilembr2003-03-3117-0/+374 * Only add the office_${RELEASE_NR} wrapper startup scriptsmbr2003-03-3117-34/+34 * Work around the issue that our jdk has no version number like 1.4.1_02.mbr2003-03-3034-0/+1020 * Only do the workaround if a user-install exists.mbr2003-03-2917-50/+84 * Add missing cpmbr2003-03-2917-0/+34 * Mark BROKEN on 5.0: does not compilekris2003-03-291-1/+7 * Remove the FreeBSD SOLARLIB part now /usr/lib and /usr/local/libmbr2003-03-2817-170/+442 * Patch was reversed.mbr2003-03-2817-408/+204 * Fix typombr2003-03-2817-17/+17 * Unbreak the port and fix the remaining pkg files.mbr2003-03-2851-1309/+1462 * Workarounds for the startup wrappers.mbr2003-03-2817-50/+118 * Add $JAVA_HOME/jre/lib/i386 for -L. This seems to be unneeded for Linuxmbr2003-03-2817-34/+187 * BSD cp does not have -u option.mbr2003-03-2817-0/+272 * Fix typo: ScanFileList -> SCacheFileListmbr2003-03-2820-20/+20 * Use autoconf version > 2.5 to fix compile on CURRENT.mbr2003-03-2820-0/+20 * Bump portrevision after recent changes.mbr2003-03-283-3/+3 * Fix gcc3.2.2 compilembr2003-03-283-18/+18 * Fix patch which was apllied to the wrong dir.mbr2003-03-283-102/+81 * Fix missing patch which was applied to the wrong directory, ouch !mbr2003-03-2817-578/+459 * Depending on how a compiler generates code (e.g., GCC 3.2.2 vs. GCCmbr2003-03-2817-0/+697 * Add "bsd" include path to SOLARINC too.mbr2003-03-2817-51/+68 * The bsd1.4.1 jdk has a "bsd" include subdir.mbr2003-03-2717-17/+17 * This is fixed in the new snap tarball.mbr2003-03-2734-3587/+0 * OOo1.1 seems to link against a lib in the jdk. OOo will still runmbr2003-03-2717-357/+17 * Update to a 20030324 snapshot. Remove a old unusedmbr2003-03-2734-68/+68 * Update to version 0.8.1kevlo2003-03-274-17/+9 * Always use ${LINK} and ignore different settings.mbr2003-03-2717-17/+17 * Fix typombr2003-03-273-3/+3 * Hopefully fix the build on bento:mbr2003-03-2720-100/+220 * Add WWW.olgeni2003-03-241-0/+2 * Use the linux map files for the gcc3 case.mbr2003-03-2451-102/+476 * The disposing happened to early. Move it a bit.mbr2003-03-2417-0/+578 * We use the linux jdk now to build, so follow the linux if-clauses here.mbr2003-03-2434-0/+680 * Fix bridge tests. Fixed in HEAD of OO.org, but not in srx644 branch.mbr2003-03-2434-0/+3587 * Remove -export-dynamic. This option is not needed at all andmbr2003-03-2417-68/+68 * Update to 4.1.0.sobomax2003-03-234-59/+434 * Include keysym.h not keysymdef.h, to get XK_ISO_Lock with XFree86 4.3.0.anholt2003-03-131-0/+11 * Readd patch from last commit.mbr2003-03-1217-0/+187 * Update to cws_srx644_ooo11beta. It still doesn't build but this commit will helpmbr2003-03-12408-89505/+9911 * Cleaning up after the wonders of remote cvsade2003-03-076-6/+0 * Clear moonlight beckons.ade2003-03-07116-55/+61 * Remove pkg-comment from the remaining special cases.ade2003-03-071-1/+0 * Remove pkg-comment from remaining master/slave port sets.ade2003-03-0749-32/+26 * More manual pkg-comment cleanups.ade2003-03-079-9/+7 * Destroy pkg-comment for some of the stranger uses in the tree,ade2003-03-0746-23/+23 * Remove pkg-comment and add COMMENT to the Makefile.gj2003-03-0610-5/+5 * It's ".if", not "if"ade2003-03-0617-17/+17 * DTRT with respect to COMMENT, unbreaking things.ade2003-03-061-3/+1 * Fix minor typo (if instead of .if)ade2003-03-063-3/+3 * de-pkg-commentmbr2003-03-068-23/+27 * Update to 1.1 beta. Work in progress.mbr2003-03-061237-39339/+8875 * de-pkg-comment, drop maintainership.alex2003-03-062-2/+2 * Update to Vim 6.1 patchlevel 365obrien2003-03-062-2/+24 * * Switch to Makefile COMMENTdougb2003-03-053-60/+24 * Switch to Makefile COMMENTdougb2003-03-051-1/+0 * Bring over the patch from pine4 to make the pico build respect CFLAGSdougb2003-03-051-0/+11 * Update to 2.41 which solves a core dump bug.markp2003-03-052-2/+2 * Add missing patches for PR 48789mbr2003-03-0557-0/+2976 * Add support for uk_UA.KOI8-U locale.mbr2003-03-0515-9/+156 * Use MASTER_SITE_DEBIAN.naddy2003-03-041-1/+2 * Update to 9.3l.gj2003-03-0412-4/+44 * This download site answers, but the mirror hasn't updated to the latest version.dougb2003-02-281-1/+0 * Update 3.3 to 3.4.kiri2003-02-282-3/+3 * Update 6.1 to 7.0.kiri2003-02-282-101/+103 * Remove redunant quotes on COMMENTSperky2003-02-281-1/+1 * Update WWW and MASTER_SITESarved2003-02-242-2/+3 * Add AbiWord2.marcus2003-02-241-0/+1 * Add AbiWord2 after repo copy from AbiWord. AbiWord2 is the GNOME Officemarcus2003-02-2439-1752/+1512 * De-pkg-comment my ports + some more.olgeni2003-02-232-1/+1 * Maintainer update: editors/jed to 0.99.16edwin2003-02-235-19/+43 * Make fetchable.arved2003-02-236-10/+46 * Update to 3.2.7.markp2003-02-233-3/+3 * Do not fail if libXrender.so doesn't exist at all.mbr2003-02-222-0/+4 * Add USE_XLIB.arved2003-02-221-0/+1 * de-pkg-comment.kuriyama2003-02-222-1/+1 * De-pkg-comment.knu2003-02-2158-29/+29 * When saving file do fflush/fsync, so that its content isn't lost if machinesobomax2003-02-211-0/+14 * Add qemacs, Quick Emacs, a very small but powerful editorarved2003-02-216-0/+91 * Actually enable all those nifty new features.naddy2003-02-211-0/+2 * De-pkg-comment.knu2003-02-214-3/+3 * De-pkg-comment.knu2003-02-2159-31/+32 * Update to 1.2.0. Major additions in this release:naddy2003-02-204-6/+10 * Fix make WITH_CDROM WITH_ADABAS=yes.mbr2003-02-201-4/+4 * Make some installation notes more clear. Inspired bymbr2003-02-204-14/+48 * Fix the insufficient installation instructions.mbr2003-02-202-14/+51 * Update to Vim 6.1 patchlevel 343obrien2003-02-202-2/+18 * De-pkg-comment vim 6 ports.knu2003-02-195-4/+5 * add tetradraw 2.0.2ijliao2003-02-177-0/+39 * Update to 1.9.8pat2003-02-154-3/+68 * Switch over to MASTER_SITE_DEBIAN.naddy2003-02-132-2/+3 * The helpcontent files have moved.mbr2003-02-133-3/+3 * Add missing underline.mbr2003-02-123-3/+3 * Fix build broken by version update.markp2003-02-111-1/+2 * upgrade to 1.2.0ijliao2003-02-103-3/+8 * Convert COMMENT to COMMENTFILE until these ports can be converted.kris2003-02-1022-22/+22 * Update to 3.2.5.markp2003-02-093-3/+9 * Actually commit ghex2 2.2.0.marcus2003-02-092-6/+7 * add MathPlanner 3.1.2ijliao2003-02-089-0/+136 * Update to GNOME 2.2.marcus2003-02-085-15/+76 * Create MASTER_SITE_VIM.obrien2003-02-071-6/+1 * Update to Vim 6.1 patchlevel 319obrien2003-02-073-7/+5 * Correct ports that were abusing the FORBIDDEN variable and replace withseanc2003-02-072-2/+2 * Update to 0.7.9.sobomax2003-02-063-4/+2 * Update to 1.50.sobomax2003-02-065-17/+10 * Add staroffice6 wrapper script.mbr2003-02-052-0/+30 * Fetch the sunsolve patch for inofficial distsites, we have thembr2003-02-054-26/+50 * o Build and install some tools in the wily tarball to make the behaviourjkoshy2003-02-057-4/+87 * Update to Vim 6.1 patchlevel 314obrien2003-02-032-10/+10 * Fix core-dump-problem on 5.0 or later.shige2003-02-023-9/+21 * Fix the build dependendency for the JDK. Wembr2003-02-013-6/+9 * Properly handle OMF files.marcus2003-01-311-0/+4 * bump PORTEPOCH by 2.31->2.4.nork2003-01-301-0/+1 * Switch over to GNOMENG (I wish the knob was named something else as I don'tobrien2003-01-291-8/+13 * Update to 2.4.nork2003-01-292-2/+2 * Update to Vim 6.1 patchlevel 302obrien2003-01-282-2/+33 * Linux JDK has moved.mbr2003-01-273-3/+3 * Fix plist.yoichi2003-01-272-1/+2 * Install info(ja version).shige2003-01-264-0/+12 * Use the linux JDK for the build, which hopefully fixes thembr2003-01-2612-24/+330 * Update to 1.14.5.shige2003-01-244-6/+6 * Add a notice about possible crashes if a localized versionmbr2003-01-243-0/+36 * Update to 1.14.5.shige2003-01-247-62/+6 * The handbook is no longer installed if the RES_GER variable is missing.mbr2003-01-243-3/+3 * * Update to 1.0.4marcus2003-01-2412-28/+40 * Add missing quote.mbr2003-01-243-3/+3 * Remove problematic USE_GCC=3.1 cause. This should fix the build on STABLE.mbr2003-01-233-12/+0 * Allow language defined pkg-message files.mbr2003-01-233-0/+9 * Upgrade to the source from pine 4.53. The previous MAINTAINER has beendougb2003-01-234-56/+13 * Fix typo: waring -> warningmbr2003-01-233-3/+3 * add xmleditor 0.5.3ijliao2003-01-236-0/+46 * Correct version. And FreeBSD.mbr2003-01-233-12/+12 * Update the pkg-message to reflect reality. Remove thembr2003-01-233-99/+105 * Remove obsolete linembr2003-01-232-2/+0 * STABLE has still no iswspace(). Add define for it. No changembr2003-01-223-24/+63 * Fix the sed scripts and use -i orig in the post-install step.mbr2003-01-223-12/+9 * Update 21.4.11 to 21.4.12.kiri2003-01-226-9/+13 * Add russian language distribution patch.mbr2003-01-223-0/+3 * Update StarOffice6.0 to patchlevel 3mbr2003-01-224-20/+42 * Update to 1.02mbr2003-01-2287-11913/+1242 * Update to 0.1.4yoichi2003-01-223-3/+17 * There is still no USE_GCC=3.2 version in our port build files. Therembr2003-01-223-15/+12 * Do not define USE_LANG if it is already set.mbr2003-01-223-0/+6 * Set $LANG to a useful value if it is not already set. This is a issuembr2003-01-226-9/+117 * Update to 2.0.0.marcus2003-01-203-3/+7 * Also update distinfo to reflect the update to 21.4.12.gj2003-01-182-6/+6 * Update to version 2.4.12.gj2003-01-174-4/+10 * Add missing FreeBSD case. Needed to fix the breakage introducedmbr2003-01-153-9/+36 * Add rox-edit, a simple text editor for the ROX desktop.olgeni2003-01-136-0/+67 * Update to 1.31.nobutaka2003-01-138-998/+1000 * Use always $PORTVERSION instead of hard coded numbers.mbr2003-01-1320-207/+207 * Fix for numerous bugs with russian localization.mbr2003-01-123-0/+7470 * Remove the procfs dependency. Use the PS_STRINGS macro to get argv[].mbr2003-01-129-84/+69 * Update to version 9.3j.gj2003-01-1212-4/+80 * Use tabs.obrien2003-01-082-4/+4 * Update to v2.7.2.jkoshy2003-01-063-54/+116 * Use /var/tmp instead of /usr/tmp as temp dir.anders2003-01-051-103/+64 * Update 3.2 to 3.3.kiri2003-01-052-5/+5 * Update 6.0 to 6.1.kiri2003-01-052-17/+17 * Update 21.1.10 to 21.1.11.kiri2003-01-052-4/+4 * Update to Vim 6.1 patchlevel 271obrien2003-01-052-1/+10 * [MAINTAINER-PATCH] Add new MASTER_SITES for editors/joeedwin2003-01-042-2/+4 * fix bin nameijliao2003-01-032-0/+12 * upgrade to 2.12ijliao2003-01-032-4/+5 * Update to 1.2.1.alane2003-01-0233-993/+333 * Remove redundant dependencies. Mk/bsd.emacs.mk takes care of them.knu2002-12-222-6/+0 * "elisp" cannot be the primary category. Prepend "editors' toknu2002-12-091-1/+1 * Fix subdir and last commit. Of course it should have beenmbr2002-12-083-6/+6 * Finish repo copy move: remove from old category, link into new, addlioux2002-12-0713-3329/+0 * Fix dist subdir. OpenOffice.org has changed the subdir order.mbr2002-12-063-3/+3 * Sort entries.knu2002-11-281-12/+12 * Unbreak for -current.sada2002-11-246-0/+146 * Updated to version 3.9. Added new webdocs author provided for me.alane2002-11-242-10/+19 * Mark this port broken til we have a solution.mbr2002-11-2417-0/+34 * Fix broken install with WRKDIRPREFIX defined.mbr2002-11-241-2/+3 * Update to 1.79.20111024.nork2002-11-232-7/+6 * Update to 1.3arved2002-11-226-4/+44 * Update to Vim 6.1 patchlevel 262obrien2002-11-202-2/+14 * removed test portalane2002-11-191-1/+0 * Testing testing is the thing on?alane2002-11-191-0/+1 * Update to 2.0.6.marcus2002-11-193-2/+3 * Put a real description in pkg-descr by copying the author's excellentalane2002-11-191-2/+26 * * PORTREVISION => 2.alane2002-11-19