[evolution] Bug #342935 - Do not choose disabled accounts for meeting requests



commit 6df525477e6bbee76f53a989f51f8aace6cd58cf
Author: Milan Crha <mcrha redhat com>
Date:   Wed Dec 23 15:23:46 2009 +0100

    Bug #342935 - Do not choose disabled accounts for meeting requests

 calendar/gui/itip-utils.c |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 05157f9..7f1e078 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -1205,6 +1205,35 @@ append_cal_attachments (EMsgComposer *composer,
 	g_slist_free (attach_list);
 }
 
+static EAccount *
+find_enabled_account (EAccountList *accounts, const gchar *id_address)
+{
+	EIterator *it;
+	EAccount *account = NULL;
+
+	g_return_val_if_fail (accounts != NULL, NULL);
+
+	if (!id_address)
+		return NULL;
+
+	for (it = e_list_get_iterator ((EList *)accounts);
+	     e_iterator_is_valid (it);
+	     e_iterator_next (it)) {
+		account = (EAccount *)e_iterator_get (it);
+
+		if (account
+		    && account->enabled
+		    && account->id
+		    && account->id->address
+		    && g_ascii_strcasecmp (account->id->address, id_address) == 0)
+			break;
+
+		account = NULL;
+	}
+
+	return account;
+}
+
 static void
 setup_from (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, EComposerHeaderTable *table)
 {
@@ -1220,7 +1249,7 @@ setup_from (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, E
 
 			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));
+				account = find_enabled_account (accounts, itip_strip_mailto (organizer.value));
 			}
 		}
 
@@ -1228,7 +1257,7 @@ setup_from (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, E
 			gchar *from = comp_from (method, comp);
 
 			if (from)
-				account = (EAccount *) e_account_list_find (accounts, E_ACCOUNT_FIND_ID_ADDRESS, from);
+				account = find_enabled_account (accounts, from);
 
 			g_free (from);
 		}



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