From 4e56f6cc1120f2bd53a5b01dc2f42deac411d299 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 23 Dec 2009 14:56:10 +0100 Subject: Bug #372921 - Meeting invites sent from wrong email account --- calendar/gui/itip-utils.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'calendar/gui/itip-utils.c') diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 2f34d33663..05157f9e68 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -1206,7 +1206,7 @@ append_cal_attachments (EMsgComposer *composer, } static void -setup_from (ECalComponentItipMethod method, ECalComponent *comp, EComposerHeaderTable *table) +setup_from (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, EComposerHeaderTable *table) { EAccountList *accounts; @@ -1214,6 +1214,16 @@ setup_from (ECalComponentItipMethod method, ECalComponent *comp, EComposerHeader if (accounts) { EAccount *account = NULL; + /* always use organizer's email when user is an organizer */ + if (itip_organizer_is_user (comp, client)) { + ECalComponentOrganizer organizer = {0}; + + e_cal_component_get_organizer (comp, &organizer); + if (organizer.value != NULL) { + account = (EAccount *) e_account_list_find (accounts, E_ACCOUNT_FIND_ID_ADDRESS, itip_strip_mailto (organizer.value)); + } + } + if (!account) { gchar *from = comp_from (method, comp); @@ -1284,7 +1294,7 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp, composer = e_msg_composer_new (); table = e_msg_composer_get_header_table (composer); - setup_from (method, send_comp, table); + setup_from (method, send_comp, client, table); e_composer_header_table_set_subject (table, subject); e_composer_header_table_set_destinations_to (table, destinations); @@ -1386,7 +1396,7 @@ reply_to_calendar_comp (ECalComponentItipMethod method, composer = e_msg_composer_new (); table = e_msg_composer_get_header_table (composer); - setup_from (method, send_comp, table); + setup_from (method, send_comp, client, table); e_composer_header_table_set_subject (table, subject); e_composer_header_table_set_destinations_to (table, destinations); -- cgit v1.2.3