[evolution] Bug #655551 - [mail-to-task] Pick organizer based on selected folder's store



commit 857505c202eb9d4567b681808d311dd7f0dd7d0f
Author: Milan Crha <mcrha redhat com>
Date:   Fri Aug 26 11:24:49 2011 +0200

    Bug #655551 - [mail-to-task] Pick organizer based on selected folder's store

 plugins/mail-to-task/mail-to-task.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index 56da9ef..ddcd132 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -308,14 +308,21 @@ set_description (ECalComponent *comp, CamelMimeMessage *message)
 }
 
 static gchar *
-set_organizer (ECalComponent *comp)
+set_organizer (ECalComponent *comp, CamelFolder *folder)
 {
-	EAccount *account;
+	EAccount *account = NULL;
 	const gchar *str, *name;
 	ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL};
 	gchar *res;
 
-	account = e_get_default_account ();
+	if (folder) {
+		CamelStore *store = camel_folder_get_parent_store (folder);
+
+		account = e_get_account_by_uid (camel_service_get_uid (CAMEL_SERVICE (store)));
+	}
+
+	if (!account)
+		account = e_get_default_account ();
 	if (!account)
 		return NULL;
 
@@ -894,7 +901,7 @@ do_mail_to_event (AsyncData *data)
 				gchar *organizer;
 
 				/* set actual user as organizer, to be able to change event's properties */
-				organizer = set_organizer (comp);
+				organizer = set_organizer (comp, data->folder);
 				set_attendees (comp, message, organizer);
 				g_free (organizer);
 			}



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