diff options
author | Mikel Astiz <mikel.astiz@bmw-carit.de> | 2012-03-07 15:50:27 +0100 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-03-08 18:00:48 -0600 |
commit | bafec432070762b1c0db437b85d35bc7cfa68dcd (patch) | |
tree | 643b44474853950547394dc976973716ca833710 /client/session.c | |
parent | 419ed1f6e9e6102e18817c1006466f64b8261af3 (diff) | |
download | obexd-bafec432070762b1c0db437b85d35bc7cfa68dcd.tar.gz |
client: fix naming convention in transfer api
The terms can be quite misleading, so this patch proposes to follow the
terminology in the D-Bus api:
- Name: the remote name of the object being transferred
- Filename: the name of the file in local the filesystem
Both values can be NULL independently.
This fixes the problem of using the terms differently in get and put
operations. The result was that the properties "Name" and "Filename" were
swapped in D-Bus in the case of get.
Once the fields map to obex fields, the interpretation of the response
from the agent becomes more complicated. Depending on the transfer type,
either the name or the filename field must be updated.
Diffstat (limited to 'client/session.c')
-rw-r--r-- | client/session.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/client/session.c b/client/session.c index 57a5b06..28fae03 100644 --- a/client/session.c +++ b/client/session.c @@ -685,8 +685,12 @@ static void session_request_reply(DBusPendingCall *call, gpointer user_data) DBG("Agent.Request() reply: %s", name); - if (strlen(name)) - obc_transfer_set_name(transfer, name); + if (strlen(name)) { + if (p->auth_complete == session_prepare_put) + obc_transfer_set_name(transfer, name); + else + obc_transfer_set_filename(transfer, name); + } if (p->auth_complete) p->auth_complete(session, transfer); @@ -955,8 +959,8 @@ int obc_session_get(struct obc_session *session, const char *type, agent = NULL; transfer = obc_transfer_register(session->conn, session->obex, - agent, filename, - targetname, type, + agent, targetname, + filename, type, params); if (transfer == NULL) { if (params != NULL) { @@ -1015,8 +1019,8 @@ int obc_session_pull(struct obc_session *session, agent = NULL; transfer = obc_transfer_register(session->conn, session->obex, - agent, NULL, - filename, type, + agent, filename, + NULL, type, NULL); if (transfer == NULL) { return -EIO; |