aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNat Friedman <nat@novell.com>2004-10-23 16:21:26 +0800
committerNat Friedman <nat@src.gnome.org>2004-10-23 16:21:26 +0800
commit294bcbac434e16e91b43b1f6c9c7da5bb5d7030f (patch)
tree7a1ac0404f808e2925d0bea13b0e17549e0ae055
parent85cd845179f02502d981b7db0d7c1abd52956a1e (diff)
downloadgsoc2013-evolution-294bcbac434e16e91b43b1f6c9c7da5bb5d7030f.tar.gz
gsoc2013-evolution-294bcbac434e16e91b43b1f6c9c7da5bb5d7030f.tar.zst
gsoc2013-evolution-294bcbac434e16e91b43b1f6c9c7da5bb5d7030f.zip
Change assertions to if statements, so as not to issue warnings in the
2004-10-23 Nat Friedman <nat@novell.com> * bbdb.c (bbdb_do_it): Change assertions to if statements, so as not to issue warnings in the case of routine failures (name is NULL). Don't add an email to a contact if the appropriate contact is ambiguous. svn path=/trunk/; revision=27703
-rw-r--r--plugins/bbdb/ChangeLog7
-rw-r--r--plugins/bbdb/bbdb.c28
-rw-r--r--plugins/bbdb/org-gnome-evolution-bbdb.eplug.in2
3 files changed, 28 insertions, 9 deletions
diff --git a/plugins/bbdb/ChangeLog b/plugins/bbdb/ChangeLog
index 4f0f84b82d..d471940c29 100644
--- a/plugins/bbdb/ChangeLog
+++ b/plugins/bbdb/ChangeLog
@@ -1,3 +1,10 @@
+2004-10-23 Nat Friedman <nat@novell.com>
+
+ * bbdb.c (bbdb_do_it): Change assertions to if statements, so as
+ not to issue warnings in the case of routine failures (name
+ is NULL). Don't add an email to a contact if the appropriate
+ contact is ambiguous.
+
2004-10-22 Nat Friedman <nat@novell.com>
* Initial checkin.
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index 87d728c231..bc1b2cc4fe 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -117,6 +117,7 @@ bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target)
bbdb_do_it (book, name, email);
}
+ /* If this is a reply-all event, process To: and Cc: also. */
if (((EEventTarget *) target)->mask & EM_EVENT_MESSAGE_REPLY_ALL) {
g_object_unref (G_OBJECT (book));
return;
@@ -148,12 +149,16 @@ bbdb_do_it (EBook *book, const char *name, const char *email)
gboolean status;
GError *error = NULL;
- g_return_if_fail (name != NULL);
- g_return_if_fail (email != NULL);
g_return_if_fail (book != NULL);
- g_return_if_fail (strcmp (name, ""));
- g_return_if_fail (strcmp (email, ""));
- g_return_if_fail (strchr (email, '@') != NULL);
+
+ if (name == NULL || email == NULL)
+ return;
+
+ if (! strcmp (name, "") || ! strcmp (email, ""))
+ return;
+
+ if (strchr (email, '@') == NULL)
+ return;
/* If any contacts exists with this email address, don't do anything */
query_string = g_strdup_printf ("(contains \"email\" \"%s\")", email);
@@ -161,10 +166,8 @@ bbdb_do_it (EBook *book, const char *name, const char *email)
g_free (query_string);
status = e_book_get_contacts (book, query, &contacts, NULL);
- if (contacts != NULL) {
- g_warning ("bbdb: contact exists, bailing\n");
+ if (contacts != NULL)
return;
- }
/* If a contact exists with this name, add the email address to it. */
query_string = g_strdup_printf ("(is \"full_name\" \"%s\")", name);
@@ -173,6 +176,12 @@ bbdb_do_it (EBook *book, const char *name, const char *email)
status = e_book_get_contacts (book, query, &contacts, NULL);
if (contacts != NULL) {
+
+ /* If there's more than one contact with this name,
+ just give up; we're not smart enough for this. */
+ if (contacts->next != NULL)
+ return;
+
contact = (EContact *) contacts->data;
add_email_to_contact (contact, email);
if (! e_book_commit_contact (book, contact, &error))
@@ -326,3 +335,6 @@ cleanup_cb (GObject *o, gpointer data)
g_object_unref (stuff->source_list);
g_free (stuff);
}
+
+
+
diff --git a/plugins/bbdb/org-gnome-evolution-bbdb.eplug.in b/plugins/bbdb/org-gnome-evolution-bbdb.eplug.in
index b2b0b1cb63..a70abdfb13 100644
--- a/plugins/bbdb/org-gnome-evolution-bbdb.eplug.in
+++ b/plugins/bbdb/org-gnome-evolution-bbdb.eplug.in
@@ -17,4 +17,4 @@
</hook>
</e-plugin>
-</e-plugin-list> \ No newline at end of file
+</e-plugin-list>