From aa9071a09452e98b5e2a8842b3d2a0f288f2514d Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 18 Apr 2001 17:55:54 +0000 Subject: Implemented. (resend_msg): Use is_sent_folder(). 2001-04-18 Jeffrey Stedfast * mail-callbacks.c (is_sent_folder): Implemented. (resend_msg): Use is_sent_folder(). svn path=/trunk/; revision=9449 --- mail/ChangeLog | 5 ++++ mail/mail-callbacks.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 87291536a6..0d24ccf6d8 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2001-04-18 Jeffrey Stedfast + + * mail-callbacks.c (is_sent_folder): Implemented. + (resend_msg): Use is_sent_folder(). + 2001-04-17 Dan Winship * mail-mt.c (mail_msg_check_error): Fix a memory leak. diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 8a5e0de29f..c94d575ed7 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -68,6 +68,7 @@ #endif extern CamelFolder *drafts_folder; +extern CamelFolder *sent_folder; struct post_send_data { CamelFolder *folder; @@ -1007,6 +1008,63 @@ do_edit_messages(CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, void } } +static gboolean +is_sent_folder (CamelFolder *folder) +{ + /* FIXME: hide other attributes of the URL? */ + CamelService *service = CAMEL_SERVICE (folder->parent_store); + guint32 flags = CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS; + const GSList *accounts; + CamelURL *url; + char *str; + + if (folder == sent_folder) + return TRUE; + + str = camel_url_to_string (service->url, flags); + url = camel_url_new (str, NULL); + g_free (str); + + g_free (url->path); + url->path = g_strdup_printf ("/%s", folder->full_name); + + accounts = mail_config_get_accounts (); + while (accounts) { + const MailConfigAccount *account = accounts->data; + + if (account && account->sent_folder_uri) { + CamelURL *sent_url; + + sent_url = camel_url_new (account->sent_folder_uri, NULL); + + if (sent_url) { + g_free (sent_url->passwd); + sent_url->passwd = NULL; + + if (sent_url->params) { + g_datalist_clear (&url->params); + url->params = NULL; + } + + if (camel_url_equal (url, sent_url)) { + camel_url_free (sent_url); + camel_url_free (url); + + return TRUE; + } + + camel_url_free (sent_url); + } + } + + accounts = accounts->next; + } + + camel_url_free (url); + + return FALSE; +} + static gboolean is_drafts_folder (CamelFolder *folder) { @@ -1107,14 +1165,15 @@ do_resend_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, v mail_send_mail (account->transport->url, messages->pdata[i], NULL, NULL); } + + void resend_msg (GtkWidget *widget, gpointer user_data) { FolderBrowser *fb = FOLDER_BROWSER (user_data); - extern CamelFolder *sent_folder; GPtrArray *uids; - if (fb->folder != sent_folder) { + if (!is_sent_folder (fb->folder)) { GtkWidget *message; message = gnome_warning_dialog (_("You may only resend messages\n" -- cgit v1.2.3