aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-05-09 13:08:25 +0800
committerDan Winship <danw@src.gnome.org>2000-05-09 13:08:25 +0800
commitc6de9ace9fe9b4a438583ed143f9b3b99211091d (patch)
tree9e9eb677c5cc455fbf2530812ab730264d75d1c3 /mail/mail-ops.c
parentdebd40014f38065b6a72fbadefd60a0cadd2c89d (diff)
downloadgsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar.gz
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar.bz2
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar.lz
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar.xz
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar.zst
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.zip
make this a little less kludgy. Use gnome_error_dialog rather than printf
* folder-browser.c (folder_browser_load_folder): make this a little less kludgy. Use gnome_error_dialog rather than printf on errors. * mail-ops.c (fetch_mail): Fix to work with the new shell stuff... sorta. Will need more fixing later when the new shell framework is more done. * mail-config.c (finish): Call gnome_config_sync so the data actually gets written. svn path=/trunk/; revision=2931
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c52
1 files changed, 16 insertions, 36 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 4ff3299d98..5c68337f52 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -67,14 +67,16 @@ check_configured (void)
return configured;
}
+/* FIXME: This is BROKEN! It fetches mail into whatever folder you're
+ * currently viewing.
+ */
void
fetch_mail (GtkWidget *button, gpointer user_data)
{
-#if 0
FolderBrowser *fb = FOLDER_BROWSER (user_data);
CamelException *ex;
CamelStore *store = NULL;
- CamelFolder *folder = NULL, *outfolder = NULL;
+ CamelFolder *folder = NULL;
int nmsgs, i;
CamelMimeMessage *msg = NULL;
char *path, *url = NULL;
@@ -94,6 +96,7 @@ fetch_mail (GtkWidget *button, gpointer user_data)
return;
}
+ path = CAMEL_SERVICE (fb->folder->parent_store)->url->path;
ex = camel_exception_new ();
/* If fetching mail from an mbox store, safely copy it to a
@@ -103,8 +106,7 @@ fetch_mail (GtkWidget *button, gpointer user_data)
char *tmp_mbox, *source;
int tmpfd;
- tmp_mbox = g_strdup_printf ("%s/movemail.XXXX",
- evolution_folders_dir);
+ tmp_mbox = g_strdup_printf ("%s/movemail.XXXX", path);
#ifdef HAVE_MKSTEMP
tmpfd = mkstemp (tmp_mbox);
#else
@@ -123,8 +125,10 @@ fetch_mail (GtkWidget *button, gpointer user_data)
}
close (tmpfd);
- /* Skip over "mbox://" plus host part (if any) or url. */
- source = strchr (url + 7, '/');
+ /* 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:
@@ -137,7 +141,7 @@ fetch_mail (GtkWidget *button, gpointer user_data)
goto cleanup;
}
- folder = camel_store_get_folder (default_session->store,
+ folder = camel_store_get_folder (fb->folder->parent_store,
strrchr (tmp_mbox, '/') + 1,
ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
@@ -183,20 +187,6 @@ fetch_mail (GtkWidget *button, gpointer user_data)
if (nmsgs == 0)
goto cleanup;
- outfolder = camel_store_get_folder (default_session->store,
- "inbox", ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- mail_exception_dialog ("Unable to open inbox to store mail",
- ex, fb);
- goto cleanup;
- }
- camel_folder_open (outfolder, FOLDER_OPEN_WRITE, ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- mail_exception_dialog ("Unable to open inbox to store mail",
- ex, fb);
- goto cleanup;
- }
-
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) {
@@ -205,7 +195,7 @@ fetch_mail (GtkWidget *button, gpointer user_data)
goto cleanup;
}
- camel_folder_append_message (outfolder, msg, ex);
+ camel_folder_append_message (fb->folder, msg, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
mail_exception_dialog ("Unable to write message",
ex, fb);
@@ -221,7 +211,10 @@ fetch_mail (GtkWidget *button, gpointer user_data)
}
msg = NULL;
- folder_browser_set_uri (fb, "inbox"); /* FIXME */
+ /* Redisplay. Ick. FIXME */
+ path = g_strdup_printf ("file://%s", path);
+ folder_browser_set_uri (fb, path);
+ g_free (path);
cleanup:
if (url)
@@ -235,22 +228,9 @@ fetch_mail (GtkWidget *button, gpointer user_data)
camel_service_disconnect (CAMEL_SERVICE (store), ex);
gtk_object_unref (GTK_OBJECT (store));
}
-#if 0
- /* FIXME: we'll want to do this when the rest of the mail
- * stuff is refcounting things properly.
- */
- if (outfolder) {
- if (camel_folder_is_open (outfolder))
- camel_folder_close (outfolder, FALSE, ex);
- gtk_object_unref (GTK_OBJECT (outfolder));
- }
-#endif
camel_exception_free (ex);
if (msg)
gtk_object_unref (GTK_OBJECT (msg));
-#else
- printf ("Sorry, I'm broken! Try again tomorrow.");
-#endif
}