aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-tools.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-09-03 03:44:09 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-09-03 03:44:09 +0800
commite625b9324634c01513b9dfafd165e48408b96418 (patch)
tree6dfcda0857740c8ea2126b941da86b2dd0ac1d76 /mail/mail-tools.c
parent4654c4625e79a0d36ef25d81a0c6f53fcd714837 (diff)
downloadgsoc2013-evolution-e625b9324634c01513b9dfafd165e48408b96418.tar.gz
gsoc2013-evolution-e625b9324634c01513b9dfafd165e48408b96418.tar.zst
gsoc2013-evolution-e625b9324634c01513b9dfafd165e48408b96418.zip
Since POP3 doesn't implement get_message_info, we need to check for info
2000-09-02 Jeffrey Stedfast <fejj@helixcode.com> * mail-tools.c (mail_tool_move_folder_contents): Since POP3 doesn't implement get_message_info, we need to check for info to be NULL. In this case, we need to make our own info structure to pass to append_message and then remember to free it afterward. Should we even bother with get_message_info? And if so, should we then implement get_message_info for POP3? svn path=/trunk/; revision=5182
Diffstat (limited to 'mail/mail-tools.c')
-rw-r--r--mail/mail-tools.c92
1 files changed, 52 insertions, 40 deletions
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index eb20a2ef79..c6d5dcdf57 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -252,25 +252,25 @@ mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean
CamelUIDCache *cache;
GPtrArray *uids;
int i;
-
+
mail_tool_camel_lock_up();
-
+
camel_object_ref (CAMEL_OBJECT (source));
camel_object_ref (CAMEL_OBJECT (dest));
-
+
/* Get all uids of source */
-
+
mail_op_set_message ("Examining %s", source->full_name);
-
+
uids = camel_folder_get_uids (source);
printf ("mail_tool_move_folder: got %d messages in source\n", uids->len);
-
+
/* If we're using the cache, ... use it */
-
+
if (use_cache) {
GPtrArray *new_uids;
char *url, *p, *filename;
-
+
url = camel_url_to_string (
CAMEL_SERVICE (source->parent_store)->url, FALSE);
for (p = url; *p; p++) {
@@ -281,9 +281,9 @@ mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean
filename = g_strdup_printf ("%s/config/cache-%s",
evolution_dir, url);
g_free (url);
-
+
cache = camel_uid_cache_new (filename);
-
+
if (cache) {
new_uids = camel_uid_cache_get_new_uids (cache, uids);
camel_folder_free_uids (source, uids);
@@ -295,25 +295,26 @@ mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean
"receive duplicate "
"messages."), filename);
}
-
+
g_free (filename);
} else
cache = NULL;
-
+
printf ("mail_tool_move_folder: %d of those messages are new\n", uids->len);
-
+
/* Copy the messages */
-
+
for (i = 0; i < uids->len; i++) {
CamelMimeMessage *msg;
- const CamelMessageInfo *info;
-
+ CamelMessageInfo *info;
+ gboolean no_info = FALSE;
+
/* Info */
-
+
mail_op_set_message ("Retrieving message %d of %d", i + 1, uids->len);
-
+
/* Get the message */
-
+
msg = camel_folder_get_message (source, uids->pdata[i], ex);
if (camel_exception_is_set (ex)) {
camel_object_unref (CAMEL_OBJECT (msg));
@@ -321,25 +322,36 @@ mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean
}
/* Append it to dest */
-
+
mail_op_set_message ("Writing message %d of %d", i + 1, uids->len);
-
- info = camel_folder_get_message_info (source, uids->pdata[i]);
+
+ info = (CamelMessageInfo *) camel_folder_get_message_info (source, uids->pdata[i]);
+ if (!info) {
+ /* FIXME: should we even bother to call get_message_info? */
+ no_info = TRUE;
+ info = g_new0 (CamelMessageInfo, 1);
+ info->flags = 0;
+ }
+
camel_folder_append_message (dest, msg, info, ex);
+
+ if (no_info)
+ g_free (info);
+
if (camel_exception_is_set (ex)) {
camel_object_unref (CAMEL_OBJECT (msg));
goto cleanup;
}
-
+
/* (Maybe) get rid of the message */
-
+
camel_object_unref (CAMEL_OBJECT (msg));
if (!use_cache)
camel_folder_delete_message (source, uids->pdata[i]);
}
-
+
/* All done. Sync n' free. */
-
+
if (cache) {
camel_uid_cache_free_uids (uids);
@@ -348,11 +360,11 @@ mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean
camel_uid_cache_destroy (cache);
} else
camel_folder_free_uids (source, uids);
-
+
mail_op_set_message ("Saving changes to %s", source->full_name);
-
+
camel_folder_sync (source, TRUE, ex);
-
+
cleanup:
camel_object_unref (CAMEL_OBJECT (source));
camel_object_unref (CAMEL_OBJECT (dest));
@@ -450,42 +462,42 @@ mail_tool_fetch_mail_into_searchable (const char *source_url, gboolean keep_on_s
{
CamelFolder *search_folder = NULL;
CamelFolder *spool_folder = NULL;
-
+
/* If fetching mail from an mbox store, safely copy it to a
* temporary store first.
*/
-
+
if (!strncmp (source_url, "mbox:", 5))
spool_folder = mail_tool_do_movemail (source_url, ex);
else
spool_folder = mail_tool_get_inbox (source_url, ex);
-
+
/* No new mail */
if (spool_folder == NULL)
return NULL;
-
+
if (camel_exception_is_set (ex))
goto cleanup;
-
+
/* can we perform filtering on this source? */
-
+
if (!(spool_folder->has_summary_capability
&& spool_folder->has_search_capability)) {
-
+
/* no :-(. Copy the messages to a local tempbox
* so that the folder browser can search it. */
gchar *url;
-
+
url = mail_tool_get_local_movemail_url();
search_folder = mail_tool_get_folder_from_urlname (url, "movemail", TRUE, ex);
g_free (url);
if (camel_exception_is_set (ex))
goto cleanup;
-
+
mail_tool_move_folder_contents (spool_folder, search_folder, keep_on_server, ex);
if (camel_exception_is_set (ex))
goto cleanup;
-
+
} else {
/* we can search! don't bother movemailing */
search_folder = spool_folder;
@@ -493,7 +505,7 @@ mail_tool_fetch_mail_into_searchable (const char *source_url, gboolean keep_on_s
camel_object_ref (CAMEL_OBJECT (search_folder));
mail_tool_camel_lock_down();
}
-
+
cleanup:
mail_tool_camel_lock_up();
camel_object_unref (CAMEL_OBJECT (spool_folder));
ns'>-1/+1 * Support stage, use bsdtar to extractbapt2013-11-041-7/+4 * Stagifybapt2013-11-041-1/+0 * - Update to 4.0.6.jkim2013-10-262-5/+4 * Add NO_STAGE all over the place in preparation for the staging support (cat: ...bapt2013-09-218-21/+12 * - Use USES=gmakesunpoet2013-09-171-7/+2 * - convert to the new perl5 frameworkaz2013-09-131-3/+2 * 1. Introduce using iconv with arguments:bsam2013-09-021-3/+1 * Update to 4.0.5.jkim2013-08-231-4/+4 * - Convert to new perl frameworkaz2013-08-041-1/+2 * KDE3 and QT3 expired on 2013-07-01, remove these ports.rene2013-07-275-651/+0 * Fix INDEX by really fixing the kde4-l10n portsbapt2013-07-101-0/+1 * KDE4 l10n fixes.rakuco2013-07-102-3/+1 * Update the KDE Software Compilation to 4.10.5.rakuco2013-07-051-2/+2 * Update to KDE SC 4.10.4, proudly presented by the KDE on FreeBSD team.rakuco2013-07-031-2/+2 * Update to 4.0.4.jkim2013-06-201-4/+4 * KDE/FreeBSD team presents KDE SC 4.10.3 ports!makc2013-05-192-4/+2 * Update to 4.0.3.jkim2013-05-101-4/+4 * Add some shebangfix to allow building most of the ports tree without /usr/bin...bapt2013-05-071-5/+3 * - Convert USE_GETTEXT to USES (part 2)ak2013-04-241-1/+1 * Update to 4.0.2.jkim2013-04-171-4/+4 * KDE/FreeBSD team presents KDE SC 4.10.1 ports!makc2013-03-273-6/+8 * Update to 4.0.1.jkim2013-03-091-4/+4 * Update to 3.6.5.jkim2013-02-051-4/+4 * KDE/FreeBSD team presents KDE SC 4.9.5 ports!makc2013-02-043-18/+18 * - Deprecate QT3, KDE3 and unmaintained ports depending on them. QT 3.3.8beat2012-12-301-0/+3 * - Update to 3.5.7.jkim2012-10-272-9/+4 * - Update to 3.5.6.jkim2012-08-241-4/+4 * - Update LibreOffice and the language packs to 3.5.5.jkim2012-07-181-4/+4 * - The FreeBSD Office team is proud to announce LibreOffice.org 3.5.4 releasefluffy2012-07-011-4/+4 * KDE/FreeBSD team presents KDE SC 4.8.4, probably the last release in 4.8.x se...makc2012-06-152-3/+2 * - update png to 1.5.10dinoex2012-06-012-1/+2 * - Remove koffice-i18n ports, as they are not very useful withoutavilla2012-05-315-59/+0 * KDE/FreeBSD team presents long awaited KDE SC 4.8.3!makc2012-05-252-10/+12 * - upgrade to 3.5.2bapt2012-04-234-0/+22 * - Add my LOCAL to MASTER_SITESsunpoet2012-04-181-1/+2 * - update to 1.2bapt2012-04-102-5/+4 * The KDE/FreeBSD team is pleased to announce KDE SC 4.7.4, whichavilla2012-01-251-2/+2 * - Pass maintainership to office@FreeBSD.orgsunpoet2011-11-291-1/+1 * The KDE on FreeBSD team is pleased to update the KDE4 ports to 4.7.3.rakuco2011-11-141-2/+2 * The KDE/FreeBSD team is pleased to announce KDE Software Compilationavilla2011-10-172-4/+11 * - Set DIST_SUBDIR: move dist files to DISTDIR/hunspellsunpoet2011-08-182-2/+3 * - Unify COMMENT and pkg-descrsunpoet2011-08-132-2/+2 * - Pet portlint(1)culot2011-08-092-5/+4 * - Move language prefix to PKGNAMEPREFIXsunpoet2011-07-291-10/+10 * - Fix typosunpoet2011-07-251-1/+1 * Pass matainership to the new office teambapt2011-07-221-1/+1 * Add hebrew hunspell dictionnarybapt2011-07-204-0/+43 * Reset maintainership de jure. In fact KDE 3 has not been maintained by our teammakc2011-07-082-2/+2 * Update KDE Software Compilation ports to 4.6.5makc2011-07-082-2/+22 * The FreeBSD KDE Team is pleased to announce KDE SC 4.6.4. Read fullavilla2011-06-141-2/+2 * Update KDE Software Compilation ports to 4.6.3makc2011-05-171-2/+2 * The FreeBSD KDE Team is pleased to announce April updates for KDEavilla2011-04-071-2/+2 * The FreeBSD KDE Team is pleased to announce KDE SC 4.6.1 and KDE PIMavilla2011-03-252-10/+25 * - Get Rid MD5 supportmiwi2011-03-197-7/+0 * - The KDE FreeBSD team is proud to announce the release of KDE 4.5.5fluffy2011-01-081-2/+2 * KDE FreeBSD team presents KDE SC 4.5.4.makc2010-12-031-2/+2 * KDE FreeBSD team presents KDE SC 4.5.3.makc2010-11-041-3/+2 * KDE FreeBSD team presents KDE SC 4.5.2.makc2010-10-061-3/+3 * Autotools update. Read ports/UPDATING 20100915 for details.ade2010-09-162-4/+2 * KDE FreeBSD team presents KDE SC 4.5.1.makc2010-09-032-41/+8 * Update to 1.1makc2010-08-012-5/+5 * Present KDE SC 4.4.5 for FreeBSD.makc2010-06-301-3/+3 * Present KDE SC 4.4.4 for FreeBSD.makc2010-06-022-3/+6 * Bounce PORTREVISION for gettext-related ports. Have fun, ya'll.ade2010-05-312-2/+2 * - The FreeBSD KDE team is pleased to announce KDE SC 4.4.3 for FreeBSDfluffy2010-05-113-15/+37 * - update to 1.4.1dinoex2010-03-283-2/+3 * Presenting KDE 4.3.5 for FreeBSD. The official release notes for thismiwi2010-02-072-4/+3 * - update to jpeg-8dinoex2010-02-053-2/+3 * - use $SUB_FILES to dynamically adjust pkg-messagepgollucci2010-01-312-1/+3 * For ports maintained by ports@FreeBSD.org, remove names and/ordougb2009-12-211-3/+0 * The FreeBSD KDE is please to announce the release of KDE 4.3.4,miwi2009-12-021-3/+3 * The KDE FreeBSD team is proud to announce the release of KDE 4.3.3miwi2009-11-272-5/+10 * - Remove hebrew/geresh; no longer maintained upstreamtabthorpe2009-10-086-108/+0 * The FreeBSD KDE is please to announce the release of KDE 4.3.1,tabthorpe2009-09-022-4/+4 * These ports need an update to work with the new paragraph embedding levelmarcus2009-08-241-0/+2 * Chase the fribidi shared lib bump.marcus2009-08-231-1/+2 * - Switch SourceForge ports to the new File Release System: categories startin...amdmi32009-08-221-1/+1 * clean upmakc2009-08-081-3/+0 * The KDE FreeBSD team is proud to announce the release of KDE 4.3.0miwi2009-08-053-14/+14 * - bump all port that indirectly depends on libjpeg and have not yet been bump...dinoex2009-07-313-1/+3 * The KDE FreeBSD team is pleased to announce KDE 4.2.4, the last bugfixmiwi2009-06-032-6/+6 * Update KDE ports to 4.2.3makc2009-05-102-3/+8 * The KDE FreeBSD team is proud to announce the release of KDE 4.2.2miwi2009-04-022-4/+4 * Update KDE to 4.2.1.makc2009-03-092-4/+3 * Geresh is a multi lingual text editor, but there are a few featurestabthorpe2009-02-246-0/+105 * The KDE FreeBSD team is proud to announce the release of KDE 4.2.0miwi2009-02-095-330/+157 * Update to 1.0,makc2009-01-253-8/+10 * The KDE FreeBSD team is proud to announce the releasemiwi2008-08-292-6/+6 * Update CONFIGURE_ARGS for how we pass CONFIGURE_TARGET to configure script.rafan2008-08-211-1/+0 * The KDE FreeBSD team is proud to announce the releasemiwi2008-08-184-20/+128 * - Reset maintainer address:pav2008-06-191-1/+1 * Bump portrevision due to upgrade of devel/gettext.edwin2008-06-062-1/+2 * Unbreak by fixing some old code. Fix a typo in pkg-descr.mi2008-05-223-8/+13 * - Remove unneeded dependency from gtk12/gtk20 [1]miwi2008-04-203-13/+11 * Fix distfile location for outdated koffice-l10ns.lofi2007-11-091-1/+1 * Update to KDE 3.5.8lofi2007-10-304-8/+6 * Revert more PORTREVISION accidentslofi2007-07-051-0/+1 * Update to KDE 3.5.7 / KOffice 1.6.3lofi2007-07-045-9/+6 * BROKEN with gcc 4.2kris2007-05-271-1/+7 * - Welcome X.org 7.2 \o/.flz2007-05-206-1/+6 * Update to KDE 3.5.6 / KOffice 1.6.2lofi2007-03-144-6/+10 * Really normalize Aspell dictionaries ports PKGVERSION...thierry2007-02-151-1/+1 * Upgrade to 1.0-0.thierry2007-02-132-4/+4 * Normalize Aspell dictionaries PKGNAMEs.thierry2007-01-141-0/+1 * Update to KDE 3.5.5 / KOffice 1.6.1lofi2006-12-204-6/+122 * KDE 3.5.4 / KOffice 1.5.2lofi2006-09-136-10/+12 * All dictionaries can be installed separately:thierry2006-07-154-7/+17 * Update to KDE 3.5.3lofi2006-06-064-22/+20 * Update to KOffice 1.5.1lofi2006-05-272-4/+4 * Update to KOffice 1.5.0lofi2006-04-293-22/+8 * Update to KDE 3.5.2lofi2006-03-314-128/+22 * Conversion to a single libtool environment.ade2006-02-231-1/+1 * Update to KDE 3.5.1.lofi2006-02-014-8/+18 * SHA256ifyedwin2006-01-224-0/+4 * Update to KDE 3.5.0lofi2006-01-094-74/+82 * - Add SHA256pav2005-11-251-0/+1 * Mass-conversion to the USE_AUTOTOOLS New World Order. The code presentade2005-11-151-1/+1 * Update to 0.101mnag2005-11-072-3/+3 * Update to KDE 3.4.3 / KOffice 1.4.2lofi2005-11-054-6/+34 * Remove all the secondary port of editors/ooodict-allmaho2005-11-012-20/+0 * Fix index build by moving openoffice.org-1.1 ports.maho2005-08-29