diff options
Diffstat (limited to 'addressbook/backend')
-rw-r--r-- | addressbook/backend/ebook/e-card.c | 4 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-destination.c | 38 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-destination.h | 1 |
3 files changed, 41 insertions, 2 deletions
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index 725fedaa11..57619b0080 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -4055,8 +4055,8 @@ e_card_list_send (GList *cards, ECardDisposition disposition) recipient->address = CORBA_string_dup (addr ? addr : ""); if (free_name_addr) { - g_free (name); - g_free (addr); + g_free ((gchar *) name); + g_free ((gchar *) addr); } /* If this isn't a list, we quit after the first (i.e. the default) address. */ diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c index 5776f2c253..9e0e4b6067 100644 --- a/addressbook/backend/ebook/e-destination.c +++ b/addressbook/backend/ebook/e-destination.c @@ -303,6 +303,44 @@ e_destination_is_empty (const EDestination *dest) || (p->list_dests != NULL)); } +gboolean +e_destination_equal (const EDestination *a, const EDestination *b) +{ + const struct _EDestinationPrivate *pa, *pb; + const gchar *na, *nb; + + g_return_val_if_fail (E_IS_DESTINATION (a), FALSE); + g_return_val_if_fail (E_IS_DESTINATION (b), FALSE); + + if (a == b) + return TRUE; + + pa = a->priv; + pb = b->priv; + + /* Check equality of cards. */ + if (pa->card || pb->card) { + if (! (pa->card && pb->card)) + return FALSE; + + if (pa->card == pb->card || !strcmp (e_card_get_id (pa->card), e_card_get_id (pb->card))) + return TRUE; + + return FALSE; + } + + /* Just in case name returns NULL */ + na = e_destination_get_name (a); + nb = e_destination_get_name (b); + if ((na || nb) && !(na && nb && !strcmp (na, nb))) + return FALSE; + + if (!strcmp (e_destination_get_email (a), e_destination_get_email (b))) + return TRUE; + + return FALSE; +} + void e_destination_set_card (EDestination *dest, ECard *card, gint email_num) { diff --git a/addressbook/backend/ebook/e-destination.h b/addressbook/backend/ebook/e-destination.h index c0ab60d33f..b9b06c47ff 100644 --- a/addressbook/backend/ebook/e-destination.h +++ b/addressbook/backend/ebook/e-destination.h @@ -68,6 +68,7 @@ EDestination *e_destination_copy (const EDestination *); void e_destination_clear (EDestination *); gboolean e_destination_is_empty (const EDestination *); +gboolean e_destination_equal (const EDestination *a, const EDestination *b); void e_destination_set_card (EDestination *, ECard *card, gint email_num); void e_destination_set_book_uri (EDestination *, const gchar *uri); |