diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-07-03 21:28:13 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-07-18 15:12:47 +0300 |
commit | 1fa53fa596e8df8c12afef8e9842d30d14a2129b (patch) | |
tree | 25cc9d80076dd25b473803e52412612641f1f91f /client | |
parent | b30ce7febd8476b0526e742fcba3800d52ec2dd6 (diff) | |
download | obexd-1fa53fa596e8df8c12afef8e9842d30d14a2129b.tar.gz |
client: Add Message.Get implementation
Diffstat (limited to 'client')
-rw-r--r-- | client/map.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/client/map.c b/client/map.c index 4137dbe..e606cb2 100644 --- a/client/map.c +++ b/client/map.c @@ -252,7 +252,44 @@ static void map_msg_free(void *data) g_free(msg); } +static DBusMessage *map_msg_get(DBusConnection *connection, + DBusMessage *message, void *user_data) +{ + struct map_msg *msg = user_data; + struct obc_transfer *transfer; + const char *target_file; + GError *err = NULL; + DBusMessage *reply; + + if (dbus_message_get_args(message, NULL, + DBUS_TYPE_STRING, &target_file, + DBUS_TYPE_INVALID) == FALSE) + return g_dbus_create_error(message, + ERROR_INTERFACE ".InvalidArguments", NULL); + + transfer = obc_transfer_get("x-bt/message", msg->handle, target_file, + &err); + if (transfer == NULL) + goto fail; + + if (!obc_session_queue(msg->data->session, transfer, NULL, NULL, &err)) + goto fail; + + return obc_transfer_create_dbus_reply(transfer, message); + +fail: + reply = g_dbus_create_error(message, ERROR_INTERFACE ".Failed", "%s", + err->message); + g_error_free(err); + return reply; +} + static const GDBusMethodTable map_msg_methods[] = { + { GDBUS_METHOD("Get", + GDBUS_ARGS({ "targetfile", "s" }), + GDBUS_ARGS({ "transfer", "o" }, + { "properties", "a{sv}" }), + map_msg_get) }, { } }; |