aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-07-02 13:24:44 +0800
committerChris Toshok <toshok@src.gnome.org>2001-07-02 13:24:44 +0800
commitd10adfea7a903356ccf15161955325a83ebd9863 (patch)
tree18306fb1abc01a1e675729abd0cfad9b7026f7de /addressbook/backend/ebook
parent353946a818a6e373773cdfcad543e9d6b65f042d (diff)
downloadgsoc2013-evolution-d10adfea7a903356ccf15161955325a83ebd9863.tar
gsoc2013-evolution-d10adfea7a903356ccf15161955325a83ebd9863.tar.gz
gsoc2013-evolution-d10adfea7a903356ccf15161955325a83ebd9863.tar.bz2
gsoc2013-evolution-d10adfea7a903356ccf15161955325a83ebd9863.tar.lz
gsoc2013-evolution-d10adfea7a903356ccf15161955325a83ebd9863.tar.xz
gsoc2013-evolution-d10adfea7a903356ccf15161955325a83ebd9863.tar.zst
gsoc2013-evolution-d10adfea7a903356ccf15161955325a83ebd9863.zip
use ECARD_UID_LINK_PREFIX.
2001-07-01 Chris Toshok <toshok@ximian.com> * gui/contact-list-editor/e-contact-list-editor.c (fill_in_info): use ECARD_UID_LINK_PREFIX. * gui/contact-list-editor/e-contact-list-model.c (e_contact_list_model_get_email): use ECARD_UID_LINK_PREFIX. * backend/ebook/e-destination.h: add prototype for e_destination_importv_list. * backend/ebook/e-destination.c (e_destination_importv_list): new function, take an ECard corresponding to an address list and resolve any linked cards, returning an EDestination vector. * backend/ebook/e-card.h (ECARD_UID_LINK_PREFIX): #define this here, since we need to use it in a few places. svn path=/trunk/; revision=10667
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r--addressbook/backend/ebook/e-card.h2
-rw-r--r--addressbook/backend/ebook/e-destination.c49
-rw-r--r--addressbook/backend/ebook/e-destination.h1
3 files changed, 52 insertions, 0 deletions
diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h
index d54d4c95fe..fa448704a5 100644
--- a/addressbook/backend/ebook/e-card.h
+++ b/addressbook/backend/ebook/e-card.h
@@ -125,6 +125,8 @@ float e_card_get_use_score (ECard
void e_card_touch (ECard *card);
/* Evolution List convenience functions */
+/* used for encoding uids in email addresses */
+#define ECARD_UID_LINK_PREFIX "|X-EVOLUTION-UID="
gboolean e_card_evolution_list (ECard *card);
gboolean e_card_evolution_list_show_addresses(ECard *card);
diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c
index 172afb6da6..4a1d2992cb 100644
--- a/addressbook/backend/ebook/e-destination.c
+++ b/addressbook/backend/ebook/e-destination.c
@@ -729,6 +729,55 @@ e_destination_importv (const gchar *str)
return destv;
}
+EDestination **
+e_destination_importv_list (EBook *book, ECard *list)
+{
+ EList *email_list;
+ EIterator *email_iter;
+ EDestination **destv;
+ gint j = 0;
+
+ if (!e_card_evolution_list (list))
+ return NULL;
+
+ gtk_object_get (GTK_OBJECT(list),
+ "email", &email_list,
+ NULL);
+
+ destv = g_new0 (EDestination *, e_list_length (email_list) +1);
+
+ email_iter = e_list_get_iterator (email_list);
+
+ while (e_iterator_is_valid (email_iter)) {
+ const char *email = e_iterator_get (email_iter);
+
+ if (!strncmp (email, ECARD_UID_LINK_PREFIX, strlen (ECARD_UID_LINK_PREFIX))) {
+ /* it's a serialized uid */
+ ECard *card;
+ const char *uid;
+ uid = email + strlen (ECARD_UID_LINK_PREFIX);
+ card = e_book_get_card (book, uid);
+ if (card) {
+ EDestination *dest = e_destination_new ();
+ e_destination_set_card (dest, card, 0);
+ gtk_object_unref (GTK_OBJECT (card)); /* XXX ? */
+ destv[j++] = dest;
+ }
+ }
+ else {
+ /* it's an email address */
+ EDestination *dest = e_destination_new();
+ dest->priv->string_email = g_strdup (email);
+
+ if (dest) {
+ destv[j++] = dest;
+ }
+ }
+ }
+
+ return destv;
+}
+
static void
touch_cb (EBook *book, const gchar *addr, ECard *card, gpointer closure)
{
diff --git a/addressbook/backend/ebook/e-destination.h b/addressbook/backend/ebook/e-destination.h
index bacd9dd428..85edf594be 100644
--- a/addressbook/backend/ebook/e-destination.h
+++ b/addressbook/backend/ebook/e-destination.h
@@ -92,6 +92,7 @@ EDestination *e_destination_import (const gchar *str);
gchar *e_destination_exportv (EDestination **);
EDestination **e_destination_importv (const gchar *str);
+EDestination **e_destination_importv_list (EBook *book, ECard *list);
void e_destination_touch (EDestination *);