[evolution] Bug #372921 - Meeting invites sent from wrong email account



commit 4e56f6cc1120f2bd53a5b01dc2f42deac411d299
Author: Milan Crha <mcrha redhat com>
Date:   Wed Dec 23 14:56:10 2009 +0100

    Bug #372921 - Meeting invites sent from wrong email account

 calendar/gui/itip-utils.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 2f34d33..05157f9 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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]