[evolution/gnome-2-28] Bug #603480 - [bbdb] Traverse lists in destinations properly



commit 1699254d7f96516b6c58f811ccece891f070d872
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 19 16:43:36 2010 +0100

    Bug #603480 - [bbdb] Traverse lists in destinations properly

 plugins/bbdb/bbdb.c |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index 7360e34..e3aa44f 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -230,19 +230,35 @@ bbdb_do_thread (const gchar *name, const gchar *email)
 static void
 walk_destinations_and_free (EDestination **dests)
 {
+	const gchar *name, *addr;
 	gint i;
 
 	if (!dests)
 		return;
 
 	for (i = 0; dests[i] != NULL; i++) {
-		const gchar *name, *addr;
+		if (e_destination_is_evolution_list (dests[i])) {
+			const GList *members;
 
-		name = e_destination_get_name (dests[i]);
-		addr = e_destination_get_email (dests[i]);
+			for (members = e_destination_list_get_dests (dests[i]); members; members = members->next) {
+				const EDestination *member = members->data;
 
-		if (name || addr)
-			bbdb_do_thread (name, addr);
+				if (!member)
+					continue;
+
+				name = e_destination_get_name (member);
+				addr = e_destination_get_email (member);
+
+				if (name || addr)
+					bbdb_do_thread (name, addr);
+			}
+		} else {
+			name = e_destination_get_name (dests[i]);
+			addr = e_destination_get_email (dests[i]);
+
+			if (name || addr)
+				bbdb_do_thread (name, addr);
+		}
 	}
 
 	e_destination_freev (dests);



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