aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/bbdb/bbdb.c
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 /plugins/bbdb/bbdb.c
parent85cd845179f02502d981b7db0d7c1abd52956a1e (diff)
downloadgsoc2013-evolution-294bcbac434e16e91b43b1f6c9c7da5bb5d7030f.tar
gsoc2013-evolution-294bcbac434e16e91b43b1f6c9c7da5bb5d7030f.tar.gz
gsoc2013-evolution-294bcbac434e16e91b43b1f6c9c7da5bb5d7030f.tar.bz2
gsoc2013-evolution-294bcbac434e16e91b43b1f6c9c7da5bb5d7030f.tar.lz
gsoc2013-evolution-294bcbac434e16e91b43b1f6c9c7da5bb5d7030f.tar.xz
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
Diffstat (limited to 'plugins/bbdb/bbdb.c')
-rw-r--r--plugins/bbdb/bbdb.c28
1 files changed, 20 insertions, 8 deletions
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);
}
+
+
+