diff --git a/obexd/plugins/ebook.c b/obexd/plugins/ebook.c
index 5316bd8..96990ea 100644
--- a/obexd/plugins/ebook.c
+++ b/obexd/plugins/ebook.c
return 0;
}
+static int ebook_pullvcardlisting(struct phonebook_context *context,
+ gchar *objname, guint8 order, guint8 *searchval,
+ guint8 searchattrib, guint16 maxlistcount,
+ guint16 liststartoffset, guint16 *phonebooksize,
+ guint8 *newmissedcalls)
+{
+ EBook *book;
+ EBookQuery *query;
+
+ DBG("context %p", context);
+
+ phonebook_ref(context);
+
+ book = e_book_new_default_addressbook(NULL);
+
+ e_book_open(book, FALSE, NULL);
+
+ query = e_book_query_any_field_contains("");
+
+ e_book_async_get_contacts(book, query, ebooklist_cb, context);
+
+ return 0;
+}
+
static struct phonebook_driver ebook_driver = {
.name = "ebook",
.create = ebook_create,
.destroy = ebook_destroy,
.pullphonebook = ebook_pullphonebook,
+ .pullvcardlisting = ebook_pullvcardlisting,
};
static int ebook_init(void)
diff --git a/obexd/src/pbap.c b/obexd/src/pbap.c
index b7a3311..d9ebdb0 100644
--- a/obexd/src/pbap.c
+++ b/obexd/src/pbap.c
#include "logging.h"
#include "obex.h"
-#define PHONEBOOK_TYPE "x-bt/phonebook"
+#define PHONEBOOK_TYPE "x-bt/phonebook"
+#define VCARDLISTING_TYPE "x-bt/vcard-listing"
#define ORDER_TAG 0x01
#define SEARCHVALUE_TAG 0x02
newmissedcalls, addbody);
}
+static int pbap_pullvcardlisting(obex_t *obex, obex_object_t *obj,
+ gboolean *addbody)
+{
+ struct obex_session *session = OBEX_GetUserData(obex);
+ gchar *fullname;
+ struct apparam_field apparam;
+ guint8 newmissedcalls = 0;
+ guint16 phonebooksize = 0;
+ int err;
+
+ memset(&apparam, 0, sizeof(struct apparam_field));
+
+ err = pbap_parse_apparam_header(obex, obj, &apparam);
+ if (err < 0)
+ return err;
+
+ fullname = g_build_filename(session->current_folder,
+ session->name, NULL);
+ err = phonebook_pullvcardlisting(session->pbctx, fullname,
+ apparam.order, apparam.searchval,
+ apparam.searchattrib,
+ apparam.maxlistcount,
+ apparam.liststartoffset,
+ &phonebooksize, &newmissedcalls);
+ if (err < 0)
+ goto done;
+
+ g_free(fullname);
+
+ fullname = g_build_filename(session->current_folder, session->name,
+ NULL);
+ if (fullname != NULL)
+ fullname = g_strconcat(fullname, ".vcf", NULL);
+
+ err = pbap_add_result_apparam_header(obex, obj, apparam.maxlistcount,
+ fullname, phonebooksize,
+ newmissedcalls, addbody);
+
+done:
+ g_free(apparam.searchval);
+ g_free(fullname);
+ return err;
+}
+
void pbap_get(obex_t *obex, obex_object_t *obj)
{
struct obex_session *session = OBEX_GetUserData(obex);
if (g_str_equal(session->type, PHONEBOOK_TYPE) == TRUE)
err = pbap_pullphonebook(obex, obj, &addbody);
+ else if (g_str_equal(session->type, VCARDLISTING_TYPE) == TRUE)
+ err = pbap_pullvcardlisting(obex, obj, &addbody);
else
goto fail;
diff --git a/obexd/src/phonebook.c b/obexd/src/phonebook.c
index 874da7d..239fbaf 100644
--- a/obexd/src/phonebook.c
+++ b/obexd/src/phonebook.c
newmissedcalls);
}
+int phonebook_pullvcardlisting(struct phonebook_context *context,
+ gchar *objname, guint8 order, guint8 *searchval,
+ guint8 searchattrib, guint16 maxlistcount,
+ guint16 liststartoffset, guint16 *phonebooksize,
+ guint8 *newmissedcalls)
+{
+ if (!context->driver->pullvcardlisting)
+ return -1;
+
+ return context->driver->pullvcardlisting(context, objname, order,
+ searchval, searchattrib, maxlistcount,
+ liststartoffset, phonebooksize, newmissedcalls);
+}
+
/* if buf is NULL or size is 0, this indicate that no more result will
* be returned by PBAP plugin
* */
diff --git a/obexd/src/phonebook.h b/obexd/src/phonebook.h
index c334c05..311213c 100644
--- a/obexd/src/phonebook.h
+++ b/obexd/src/phonebook.h
gchar *objname, guint64 filter, guint8 format,
guint16 maxlistcount, guint16 liststartoffset,
guint16 *phonebooksize, guint8 *newmissedcalls);
+extern int phonebook_pullvcardlisting(struct phonebook_context *context,
+ gchar *objname, guint8 order, guint8 *searchval,
+ guint8 searchattrib, guint16 maxlistcount,
+ guint16 liststartoffset, guint16 *phonebooksize,
+ guint8 *newmissedcalls);
extern void phonebook_return(struct phonebook_context *context,
char *buf, int size);
gchar *objname, guint64 filter, guint8 format,
guint16 maxlistcount, guint16 liststartoffset,
guint16 *phonebooksize, guint8 *newmissedcalls);
- int (*pullvcardlisting) (struct phonebook_context *context);
+ int (*pullvcardlisting) (struct phonebook_context *context,
+ gchar *objname, guint8 order, guint8 *searchval,
+ guint8 searchattrib, guint16 maxlistcount,
+ guint16 liststartoffset, guint16 *phonebooksize,
+ guint8 *newmissedcalls);
int (*pullvcardentry) (struct phonebook_context *context);
};