aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/ebook/e-book.c37
-rw-r--r--addressbook/backend/ebook/e-book.h2
-rw-r--r--addressbook/backend/ebook/test-client.c28
3 files changed, 66 insertions, 1 deletions
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index 65ea7a595d..873aa77805 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -522,6 +522,43 @@ e_book_get_static_capabilities (EBook *book)
return ret_val;
}
+EList *
+e_book_get_supported_fields (EBook *book)
+{
+ CORBA_Environment ev;
+ GNOME_Evolution_Addressbook_stringlist *stringlist;
+ EList *list;
+ int i;
+
+ CORBA_exception_init (&ev);
+
+ if (book->priv->load_state != URILoaded) {
+ g_warning ("e_book_unload_uri: No URI is loaded!\n");
+ return NULL;
+ }
+
+ stringlist = GNOME_Evolution_Addressbook_Book_getSupportedFields(book->priv->corba_book, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("e_book_get_supported_fields: Exception "
+ "during get_supported_fields!\n");
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ list = e_list_new ((EListCopyFunc)g_strdup, (EListFreeFunc)g_free, NULL);
+
+ for (i = 0; i < stringlist->_length; i ++) {
+ e_list_append (list, g_strdup (stringlist->_buffer[i]));
+ }
+
+ CORBA_free (stringlist);
+
+ CORBA_exception_free (&ev);
+
+ return list;
+}
+
static gboolean
e_book_construct (EBook *book)
{
diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h
index 7dd0917d37..244baeb331 100644
--- a/addressbook/backend/ebook/e-book.h
+++ b/addressbook/backend/ebook/e-book.h
@@ -59,6 +59,8 @@ gboolean e_book_load_uri (EBook *book,
void e_book_unload_uri (EBook *book);
char *e_book_get_static_capabilities (EBook *book);
+EList *e_book_get_supported_fields (EBook *book);
+
/* User authentication. */
void e_book_authenticate_user (EBook *book,
const char *user,
diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c
index acbeedac41..556517026d 100644
--- a/addressbook/backend/ebook/test-client.c
+++ b/addressbook/backend/ebook/test-client.c
@@ -89,11 +89,37 @@ add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
}
static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
+auth_user_cb (EBook *book, EBookStatus status, gpointer closure)
{
+ EList *fields;
+
+ printf ("user authenticated\n");
+
+ fields = e_book_get_supported_fields (book);
+ if (fields) {
+ EIterator *iter = e_list_get_iterator (fields);
+
+ printf ("Supported fields:\n");
+
+ for (; e_iterator_is_valid (iter); e_iterator_next (iter)) {
+ printf (" %s\n", (char*)e_iterator_get (iter));
+ }
+
+ gtk_object_unref(GTK_OBJECT(fields));
+ }
+ else {
+ printf ("No supported fields?\n");
+ }
+
e_book_add_vcard(book, cardstr, add_card_cb, NULL);
}
+static void
+book_open_cb (EBook *book, EBookStatus status, gpointer closure)
+{
+ e_book_authenticate_user (book, "username", "password", auth_user_cb, NULL);
+}
+
static guint
ebook_create (void)
{