aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/bbdb
diff options
context:
space:
mode:
authorSushma Rai <rsushma@src.gnome.org>2005-04-11 14:35:07 +0800
committerSushma Rai <rsushma@src.gnome.org>2005-04-11 14:35:07 +0800
commitd3f30c99aa21aebda88ed8eaac8f36be1dffd257 (patch)
treefd23605377a5547affbf9d55d92b71cb46c021e9 /plugins/bbdb
parent78e838a2663c0db964e5e913ca92b8e6425e4e43 (diff)
downloadgsoc2013-evolution-d3f30c99aa21aebda88ed8eaac8f36be1dffd257.tar
gsoc2013-evolution-d3f30c99aa21aebda88ed8eaac8f36be1dffd257.tar.gz
gsoc2013-evolution-d3f30c99aa21aebda88ed8eaac8f36be1dffd257.tar.bz2
gsoc2013-evolution-d3f30c99aa21aebda88ed8eaac8f36be1dffd257.tar.lz
gsoc2013-evolution-d3f30c99aa21aebda88ed8eaac8f36be1dffd257.tar.xz
gsoc2013-evolution-d3f30c99aa21aebda88ed8eaac8f36be1dffd257.tar.zst
gsoc2013-evolution-d3f30c99aa21aebda88ed8eaac8f36be1dffd257.zip
Checking for the NULL query, also fixed some other minor issues. Fixes #74366
svn path=/trunk/; revision=29202
Diffstat (limited to 'plugins/bbdb')
-rw-r--r--plugins/bbdb/ChangeLog8
-rw-r--r--plugins/bbdb/bbdb.c30
2 files changed, 27 insertions, 11 deletions
diff --git a/plugins/bbdb/ChangeLog b/plugins/bbdb/ChangeLog
index aaf7f806d4..6fe150d98e 100644
--- a/plugins/bbdb/ChangeLog
+++ b/plugins/bbdb/ChangeLog
@@ -1,3 +1,11 @@
+2005-04-07 Sushma Rai <rsushma@novell.com>
+
+ * bbdb.c (bbdb_handle_reply): Check for camel_internet_address_get()
+ return value and initialize name and e-mail variables inside the loop.
+ (bbdb_do_it): Check for query being NULL. Fixes #74366.
+ Free list of contacts before returning, on finding multiple contacts
+ with the same name.
+
2005-04-05 Not Zed <NotZed@Ximian.com>
* bbdb.c (bbdb_handle_reply): noop if we can't open the book/we're
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index ef58ff9fc8..c8dcaf7edb 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -106,8 +106,6 @@ void
bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target)
{
const CamelInternetAddress *cia;
- const char *name;
- const char *email;
EBook *book = NULL;
int i;
@@ -117,8 +115,10 @@ bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target)
return;
cia = camel_mime_message_get_from (target->message);
- for (i = 0; i < camel_address_length CAMEL_ADDRESS (cia); i ++) {
- camel_internet_address_get (cia, i, &name, &email);
+ for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) {
+ const char *name=NULL, *email=NULL;
+ if (!(camel_internet_address_get (cia, i, &name, &email)))
+ continue;
bbdb_do_it (book, name, email);
}
@@ -129,14 +129,18 @@ bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target)
}
cia = camel_mime_message_get_recipients (target->message, CAMEL_RECIPIENT_TYPE_TO);
- for (i = 0; i < camel_address_length CAMEL_ADDRESS (cia); i ++) {
- camel_internet_address_get (cia, i, &name, &email);
+ for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) {
+ const char *name=NULL, *email=NULL;
+ if (!(camel_internet_address_get (cia, i, &name, &email)))
+ continue;
bbdb_do_it (book, name, email);
}
cia = camel_mime_message_get_recipients (target->message, CAMEL_RECIPIENT_TYPE_CC);
- for (i = 0; i < camel_address_length CAMEL_ADDRESS (cia); i ++) {
- camel_internet_address_get (cia, i, &name, &email);
+ for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) {
+ const char *name=NULL, *email=NULL;
+ if (!(camel_internet_address_get (cia, i, &name, &email)))
+ continue;
bbdb_do_it (book, name, email);
}
@@ -171,9 +175,9 @@ bbdb_do_it (EBook *book, const char *name, const char *email)
g_free (query_string);
status = e_book_get_contacts (book, query, &contacts, NULL);
- e_book_query_unref (query);
+ if (query)
+ e_book_query_unref (query);
if (contacts != NULL) {
- GList *l;
for (l = contacts; l != NULL; l = l->next)
g_object_unref ((GObject *)l->data);
g_list_free (contacts);
@@ -187,13 +191,17 @@ bbdb_do_it (EBook *book, const char *name, const char *email)
g_free (query_string);
status = e_book_get_contacts (book, query, &contacts, NULL);
- e_book_query_unref (query);
+ if (query)
+ e_book_query_unref (query);
if (contacts != NULL) {
/* FIXME: If there's more than one contact with this
name, just give up; we're not smart enough for
this. */
if (contacts->next != NULL) {
+ for (l = contacts; l != NULL; l = l->next)
+ g_object_unref ((GObject *)l->data);
+ g_list_free (contacts);
return;
}