summaryrefslogtreecommitdiff
path: root/obexd/plugins
diff options
context:
space:
mode:
authorBiman Paul <biman.paul@samsung.com>2016-06-30 19:36:40 +0530
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-09-05 12:22:46 +0300
commit2322e2cc9cc5f8506e4b28aa2799727e498201cf (patch)
tree9d85bfc882efed462c3283693456f55774d30ec0 /obexd/plugins
parentb1d0c3bc51b8fb6043f10e412ef1c4aec6a2ce58 (diff)
downloadbluez-2322e2cc9cc5f8506e4b28aa2799727e498201cf.tar.gz
obexd/pbap: clear cache if name header is present
Remote device is not able to fetch call logs from different folder. It always returns the call logs requested in first request. Considering a situation to fetch from och and then from cch, there are two ways to request x-bt/vcard-listing: Case I: 1. SetPhoneBook to /telecom/och (absolute path) 2. PullvCardListing with name header '' (empty) Remote devices using this method always calls SetPhoneBook with absolute path to set the path and we clear the cache when new path is set. Case II: 1. SetPhoneBook to /telecom (relative path) 2. PullvCardListing with name header 'och' Remote devices using this method calls SetPhoneBook with '/telecom' only once and cache is not cleared when second PullvCardListing is made with name header. This results in cached incorrect list sent to remote device. Clear cache if name header is present would prevent sending of cache list as it is not present. Instead it would request to create new cache based on new name header.
Diffstat (limited to 'obexd/plugins')
-rw-r--r--obexd/plugins/pbap.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index bab691c3f..ad9320876 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -543,13 +543,18 @@ static int pbap_get(struct obex_session *os, void *user_data)
} else if (g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) {
/* Always relative */
- if (!name || strlen(name) == 0)
+ if (!name || strlen(name) == 0) {
/* Current folder */
path = g_strdup(pbap->folder);
- else
+ } else {
/* Current folder + relative path */
path = g_build_filename(pbap->folder, name, NULL);
+ /* clear cache */
+ pbap->cache.valid = FALSE;
+ pbap->cache.index = 0;
+ cache_clear(&pbap->cache);
+ }
} else if (g_ascii_strcasecmp(type, VCARDENTRY_TYPE) == 0) {
/* File name only */
path = g_strdup(name);