diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-09-02 06:11:47 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-09-02 06:11:47 +0800 |
commit | 61230561ce082a5f604201748caa7942668ec46a (patch) | |
tree | 8dffa1e438572f5067dd0fc21d9e5071057d819a | |
parent | 9a58a069bb9f8a6f130509786d1c95af7f3d225c (diff) | |
download | gsoc2013-evolution-61230561ce082a5f604201748caa7942668ec46a.tar.gz gsoc2013-evolution-61230561ce082a5f604201748caa7942668ec46a.tar.zst gsoc2013-evolution-61230561ce082a5f604201748caa7942668ec46a.zip |
New convenience function to load the Outbox folder
2000-09-01 Jeffrey Stedfast <fejj@helixcode.com>
* mail-ops.c (mail_do_setup_outbox): New convenience function to
load the Outbox folder
(mail_do_setup_sentbox): Same, but for Sentbox.
(do_send_mail): Now saves messages in Sentbox if sent successfully
* component-factory.c: Added outbox_folder and sent_folder
(owner_set_cb): Call our new convenience functions to load Outbox
and Sentbox
svn path=/trunk/; revision=5172
-rw-r--r-- | mail/ChangeLog | 11 | ||||
-rw-r--r-- | mail/component-factory.c | 4 | ||||
-rw-r--r-- | mail/mail-ops.c | 150 | ||||
-rw-r--r-- | mail/mail-ops.h | 2 |
4 files changed, 153 insertions, 14 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 98f8d7eb37..18420974b5 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,14 @@ +2000-09-01 Jeffrey Stedfast <fejj@helixcode.com> + + * mail-ops.c (mail_do_setup_outbox): New convenience function to + load the Outbox folder + (mail_do_setup_sentbox): Same, but for Sentbox. + (do_send_mail): Now saves messages in Sentbox if sent successfully + + * component-factory.c: Added outbox_folder and sent_folder + (owner_set_cb): Call our new convenience functions to load Outbox + and Sentbox + 2000-09-01 Ettore Perazzoli <ettore@helixcode.com> * mail-ops.c (cleanup_scan_subfolders): Update for the extra arg diff --git a/mail/component-factory.c b/mail/component-factory.c index 08dd3f73fc..db6e86118d 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -43,6 +43,8 @@ #include "component-factory.h" CamelFolder *drafts_folder = NULL; +CamelFolder *outbox_folder = NULL; +CamelFolder *sentbox_folder = NULL; /* this one should be configurable? */ char *evolution_dir; static void create_vfolder_storage (EvolutionShellComponent *shell_component); @@ -116,6 +118,8 @@ owner_set_cb (EvolutionShellComponent *shell_component, mail_config_init (); mail_do_setup_draftbox (); + mail_do_setup_outbox (); + mail_do_setup_sentbox (); create_vfolder_storage (shell_component); corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 79fdf12ab6..2a41177897 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -304,9 +304,10 @@ static void do_send_mail (gpointer in_data, gpointer op_data, CamelException *ex) { send_mail_input_t *input = (send_mail_input_t *) in_data; + extern CamelFolder *sentbox_folder; CamelTransport *xport; char *x_mailer; - + mail_tool_camel_lock_up (); x_mailer = g_strdup_printf ("Evolution %s (Developer Preview)", VERSION); @@ -315,22 +316,22 @@ do_send_mail (gpointer in_data, gpointer op_data, CamelException *ex) g_free (x_mailer); camel_mime_message_set_date (input->message, CAMEL_MESSAGE_DATE_CURRENT, 0); - + xport = camel_session_get_transport (session, input->xport_uri, ex); mail_tool_camel_lock_down (); if (camel_exception_is_set (ex)) return; - - mail_tool_send_via_transport (xport, CAMEL_MEDIUM (input->message), - ex); + + mail_tool_send_via_transport (xport, CAMEL_MEDIUM (input->message), ex); camel_object_unref (CAMEL_OBJECT (xport)); - + if (camel_exception_is_set (ex)) return; - + + /* if we replied to a message, mark the appropriate flags and stuff */ if (input->done_folder) { guint32 set; - + mail_tool_camel_lock_up (); set = camel_folder_get_message_flags (input->done_folder, input->done_uid); @@ -339,20 +340,30 @@ do_send_mail (gpointer in_data, gpointer op_data, CamelException *ex) input->done_flags, ~set); mail_tool_camel_lock_down (); } + + /* now to save the message in Sentbox */ + if (sentbox_folder) { + CamelMessageInfo *info; + + info = g_new0 (CamelMessageInfo, 1); + info->flags = 0; + camel_folder_append_message (sentbox_folder, input->message, info, ex); + g_free (info); + } } static void cleanup_send_mail (gpointer in_data, gpointer op_data, CamelException *ex) { send_mail_input_t *input = (send_mail_input_t *) in_data; - + camel_object_unref (CAMEL_OBJECT (input->message)); if (input->done_folder) camel_object_unref (CAMEL_OBJECT (input->done_folder)); - + g_free (input->xport_uri); g_free (input->done_uid); - + if (!camel_exception_is_set (ex)) gtk_widget_destroy (input->composer); else @@ -375,7 +386,7 @@ mail_do_send_mail (const char *xport_uri, guint32 done_flags, GtkWidget *composer) { send_mail_input_t *input; - + input = g_new (send_mail_input_t, 1); input->xport_uri = g_strdup (xport_uri); input->message = message; @@ -383,7 +394,7 @@ mail_do_send_mail (const char *xport_uri, input->done_uid = g_strdup (done_uid); input->done_flags = done_flags; input->composer = composer; - + mail_operation_queue (&op_send_mail, input, TRUE); } @@ -1821,7 +1832,7 @@ mail_do_edit_messages (CamelFolder *folder, GPtrArray *uids, static gchar *describe_setup_draftbox (gpointer in_data, gboolean gerund); static void noop_setup_draftbox (gpointer in_data, gpointer op_data, - CamelException *ex); + CamelException *ex); static void do_setup_draftbox (gpointer in_data, gpointer op_data, CamelException *ex); @@ -1872,6 +1883,117 @@ mail_do_setup_draftbox (void) mail_operation_queue (&op_setup_draftbox, NULL, FALSE); } +/* ** SETUP OUTBOX ****************************************************** */ + +static gchar *describe_setup_outbox (gpointer in_data, gboolean gerund); +static void noop_setup_outbox (gpointer in_data, gpointer op_data, + CamelException *ex); +static void do_setup_outbox (gpointer in_data, gpointer op_data, + CamelException *ex); + +static gchar * +describe_setup_outbox (gpointer in_data, gboolean gerund) +{ + if (gerund) + return g_strdup_printf (_("Loading Outbox")); + else + return g_strdup_printf (_("Load Outbox")); +} + +static void +noop_setup_outbox (gpointer in_data, gpointer op_data, CamelException *ex) +{ +} + +static void +do_setup_outbox (gpointer in_data, gpointer op_data, CamelException *ex) +{ + extern CamelFolder *outbox_folder; + gchar *url; + + url = g_strdup_printf ("mbox://%s/local/Outbox", evolution_dir); + outbox_folder = mail_tool_get_folder_from_urlname (url, "mbox", TRUE, ex); + g_free (url); +} + +/* + *static void + *cleanup_setup_outbox (gpointer in_data, gpointer op_data, + * CamelException *ex) + *{ + *} + */ + +static const mail_operation_spec op_setup_outbox = { + describe_setup_outbox, + 0, + noop_setup_outbox, + do_setup_outbox, + noop_setup_outbox +}; + +void +mail_do_setup_outbox (void) +{ + mail_operation_queue (&op_setup_outbox, NULL, FALSE); +} + +/* ** SETUP SENTBOX ****************************************************** */ + +static gchar *describe_setup_sentbox (gpointer in_data, gboolean gerund); +static void noop_setup_sentbox (gpointer in_data, gpointer op_data, + CamelException *ex); +static void do_setup_sentbox (gpointer in_data, gpointer op_data, + CamelException *ex); + +static gchar * +describe_setup_sentbox (gpointer in_data, gboolean gerund) +{ + if (gerund) + return g_strdup_printf (_("Loading Sentbox")); + else + return g_strdup_printf (_("Load Sentbox")); +} + +static void +noop_setup_sentbox (gpointer in_data, gpointer op_data, CamelException *ex) +{ +} + +static void +do_setup_sentbox (gpointer in_data, gpointer op_data, CamelException *ex) +{ + extern CamelFolder *sentbox_folder; + gchar *url; + + url = g_strdup_printf ("mbox://%s/local/Sentbox", evolution_dir); + sentbox_folder = mail_tool_get_folder_from_urlname (url, "mbox", TRUE, ex); + g_free (url); +} + +/* + *static void + *cleanup_setup_sentbox (gpointer in_data, gpointer op_data, + * CamelException *ex) + *{ + *} + */ + +static const mail_operation_spec op_setup_sentbox = { + describe_setup_sentbox, + 0, + noop_setup_sentbox, + do_setup_sentbox, + noop_setup_sentbox +}; + +void +mail_do_setup_sentbox (void) +{ + mail_operation_queue (&op_setup_sentbox, NULL, FALSE); +} + + /* ** VIEW MESSAGES ******************************************************* */ typedef struct view_messages_input_s { diff --git a/mail/mail-ops.h b/mail/mail-ops.h index 33f7456f82..1ec7af4e4f 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -60,6 +60,8 @@ void mail_do_display_message (MessageList *ml, const char *uid, void mail_do_edit_messages (CamelFolder *folder, GPtrArray *uids, GtkSignalFunc signal); void mail_do_setup_draftbox (void); +void mail_do_setup_outbox (void); +void mail_do_setup_sentbox (void); void mail_do_view_messages (CamelFolder *folder, GPtrArray *uids, FolderBrowser *fb); |