From d951a60f705e5bf1fc5e2c683155579c2a662486 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Mon, 9 Jul 2007 11:12:07 +0000 Subject: reviewed by: Veerapuram Varadhan 2007-07-09 Chenthill Palanisamy reviewed by: Veerapuram Varadhan * exchange-delegates-user.c: (map_to_full_role_name), (em_utils_delegates_done), (exchange_delegates_user_edit): * exchange-delegates-user.h: * exchange-delegates.c: (add_button_clicked_cb), (edit_button_clicked_cb), (email_look_up), (table_click_cb): * exchange-delegates.glade: * exchange-delegates.h: * exchange-mail-send-options.c: (append_to_header): * exchange-send-options.c: (exchange_send_options_get_widgets_data), (get_widgets), (exchange_send_options_fill_widgets_with_data), (exchange_send_options_cb), (delegate_option_toggled), (addressbook_dialog_response), (addressbook_entry_changed), (address_button_clicked), (exchange_sendoptions_dialog_run), (exchange_sendoptions_dialog_init): * exchange-send-options.glade: * exchange-send-options.h: * org-gnome-exchange-operations.error.xml: Added the exchange delegation support. Committing on behalf of Bharath Acharya svn path=/trunk/; revision=33784 --- .../exchange-mail-send-options.c | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'plugins/exchange-operations/exchange-mail-send-options.c') diff --git a/plugins/exchange-operations/exchange-mail-send-options.c b/plugins/exchange-operations/exchange-mail-send-options.c index 1a5f7f38f5..3fe9d7f4c1 100644 --- a/plugins/exchange-operations/exchange-mail-send-options.c +++ b/plugins/exchange-operations/exchange-mail-send-options.c @@ -26,9 +26,11 @@ #include #include +#include #include "mail/em-event.h" #include "composer/e-msg-composer.h" +#include "composer/e-msg-composer-hdrs.h" #include "libedataserver/e-account.h" #include "exchange-send-options.h" @@ -41,6 +43,10 @@ static void append_to_header (ExchangeSendOptionsDialog *dialog, gint state, gpointer data) { EMsgComposer *composer; + EMsgComposerHdrs *hdrs; + CamelInternetAddress *sender_address; + const char *sender_id, *recipient_id; + composer = (EMsgComposer *)data; if (state == GTK_RESPONSE_OK) { if (dialog->options->importance) { @@ -77,6 +83,44 @@ append_to_header (ExchangeSendOptionsDialog *dialog, gint state, gpointer data) } else e_msg_composer_remove_header (composer, "Sensitivity"); + + hdrs = e_msg_composer_get_hdrs (composer); + sender_address = (CamelAddress *) e_msg_composer_hdrs_get_from (hdrs); + sender_id = (const char*) camel_address_encode (sender_address); + + struct _camel_header_address *addr = camel_header_address_decode ( + dialog->options->delegate_address, NULL); + + struct _camel_header_address *sender_addr = camel_header_address_decode ( + sender_id, NULL); + + if(dialog->options->send_as_del_enabled && + dialog->options->delegate_address && + g_ascii_strcasecmp(addr->v.addr, sender_addr->v.addr)) { + + e_msg_composer_modify_header (composer, "Sender" , sender_id); + + /* This block handles the case wherein the address to be added + * in the "From" field has no name associated with it. + * So for cases where there is no name we append the address + * (only email) within angular braces. + */ + if(!g_ascii_strcasecmp (addr->name, "")) { + recipient_id = g_strdup_printf ("<%s>", + dialog->options->delegate_address); + e_msg_composer_add_header (composer, "From", recipient_id); + } + + else + e_msg_composer_add_header (composer, "From", + dialog->options->delegate_address); + } + + + else { + e_msg_composer_remove_header (composer, "Sender"); + e_msg_composer_add_header (composer, "From", sender_id); + } if (dialog->options->delivery_enabled) { EMsgComposerHdrs *hdrs = e_msg_composer_get_hdrs(composer); -- cgit