aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-07-27 02:32:35 +0800
committerDan Winship <danw@src.gnome.org>2000-07-27 02:32:35 +0800
commit783b4b8a490e761bb01b6fd38a9f40bfd3332665 (patch)
tree658aadba64776ba9bf717fc8b50b703c6fb32dc2
parentc9e2825702fe00219cfb215fd87e8388bf40522b (diff)
downloadgsoc2013-evolution-783b4b8a490e761bb01b6fd38a9f40bfd3332665.tar
gsoc2013-evolution-783b4b8a490e761bb01b6fd38a9f40bfd3332665.tar.gz
gsoc2013-evolution-783b4b8a490e761bb01b6fd38a9f40bfd3332665.tar.bz2
gsoc2013-evolution-783b4b8a490e761bb01b6fd38a9f40bfd3332665.tar.lz
gsoc2013-evolution-783b4b8a490e761bb01b6fd38a9f40bfd3332665.tar.xz
gsoc2013-evolution-783b4b8a490e761bb01b6fd38a9f40bfd3332665.tar.zst
gsoc2013-evolution-783b4b8a490e761bb01b6fd38a9f40bfd3332665.zip
Don't create the tmp_mbox before calling movemail, because the external
* mail-ops.c (real_fetch_mail): Don't create the tmp_mbox before calling movemail, because the external movemail requires it to not exist. Contrariwise, delete it in the cleanup code if it's empty. Update for camel_movemail interface change. Do the "No new messages" dialog in the mbox case as well as the remote mail issue. svn path=/trunk/; revision=4356
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/mail-ops.c29
2 files changed, 20 insertions, 18 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index aa6b7d1088..f9bf59888b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2000-07-26 Dan Winship <danw@helixcode.com>
+
+ * mail-ops.c (real_fetch_mail): Don't create the tmp_mbox before
+ calling movemail, because the external movemail requires it to not
+ exist. Contrariwise, delete it in the cleanup code if it's empty.
+ Update for camel_movemail interface change. Do the "No new
+ messages" dialog in the mbox case as well as the remote mail
+ issue.
+
2000-07-26 Jeffrey Stedfast <fejj@helixcode.com>
* mail-ops.c: s/struct refile_data/struct move_data
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 3ffe34854f..b48ea8fb4b 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -141,6 +141,7 @@ real_fetch_mail (gpointer user_data)
char *userrules, *systemrules;
char *tmp_mbox = NULL, *source;
guint handler_id = 0;
+ struct stat st;
info = (rfm_t *) user_data;
fb = info->fb;
@@ -172,30 +173,20 @@ real_fetch_mail (gpointer user_data)
* temporary store first.
*/
if (!strncmp (url, "mbox:", 5)) {
- int tmpfd;
-
- tmpfd = open (tmp_mbox, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
-
- if (tmpfd == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Couldn't create temporary "
- "mbox: %s", g_strerror (errno));
- async_mail_exception_dialog ("Unable to move mail", ex, fb );
- goto cleanup;
- }
- close (tmpfd);
-
/* Skip over "mbox:" plus host part (if any) of url. */
source = url + 5;
if (!strncmp (source, "//", 2))
source = strchr (source + 2, '/');
- switch (camel_movemail (source, tmp_mbox, ex)) {
- case -1:
- async_mail_exception_dialog ("Unable to move mail", ex, fb);
- /* FALL THROUGH */
+ camel_movemail (source, tmp_mbox, ex);
+ if (camel_exception_is_set (ex)) {
+ async_mail_exception_dialog ("Unable to move mail",
+ ex, fb);
+ goto cleanup;
+ }
- case 0:
+ if (stat (tmp_mbox, &st) == -1 || st.st_size == 0) {
+ gnome_ok_dialog ("No new messages.");
goto cleanup;
}
@@ -311,6 +302,8 @@ real_fetch_mail (gpointer user_data)
gtk_signal_disconnect (GTK_OBJECT (dest_folder), handler_id);
cleanup:
+ if (stat (tmp_mbox, &st) == 0 && st.st_size == 0)
+ unlink (tmp_mbox); /* FIXME: should use camel to do this */
g_free (tmp_mbox);
if (filter)