aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorRathin <rathinusa@yahoo.co.in>2011-06-14 20:26:30 +0800
committerMilan Crha <mcrha@redhat.com>2011-06-14 20:26:30 +0800
commitf5794eff3613afe5082ab15bd6dbb14806ce5fdc (patch)
tree375f309c21bea171d89bbeb1252c4038ba0bde58 /mail
parentde9b1685edf197281c14ce9c1ae8f384866ff0b2 (diff)
downloadgsoc2013-evolution-f5794eff3613afe5082ab15bd6dbb14806ce5fdc.tar.gz
gsoc2013-evolution-f5794eff3613afe5082ab15bd6dbb14806ce5fdc.tar.zst
gsoc2013-evolution-f5794eff3613afe5082ab15bd6dbb14806ce5fdc.zip
Bug #530335 - Allow Reply to selected address only
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-display.c8
-rw-r--r--mail/e-mail-enums.h1
-rw-r--r--mail/e-mail-reader-utils.c34
-rw-r--r--mail/e-mail-reader.c14
-rw-r--r--mail/em-composer-utils.c34
-rw-r--r--mail/em-composer-utils.h3
6 files changed, 90 insertions, 4 deletions
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index ed88fec808..aa3c4bd3d2 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -48,6 +48,7 @@ static const gchar *ui =
" <popup name='context'>"
" <placeholder name='custom-actions-1'>"
" <menuitem action='add-to-address-book'/>"
+" <menuitem action='send-reply'/>"
" </placeholder>"
" <placeholder name='custom-actions-3'>"
" <menu action='search-folder-menu'>"
@@ -81,6 +82,13 @@ static GtkActionEntry mailto_entries[] = {
NULL, /* XXX Add a tooltip! */
NULL /* Handled by EMailReader */ },
+ { "send-reply",
+ NULL,
+ N_("Send _Reply To..."),
+ NULL,
+ N_("Send a reply message to this address"),
+ NULL /* Handled by EMailReader */ },
+
/*** Menus ***/
{ "search-folder-menu",
diff --git a/mail/e-mail-enums.h b/mail/e-mail-enums.h
index 1e2e4a2865..e0ad3ad86f 100644
--- a/mail/e-mail-enums.h
+++ b/mail/e-mail-enums.h
@@ -63,6 +63,7 @@ typedef enum {
typedef enum {
E_MAIL_REPLY_TO_SENDER,
+ E_MAIL_REPLY_TO_RECIPIENT,
E_MAIL_REPLY_TO_FROM,
E_MAIL_REPLY_TO_ALL,
E_MAIL_REPLY_TO_LIST
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 178b6aefcf..fe4e406688 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -787,6 +787,7 @@ e_mail_reader_reply_to_message (EMailReader *reader,
EMFormatHTML *formatter;
GtkWidget *message_list;
CamelMimeMessage *new_message;
+ CamelInternetAddress *address = NULL;
CamelFolder *folder;
EMailReplyStyle reply_style;
EWebView *web_view;
@@ -812,6 +813,29 @@ e_mail_reader_reply_to_message (EMailReader *reader,
web_view = em_format_html_get_web_view (formatter);
+ if (reply_type == E_MAIL_REPLY_TO_RECIPIENT) {
+ const gchar *uri;
+
+ uri = e_web_view_get_selected_uri (web_view);
+
+ if (uri) {
+ CamelURL *curl;
+
+ curl = camel_url_new (uri, NULL);
+
+ if (curl && curl->path && *curl->path) {
+ address = camel_internet_address_new ();
+ if (camel_address_decode (CAMEL_ADDRESS (address), curl->path) < 0) {
+ g_object_unref (address);
+ address = NULL;
+ }
+ }
+
+ if (curl)
+ camel_url_free (curl);
+ }
+ }
+
uid = MESSAGE_LIST (message_list)->cursor_uid;
g_return_if_fail (uid != NULL);
@@ -859,7 +883,10 @@ e_mail_reader_reply_to_message (EMailReader *reader,
em_utils_reply_to_message (
shell, new_message, folder, uid,
- reply_type, reply_style, NULL);
+ reply_type, reply_style, NULL, address);
+
+ if (address)
+ g_object_unref (address);
g_object_unref (new_message);
@@ -870,7 +897,10 @@ e_mail_reader_reply_to_message (EMailReader *reader,
whole_message:
em_utils_reply_to_message (
shell, src_message, folder, uid,
- reply_type, reply_style, EM_FORMAT (formatter));
+ reply_type, reply_style, EM_FORMAT (formatter), address);
+
+ if (address)
+ g_object_unref (address);
}
static void
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 9d32ddb335..313e0f5acc 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -1502,6 +1502,14 @@ action_mail_reply_sender_cb (GtkAction *action,
}
static void
+action_mail_reply_recipient_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_reply_to_message (reader, NULL, E_MAIL_REPLY_TO_RECIPIENT);
+ check_close_browser_reader (reader);
+}
+
+static void
action_mail_save_as_cb (GtkAction *action,
EMailReader *reader)
{
@@ -3513,6 +3521,12 @@ e_mail_reader_init (EMailReader *reader,
action, "activate",
G_CALLBACK (action_add_to_address_book_cb), reader);
+ action_name = "send-reply";
+ action = e_web_view_get_action (web_view, action_name);
+ g_signal_connect (
+ action, "activate",
+ G_CALLBACK (action_mail_reply_recipient_cb), reader);
+
action_name = "search-folder-recipient";
action = e_web_view_get_action (web_view, action_name);
g_signal_connect (
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 841fb77d6b..2dcc6872af 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -2389,6 +2389,30 @@ get_reply_from (CamelMimeMessage *message,
}
static void
+get_reply_recipient (CamelMimeMessage *message,
+ CamelInternetAddress *to,
+ CamelNNTPAddress *postto,
+ CamelInternetAddress *address)
+{
+ const gchar *name, *addr, *posthdr;
+ gint i;
+
+ /* check whether there is a 'Newsgroups: ' header in there */
+ if (postto
+ && ((posthdr = camel_medium_get_header((CamelMedium *)message, "Followup-To"))
+ || (posthdr = camel_medium_get_header((CamelMedium *)message, "Newsgroups")))) {
+ camel_address_decode ((CamelAddress *)postto, posthdr);
+ return;
+ }
+
+ if (address) {
+ for (i = 0; camel_internet_address_get (address, i, &name, &addr); i++)
+ camel_internet_address_add (to, name, addr);
+ }
+
+}
+
+static void
concat_unique_addrs (CamelInternetAddress *dest,
CamelInternetAddress *src,
GHashTable *rcpt_hash)
@@ -2792,6 +2816,7 @@ em_utils_construct_composer_text (CamelMimeMessage *message, EMFormat *source)
* @type: the type of reply to create
* @style: the reply style to use
* @source: source to inherit view settings from
+ * @address: used for E_MAIL_REPLY_TO_RECIPIENT @type
*
* Creates a new composer ready to reply to @message.
*
@@ -2805,7 +2830,8 @@ em_utils_reply_to_message (EShell *shell,
const gchar *message_uid,
EMailReplyType type,
EMailReplyStyle style,
- EMFormat *source)
+ EMFormat *source,
+ CamelInternetAddress *address)
{
CamelInternetAddress *to, *cc;
CamelNNTPAddress *postto = NULL;
@@ -2829,6 +2855,12 @@ em_utils_reply_to_message (EShell *shell,
get_reply_from (message, to, postto);
break;
+ case E_MAIL_REPLY_TO_RECIPIENT:
+ if (folder)
+ postto = camel_nntp_address_new ();
+
+ get_reply_recipient (message, to, postto, address);
+ break;
case E_MAIL_REPLY_TO_SENDER:
if (folder)
postto = camel_nntp_address_new ();
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index be76148764..59b6e16d60 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -81,7 +81,8 @@ EMsgComposer * em_utils_reply_to_message (EShell *shell,
const gchar *message_uid,
EMailReplyType type,
EMailReplyStyle style,
- EMFormat *source);
+ EMFormat *source,
+ CamelInternetAddress *address);
EDestination ** em_utils_camel_address_to_destination
(CamelInternetAddress *iaddr);
void em_configure_new_composer (EMsgComposer *composer);