diff options
Diffstat (limited to 'obexd')
-rw-r--r-- | obexd/client/map.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/obexd/client/map.c b/obexd/client/map.c index 131b14058..e1f95f1ed 100644 --- a/obexd/client/map.c +++ b/obexd/client/map.c @@ -103,6 +103,7 @@ struct map_data { struct pending_request { struct map_data *map; DBusMessage *msg; + char *folder; }; #define MAP_MSG_FLAG_PRIORITY 0x01 @@ -154,6 +155,7 @@ static void pending_request_free(struct pending_request *p) { dbus_message_unref(p->msg); + g_free(p->folder); g_free(p); } @@ -1098,8 +1100,7 @@ static void msg_element(GMarkupParseContext *ctxt, const char *element, msg = g_hash_table_lookup(data->messages, values[i]); if (msg == NULL) { - msg = map_msg_create(data, values[i], - obc_session_get_folder(data->session)); + msg = map_msg_create(data, values[i], parser->request->folder); if (msg == NULL) return; } @@ -1195,6 +1196,18 @@ done: pending_request_free(request); } +static char *get_absolute_folder(struct map_data *map, const char *subfolder) +{ + const char *root = obc_session_get_folder(map->session); + + if (!subfolder || strlen(subfolder) == 0) + return g_strdup(root); + else if (g_str_has_suffix(root, "/")) + return g_strconcat(root, subfolder, NULL); + else + return g_strconcat(root, "/", subfolder, NULL); +} + static DBusMessage *get_message_listing(struct map_data *map, DBusMessage *message, const char *folder, @@ -1214,6 +1227,7 @@ static DBusMessage *get_message_listing(struct map_data *map, obc_transfer_set_apparam(transfer, apparam); request = pending_request_new(map, message); + request->folder = get_absolute_folder(map, folder); if (!obc_session_queue(map->session, transfer, message_listing_cb, request, &err)) { |