Diff between 4f805f5e09f37c3bb62190410b18e69fa344fabb and 352a849348816cca2b7c5b0b87d27677d1d5bf48

Changed Files

File Additions Deletions Status
obexd/plugins/pbap.c +15 -8 modified
obexd/plugins/phonebook-dummy.c +12 -0 modified
obexd/plugins/phonebook-ebook.c +12 -0 modified
obexd/plugins/phonebook.h +6 -0 modified

Full Patch

diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index fc0eabe..f72a7f7 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -401,6 +401,8 @@ static gpointer vobject_open(const char *name, int oflag, mode_t mode,
 		gpointer context, size_t *size, int *err)
 {
 	struct pbap_session *pbap = context;
+	const gchar *type = obex_get_type(pbap->os);
+	phonebook_cb cb;
 	int ret;
 
 	if (oflag != O_RDONLY) {
@@ -408,16 +410,21 @@ static gpointer vobject_open(const char *name, int oflag, mode_t mode,
 		goto fail;
 	}
 
-	/*
-	 * Zero means that the PCE wants to know the number of used indexes in
-	 * the phone book of interest. PSE shall ignore all other application
-	 * parameter that may be present in the request.
-	 */
 	if (pbap->params->maxlistcount == 0)
-		ret = phonebook_pull(name, pbap->params,
-				phonebook_size_result, pbap);
+		cb = phonebook_size_result;
 	else
-		ret = phonebook_pull(name, pbap->params, query_result, pbap);
+		cb = query_result;
+
+	if (g_strcmp0(type, "x-bt/phonebook") == 0)
+		ret = phonebook_pull(name, pbap->params, cb, pbap);
+	else if (g_strcmp0(type, "x-bt/vcard-listing") == 0)
+		ret = phonebook_list(name, pbap->params, cb, pbap);
+	else if (g_strcmp0(type, "x-bt/vcard") == 0)
+		ret = phonebook_get_entry(name, pbap->params, query_result, pbap);
+	else {
+		ret = -EINVAL;
+		goto fail;
+	}
 
 	if (ret < 0)
 		goto fail;
diff --git a/obexd/plugins/phonebook-dummy.c b/obexd/plugins/phonebook-dummy.c
index 8bff79d..b44bb94 100644
--- a/obexd/plugins/phonebook-dummy.c
+++ b/obexd/plugins/phonebook-dummy.c
@@ -84,3 +84,15 @@ int phonebook_pull(const gchar *name, const struct apparam_field *params,
 			dummy_result, dummy, g_free);
 	return 0;
 }
+
+int phonebook_get_entry(const gchar *name, const struct apparam_field *params,
+		phonebook_cb cb, gpointer user_data)
+{
+	return -1;
+}
+
+int phonebook_list(const gchar *name, const struct apparam_field *params,
+		phonebook_cb cb, gpointer user_data)
+{
+	return -1;
+}
diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c
index f36180d..a31f8e0 100644
--- a/obexd/plugins/phonebook-ebook.c
+++ b/obexd/plugins/phonebook-ebook.c
@@ -261,3 +261,15 @@ gint phonebook_pull(const gchar *name, const struct apparam_field *params,
 
 	return 0;
 }
+
+int phonebook_get_entry(const gchar *name, const struct apparam_field *params,
+		phonebook_cb cb, gpointer user_data)
+{
+	return -1;
+}
+
+int phonebook_list(const gchar *name, const struct apparam_field *params,
+		phonebook_cb cb, gpointer user_data)
+{
+	return -1;
+}
diff --git a/obexd/plugins/phonebook.h b/obexd/plugins/phonebook.h
index 9eaf095..b0878fb 100644
--- a/obexd/plugins/phonebook.h
+++ b/obexd/plugins/phonebook.h
@@ -47,3 +47,9 @@ int phonebook_set_folder(const gchar *current_folder,
 
 int phonebook_pull(const gchar *name, const struct apparam_field *params,
 		phonebook_cb cb, gpointer user_data);
+
+int phonebook_get_entry(const gchar *name, const struct apparam_field *params,
+		phonebook_cb cb, gpointer user_data);
+
+int phonebook_list(const gchar *name, const struct apparam_field *params,
+		phonebook_cb cb, gpointer user_data);