[evolution-patches] [addressbook] Patch for Bug #312554



Hi,

When adding/modifying a contact list comparison for email addresses is
not required because an email address can be in multiple contact lists
and secondly it doesn't let you add an email address to a contact list
if the email address is there in a contact. 
Earlier it was working because of the bug in comparing emails. 
 
-->Comparing EContactName is also not required as it has no relevance in
case of Contact Lists.

Thanks
Devashish
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1975
diff -u -p -r1.1975 ChangeLog
--- ChangeLog	9 Aug 2005 22:40:59 -0000	1.1975
+++ ChangeLog	11 Aug 2005 07:31:35 -0000
@@ -1,3 +1,14 @@
+2005-08-11  Devashish Sharma <sdevashish novell com>
+
+	* gui/merging/eab-contact-compare.c (use_common_book_cb): When
+	adding/modifying a contact list there is no neeed to check if the
+	emails in the list are there in existing contact lists or contacts.
+	Also there is no need for comparing EContactName in case of contact
+	list. Added a condition to check this.
+	(eab_contact_compare): Added a check to skip email comparison in case
+	of contact list.
+	Fixes #312554.
+	
 2005-08-10  Tor Lillqvist  <tml novell com>
 
 	* importers/Makefile.am: Use privsolib instead of privlib (no
Index: eab-contact-compare.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/merging/eab-contact-compare.c,v
retrieving revision 1.8
diff -u -p -r1.8 eab-contact-compare.c
--- eab-contact-compare.c	29 Sep 2004 19:20:11 -0000	1.8
+++ eab-contact-compare.c	11 Aug 2005 07:33:57 -0000
@@ -559,11 +559,13 @@ eab_contact_compare (EContact *contact1,
 	g_return_val_if_fail (contact2 && E_IS_CONTACT (contact2), EAB_CONTACT_MATCH_NOT_APPLICABLE);
 
 	result = EAB_CONTACT_MATCH_NONE;
-	result = combine_comparisons (result, eab_contact_compare_name      (contact1, contact2));
-	result = combine_comparisons (result, eab_contact_compare_nickname  (contact1, contact2));
-	result = combine_comparisons (result, eab_contact_compare_email     (contact1, contact2));
-	result = combine_comparisons (result, eab_contact_compare_address   (contact1, contact2));
-	result = combine_comparisons (result, eab_contact_compare_telephone (contact1, contact2));
+	if(!(GPOINTER_TO_INT(e_contact_get(contact1, E_CONTACT_IS_LIST)))) {
+		result = combine_comparisons (result, eab_contact_compare_name      (contact1, contact2));
+		result = combine_comparisons (result, eab_contact_compare_nickname  (contact1, contact2));
+		result = combine_comparisons (result, eab_contact_compare_email     (contact1, contact2));
+		result = combine_comparisons (result, eab_contact_compare_address   (contact1, contact2));
+		result = combine_comparisons (result, eab_contact_compare_telephone (contact1, contact2));
+	}
 	result = combine_comparisons (result, eab_contact_compare_file_as   (contact1, contact2));
 
 	return result;
@@ -680,41 +682,43 @@ use_common_book_cb (EBook *book, gpointe
 		g_free (contact_file_as);
 	}
 
-	contact_name = e_contact_get (contact, E_CONTACT_NAME);
-	if (contact_name) {
-		if (contact_name->given && *contact_name->given)
-			query_parts[p++] = g_strdup_printf ("(contains \"full_name\" \"%s\")", contact_name->given);
-
-		if (contact_name->additional && *contact_name->additional)
-			query_parts[p++] = g_strdup_printf ("(contains \"full_name\" \"%s\")", contact_name->additional);
-
-		if (contact_name->family && *contact_name->family)
-			query_parts[p++] = g_strdup_printf ("(contains \"full_name\" \"%s\")", contact_name->family);
-
-		e_contact_name_free (contact_name);
-	}
-
-	contact_email = e_contact_get (contact, E_CONTACT_EMAIL);
-	if (contact_email) {
-		GList *iter;
-		for (iter = contact_email; iter && p < MAX_QUERY_PARTS; iter = iter->next) {
-			gchar *addr = g_strdup (iter->data);
-			if (addr && *addr) {
-				gchar *s = addr;
-				while (*s) {
-					if (*s == '@') {
-						*s = '\0';
-						break;
+	if(!(GPOINTER_TO_INT(e_contact_get(contact, E_CONTACT_IS_LIST)))) {
+		contact_name = e_contact_get (contact, E_CONTACT_NAME);
+		if (contact_name) {
+			if (contact_name->given && *contact_name->given)
+				query_parts[p++] = g_strdup_printf ("(contains \"full_name\" \"%s\")", contact_name->given);
+
+			if (contact_name->additional && *contact_name->additional)
+				query_parts[p++] = g_strdup_printf ("(contains \"full_name\" \"%s\")", contact_name->additional);
+	
+			if (contact_name->family && *contact_name->family)
+				query_parts[p++] = g_strdup_printf ("(contains \"full_name\" \"%s\")", contact_name->family);
+
+			e_contact_name_free (contact_name);
+		}
+	
+		contact_email = e_contact_get (contact, E_CONTACT_EMAIL);
+		if (contact_email) {
+			GList *iter;
+			for (iter = contact_email; iter && p < MAX_QUERY_PARTS; iter = iter->next) {
+				gchar *addr = g_strdup (iter->data);
+				if (addr && *addr) {
+					gchar *s = addr;
+					while (*s) {
+						if (*s == '@') {
+							*s = '\0';
+							break;
+						}
+						++s;
 					}
-					++s;
+					query_parts[p++] = g_strdup_printf ("(beginswith \"email\" \"%s\")", addr);
+					g_free (addr);
 				}
-				query_parts[p++] = g_strdup_printf ("(beginswith \"email\" \"%s\")", addr);
-				g_free (addr);
 			}
 		}
+		g_list_foreach (contact_email, (GFunc)g_free, NULL);
+		g_list_free (contact_email);
 	}
-	g_list_foreach (contact_email, (GFunc)g_free, NULL);
-	g_list_free (contact_email);
 	
 	
 	/* Build up our full query from the parts. */


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