aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog18
-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
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c4
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-model.c2
6 files changed, 73 insertions, 3 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index dfeff026e9..070ff12651 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,21 @@
+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.
+
2001-07-02 Christopher James Lahey <clahey@ximian.com>
* backend/ebook/e-card.c, backend/ebook/e-card.h: Added
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 *);
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index bff82c2f2b..86e283f0f6 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -804,11 +804,11 @@ fill_in_info(EContactListEditor *editor)
while (e_iterator_is_valid (email_iter)) {
const char *email = e_iterator_get (email_iter);
- if (!strncmp (email, "X-EVOLUTION-UID=", strlen ("X-EVOLUTION-UID"))) {
+ if (!strncmp (email, ECARD_UID_LINK_PREFIX, strlen (ECARD_UID_LINK_PREFIX))) {
ECard *card;
const char *uid;
/* it's a serialized uid */
- uid = email + strlen ("X-EVOLUTION-UID=");
+ uid = email + strlen (ECARD_UID_LINK_PREFIX);
card = e_book_get_card (editor->book, uid);
if (card) {
ECardSimple *simple = e_card_simple_new (card);
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c
index 4e5a336e07..5a966c67d1 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-model.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-model.c
@@ -267,5 +267,5 @@ e_contact_list_model_get_email (EContactListModel *model, int row)
if (data->type == E_CONTACT_LIST_MODEL_ROW_EMAIL)
return g_strdup (data->string);
else
- return g_strconcat ("|X-EVOLUTION-UID=", e_card_simple_get_id (data->simple), NULL);
+ return g_strconcat (ECARD_UID_LINK_PREFIX, e_card_simple_get_id (data->simple), NULL);
}