diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-11-30 04:45:09 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-11-30 04:45:09 +0800 |
commit | 6a337122e631ff3802f07429d480b2af7780f35a (patch) | |
tree | 4fb30b5782ac50db8dffc0e3aba843fafd917a6c /mail | |
parent | bf509e48d25c5c29386eccf1bdb0022cfb8ae708 (diff) | |
download | gsoc2013-evolution-6a337122e631ff3802f07429d480b2af7780f35a.tar.gz gsoc2013-evolution-6a337122e631ff3802f07429d480b2af7780f35a.tar.zst gsoc2013-evolution-6a337122e631ff3802f07429d480b2af7780f35a.zip |
Use camel a bit more to help us out. Don't create the file ourselves,
2000-11-29 Jeffrey Stedfast <fejj@helixcode.com>
* mail-ops.c (do_save_messages): Use camel a bit more to help us
out. Don't create the file ourselves, treat it as a CamelFolder so
we don't have to worry about formatting.
svn path=/trunk/; revision=6724
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/mail-ops.c | 49 |
2 files changed, 40 insertions, 15 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index a9618f2a70..82673ac3e7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2000-11-29 Jeffrey Stedfast <fejj@helixcode.com> + + * mail-ops.c (do_save_messages): Use camel a bit more to help us + out. Don't create the file ourselves, treat it as a CamelFolder so + we don't have to worry about formatting. + 2000-11-29 Dan Winship <danw@helixcode.com> * main.c (main): Remove no-longer-needed e_unicode_init. diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 1ef2af4074..77c27f7ee6 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1061,10 +1061,10 @@ do_transfer_messages (gpointer in_data, gpointer op_data, CamelException *ex) time_t now; /* - * Update the time display ever 2 seconds + * Update the time display every 2 seconds */ time (&now); - if (last_message || ((now - last_update) > 2)){ + if (last_message || ((now - last_update) > 2)) { mail_op_set_message (_("%s message %d of %d (uid \"%s\")"), desc, i + 1, input->uids->len, (char *) input->uids->pdata[i]); last_update = now; @@ -2405,7 +2405,7 @@ describe_save_messages (gpointer in_data, gboolean gerund) return g_strdup_printf (_("Saving messages from folder \"%s\""), mail_tool_get_folder_name (input->folder)); else - return g_strdup_printf (_("Saving messages from \"%s\""), + return g_strdup_printf (_("Save messages from folder \"%s\""), mail_tool_get_folder_name (input->folder)); } @@ -2421,33 +2421,52 @@ static void do_save_messages (gpointer in_data, gpointer op_data, CamelException *ex) { save_messages_input_t *input = (save_messages_input_t *) in_data; - CamelStream *stream; + CamelFolder *dest_folder; + time_t last_update = 0; + char *dir, *name, *url; int i; + name = g_basename (input->path); + dir = g_dirname (input->path); + url = g_strdup_printf ("mbox://%s", dir); + g_free (dir); + dest_folder = mail_tool_get_folder_from_urlname (url, name, CAMEL_STORE_FOLDER_CREATE, ex); + g_free (url); + + if (camel_exception_is_set (ex)) + return; + mail_tool_camel_lock_up (); - stream = camel_stream_fs_new_with_name (input->path, O_WRONLY | O_CREAT | O_TRUNC, 0600); for (i = 0; i < input->uids->len; i++) { - CamelMimeMessage *message; - - mail_op_set_message (_("Retrieving message %d of %d (uid \"%s\")"), - i + 1, input->uids->len, (char *)input->uids->pdata[i]); + const gboolean last_message = (i+1 == input->uids->len); + time_t now; - message = camel_folder_get_message (input->folder, input->uids->pdata[i], ex); - if (message) { - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream); - camel_object_unref (CAMEL_OBJECT (message)); + /* + * Update the time display every 2 seconds + */ + time (&now); + if (last_message || ((now - last_update) > 2)) { + mail_op_set_message (_("Saving message %d of %d (uid \"%s\")"), + i + 1, input->uids->len, (char *)input->uids->pdata[i]); + last_update = now; } + camel_folder_copy_message_to (input->folder, input->uids->pdata[i], dest_folder, NULL); + g_free (input->uids->pdata[i]); } g_ptr_array_free (input->uids, TRUE); - camel_stream_flush (stream); - camel_object_unref (CAMEL_OBJECT (stream)); + camel_object_unref (CAMEL_OBJECT (dest_folder)); mail_tool_camel_lock_down (); + + /* FIXME: temp hack: now to remove the summary file */ + name = g_strdup_printf ("%s.ev-summary", input->path); + unlink (name); + g_free (name); } static void |