aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-01-03 02:04:46 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-01-03 02:04:46 +0800
commit5df4d0a321a1890780f43c715681176c64f01594 (patch)
tree7ef1217cfcb69683f63d8e105f589259dcffd32a
parentff51fffc0bcc9cd47ea179e80ea3c39f961a7349 (diff)
downloadgsoc2013-evolution-5df4d0a321a1890780f43c715681176c64f01594.tar
gsoc2013-evolution-5df4d0a321a1890780f43c715681176c64f01594.tar.gz
gsoc2013-evolution-5df4d0a321a1890780f43c715681176c64f01594.tar.bz2
gsoc2013-evolution-5df4d0a321a1890780f43c715681176c64f01594.tar.lz
gsoc2013-evolution-5df4d0a321a1890780f43c715681176c64f01594.tar.xz
gsoc2013-evolution-5df4d0a321a1890780f43c715681176c64f01594.tar.zst
gsoc2013-evolution-5df4d0a321a1890780f43c715681176c64f01594.zip
The idea here is that if we consistantly name the movemail file between
2001-12-21 Jeffrey Stedfast <fejj@ximian.com> The idea here is that if we consistantly name the movemail file between Send&Receive sessions that if the user cancells the "download" of a mbox spool that the next Send&Receive will not "lose" mail that didn't finish the previous session. Fixes bug #17759. Well, mostly. If you have 200 messages and cancel after the first 100, say, then the next time you hit Send&Receive, it will start over from 1 so you'll end up duplicating the first 100 messages, but at least you won't "lose" mail. * mail-tools.c (mail_tool_get_local_movemail_path): Now a static internal function, takes a char *uri argument and no longer generates movemail.%d filenames... they are now based on the uri provided. (mail_tool_do_movemail): Pass along the source_uri. svn path=/trunk/; revision=15224
-rw-r--r--mail/ChangeLog17
-rw-r--r--mail/mail-tools.c43
-rw-r--r--mail/mail-tools.h3
3 files changed, 39 insertions, 24 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 4ac26319b0..7a01be6d11 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,20 @@
+2001-12-21 Jeffrey Stedfast <fejj@ximian.com>
+
+ The idea here is that if we consistantly name the movemail file
+ between Send&Receive sessions that if the user cancells the
+ "download" of a mbox spool that the next Send&Receive will not
+ "lose" mail that didn't finish the previous session. Fixes bug
+ #17759. Well, mostly. If you have 200 messages and cancel after
+ the first 100, say, then the next time you hit Send&Receive, it
+ will start over from 1 so you'll end up duplicating the first 100
+ messages, but at least you won't "lose" mail.
+
+ * mail-tools.c (mail_tool_get_local_movemail_path): Now a static
+ internal function, takes a char *uri argument and no longer
+ generates movemail.%d filenames... they are now based on the uri
+ provided.
+ (mail_tool_do_movemail): Pass along the source_uri.
+
2001-12-20 Jon Trowbridge <trow@ximian.com>
* message-list.c (on_click): Makes the auto-undelete behavior when
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 9d94fb1e78..d80b3c04fa 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -47,22 +47,6 @@
/* **************************************** */
-gchar *
-mail_tool_get_local_movemail_path (void)
-{
- static gint count = 0;
- static pthread_mutex_t movemail_path_lock = PTHREAD_MUTEX_INITIALIZER;
- gint my_count;
-
- /* Ah, the joys of being multi-threaded... */
- pthread_mutex_lock (&movemail_path_lock);
- my_count = count;
- ++count;
- pthread_mutex_unlock (&movemail_path_lock);
-
- return g_strdup_printf ("%s/local/Inbox/movemail.%d", evolution_dir, my_count);
-}
-
CamelFolder *
mail_tool_get_local_inbox (CamelException *ex)
{
@@ -115,18 +99,35 @@ mail_tool_get_trash (const gchar *url, int connect, CamelException *ex)
return trash;
}
+static char *
+mail_tool_get_local_movemail_path (const unsigned char *uri)
+{
+ unsigned char *safe_uri, *c;
+ char *path;
+
+ safe_uri = g_strdup (uri);
+ for (c = safe_uri; *c; c++)
+ if (strchr ("/:;=|%&#!*^()\\, ", *c) || !isprint ((int) *c))
+ *c = '_';
+
+ path = g_strdup_printf ("%s/local/Inbox/movemail.%s", evolution_dir, safe_uri);
+ g_free (safe_uri);
+
+ return path;
+}
+
/* why is this function so stupidly complex when allthe work is done elsehwere? */
char *
-mail_tool_do_movemail (const gchar *source_url, CamelException *ex)
+mail_tool_do_movemail (const char *source_url, CamelException *ex)
{
- gchar *dest_path;
- const gchar *source;
+ char *dest_path;
+ const char *source;
struct stat sb;
-
+
g_return_val_if_fail (strncmp (source_url, "mbox:", 5) == 0, NULL);
/* Set up our destination. */
- dest_path = mail_tool_get_local_movemail_path();
+ dest_path = mail_tool_get_local_movemail_path (source_url);
/* Skip over "mbox:" plus host part (if any) of url. */
source = source_url + 5;
diff --git a/mail/mail-tools.h b/mail/mail-tools.h
index 1414eec99f..02565b7036 100644
--- a/mail/mail-tools.h
+++ b/mail/mail-tools.h
@@ -36,9 +36,6 @@ typedef struct _xevolution {
char *format;
} XEvolution;
-/* Get the filename for our movemail folder or storage */
-gchar *mail_tool_get_local_movemail_path (void);
-
/* Get the CamelFolder for the local inbox */
CamelFolder *mail_tool_get_local_inbox (CamelException *ex);