diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-06-15 03:05:39 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-06-15 03:05:39 +0800 |
commit | 1072bbd65915a892258d85bdb8190f025f4bfc66 (patch) | |
tree | 47dfa38967e46f0957a2b101ecfeb308ff282e03 | |
parent | 9df60c5c8fc3ce56c8800e4776deabc2cecaba91 (diff) | |
download | gsoc2013-evolution-1072bbd65915a892258d85bdb8190f025f4bfc66.tar gsoc2013-evolution-1072bbd65915a892258d85bdb8190f025f4bfc66.tar.gz gsoc2013-evolution-1072bbd65915a892258d85bdb8190f025f4bfc66.tar.bz2 gsoc2013-evolution-1072bbd65915a892258d85bdb8190f025f4bfc66.tar.lz gsoc2013-evolution-1072bbd65915a892258d85bdb8190f025f4bfc66.tar.xz gsoc2013-evolution-1072bbd65915a892258d85bdb8190f025f4bfc66.tar.zst gsoc2013-evolution-1072bbd65915a892258d85bdb8190f025f4bfc66.zip |
Add Reply-to-List bonobo verbs.
2001-06-14 Jeffrey Stedfast <fejj@ximian.com>
* folder-browser-factory.c: Add Reply-to-List bonobo verbs.
* folder-browser.c: Add Reply-to-List menu items.
* mail-callbacks.c (mail_reply): Use an enum for specifying the
reply mode, becaus enow we can reply-to-list.
(reply_to_list): Implement.
(reply_to_sender): Use REPLY_SENDER.
(reply_to_all): Use REPLY_ALL.
(mail_generate_reply): Handle the different modes.
svn path=/trunk/; revision=10232
-rw-r--r-- | mail/ChangeLog | 13 | ||||
-rw-r--r-- | mail/folder-browser-factory.c | 1 | ||||
-rw-r--r-- | mail/folder-browser.c | 2 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 93 | ||||
-rw-r--r-- | mail/mail-callbacks.h | 12 |
5 files changed, 97 insertions, 24 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index dd416e391a..dd2516f37f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,16 @@ +2001-06-14 Jeffrey Stedfast <fejj@ximian.com> + + * folder-browser-factory.c: Add Reply-to-List bonobo verbs. + + * folder-browser.c: Add Reply-to-List menu items. + + * mail-callbacks.c (mail_reply): Use an enum for specifying the + reply mode, becaus enow we can reply-to-list. + (reply_to_list): Implement. + (reply_to_sender): Use REPLY_SENDER. + (reply_to_all): Use REPLY_ALL. + (mail_generate_reply): Handle the different modes. + 2001-06-12 JP Rosevear <jpr@ximian.com> * Makefile.am: Remove folder-info.h until iain checks it in diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index 1ac9da34ed..d392eb6a95 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -77,6 +77,7 @@ BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("MessageOpen", open_message), BONOBO_UI_UNSAFE_VERB ("MessageReplyAll", reply_to_all), BONOBO_UI_UNSAFE_VERB ("MessageReplySender", reply_to_sender), + BONOBO_UI_UNSAFE_VERB ("MessageReplyList", reply_to_list), BONOBO_UI_UNSAFE_VERB ("MessageResend", resend_msg), BONOBO_UI_UNSAFE_VERB ("MessageSaveAs", save_msg), BONOBO_UI_UNSAFE_VERB ("MessageSearch", search_msg), diff --git a/mail/folder-browser.c b/mail/folder-browser.c index e29f406a67..1e70501b88 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -706,6 +706,8 @@ static EPopupMenu context_menu[] = { { N_("_Reply to Sender"), NULL, GTK_SIGNAL_FUNC (reply_to_sender), NULL, 0 }, + { N_("_Reply to _List"), NULL, + GTK_SIGNAL_FUNC (reply_to_list), NULL, 0 }, { N_("Reply to _All"), NULL, GTK_SIGNAL_FUNC (reply_to_all), NULL, 0 }, { N_("_Forward"), NULL, diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 448706bf41..f10b0f7d22 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -569,7 +569,7 @@ free_recipients (GList *list) } static EMsgComposer * -mail_generate_reply (CamelMimeMessage *message, gboolean to_all) +mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char *uid, int mode) { const CamelInternetAddress *reply_to, *sender, *to_addrs, *cc_addrs; const char *name = NULL, *address = NULL, *source = NULL; @@ -583,7 +583,7 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all) gchar *sig_file = NULL; time_t date; int offset; - + source = camel_mime_message_get_source (message); me = mail_config_get_account_by_source_url (source); @@ -611,24 +611,59 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all) /* Set the recipients */ accounts = mail_config_get_accounts (); - reply_to = camel_mime_message_get_reply_to (message); - if (!reply_to) - reply_to = camel_mime_message_get_from (message); - if (reply_to) { - /* Get the Reply-To address so we can ignore references to it in the Cc: list */ - camel_internet_address_get (reply_to, 0, NULL, &reply_addr); + if (mode == REPLY_LIST) { + CamelMessageInfo *info; + const char *mlist; + int i, max, len; - to = g_list_append (to, camel_address_format (CAMEL_ADDRESS (reply_to))); - } - - to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); - cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); - - if (to_all) { - cc = list_add_addresses (cc, to_addrs, accounts, &me, NULL); - cc = list_add_addresses (cc, cc_addrs, accounts, me ? NULL : &me, reply_addr); - } else if (me == NULL) { - me = guess_me (to_addrs, cc_addrs, accounts); + info = camel_folder_get_message_info (folder, uid); + mlist = camel_message_info_mlist (info); + + if (mlist) { + /* look through the recipients to find the *real* mailing list address */ + len = strlen (mlist); + + to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); + max = camel_address_length (CAMEL_ADDRESS (to_addrs)); + for (i = 0; i < max; i++) { + camel_internet_address_get (to_addrs, i, NULL, &address); + if (!g_strncasecmp (address, mlist, len)) + break; + } + + if (i == max) { + cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); + max = camel_address_length (CAMEL_ADDRESS (cc_addrs)); + for (i = 0; i < max; i++) { + camel_internet_address_get (cc_addrs, i, NULL, &address); + if (!g_strncasecmp (address, mlist, len)) + break; + } + } + + /* We only want to reply to the list address - if it even exists */ + to = address && i != max ? g_list_append (to, g_strdup (address)) : to; + } + } else { + reply_to = camel_mime_message_get_reply_to (message); + if (!reply_to) + reply_to = camel_mime_message_get_from (message); + if (reply_to) { + /* Get the Reply-To address so we can ignore references to it in the Cc: list */ + camel_internet_address_get (reply_to, 0, NULL, &reply_addr); + + to = g_list_append (to, camel_address_format (CAMEL_ADDRESS (reply_to))); + } + + to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); + cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); + + if (mode == REPLY_ALL) { + cc = list_add_addresses (cc, to_addrs, accounts, &me, NULL); + cc = list_add_addresses (cc, cc_addrs, accounts, me ? NULL : &me, reply_addr); + } else if (me == NULL) { + me = guess_me (to_addrs, cc_addrs, accounts); + } } /* Set the subject of the new message. */ @@ -670,7 +705,7 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all) } void -mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, gboolean to_all) +mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, int mode) { EMsgComposer *composer; struct post_send_data *psd; @@ -685,7 +720,7 @@ mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, gboolea psd->uid = g_strdup (uid); psd->flags = CAMEL_MESSAGE_ANSWERED; - composer = mail_generate_reply (msg, to_all); + composer = mail_generate_reply (folder, msg, uid, mode); if (!composer) return; @@ -709,7 +744,19 @@ reply_to_sender (GtkWidget *widget, gpointer user_data) return; mail_reply (fb->folder, fb->mail_display->current_message, - fb->message_list->cursor_uid, FALSE); + fb->message_list->cursor_uid, REPLY_SENDER); +} + +void +reply_to_list (GtkWidget *widget, gpointer user_data) +{ + FolderBrowser *fb = FOLDER_BROWSER (user_data); + + if (!check_send_configuration (fb)) + return; + + mail_reply (fb->folder, fb->mail_display->current_message, + fb->message_list->cursor_uid, REPLY_LIST); } void @@ -721,7 +768,7 @@ reply_to_all (GtkWidget *widget, gpointer user_data) return; mail_reply (fb->folder, fb->mail_display->current_message, - fb->message_list->cursor_uid, TRUE); + fb->message_list->cursor_uid, REPLY_ALL); } void diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h index b3184403e4..5f1e4228db 100644 --- a/mail/mail-callbacks.h +++ b/mail/mail-callbacks.h @@ -33,6 +33,13 @@ extern "C" { #pragma } #endif /* __cplusplus }*/ +/* these are the possible modes for replying */ +enum { + REPLY_SENDER, + REPLY_LIST, + REPLY_ALL +}; + void enumerate_msg (MessageList *ml, const char *uid, gpointer data); void fetch_mail (GtkWidget *widget, gpointer user_data); @@ -48,7 +55,9 @@ void forward_attached (GtkWidget *widget, gpointer user_data); void forward (GtkWidget *widget, gpointer user_data); void reply_to_sender (GtkWidget *widget, gpointer user_data); +void reply_to_list (GtkWidget *widget, gpointer user_data); void reply_to_all (GtkWidget *widget, gpointer user_data); + void delete_msg (GtkWidget *widget, gpointer user_data); void undelete_msg (GtkWidget *widget, gpointer user_data); void move_msg (GtkWidget *widget, gpointer user_data); @@ -90,7 +99,8 @@ void stop_threads (BonoboUIComponent *uih, void *user_data, const char void empty_trash (BonoboUIComponent *uih, void *user_data, const char *path); -void mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, gboolean to_all); +void mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, int mode); + void composer_send_cb (EMsgComposer *composer, gpointer data); void composer_postpone_cb (EMsgComposer *composer, gpointer data); |