diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-02-08 11:44:02 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-08 12:41:25 +0200 |
commit | 00b4314feb4613117be5fd9ea50406756d685b91 (patch) | |
tree | 9f463c21fbb66ed39c24a64302339b2e44f79a14 /client/session.c | |
parent | d143ae8fdf0ec3138fb9423d6b2554134bff7edc (diff) | |
download | obexd-00b4314feb4613117be5fd9ea50406756d685b91.tar.gz |
client: introduce obc_session_copy
Diffstat (limited to 'client/session.c')
-rw-r--r-- | client/session.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/client/session.c b/client/session.c index 2467e85..a78d061 100644 --- a/client/session.c +++ b/client/session.c @@ -1305,3 +1305,33 @@ guint obc_session_mkdir(struct obc_session *session, const char *folder, session->p = p; return p->id; } + +guint obc_session_copy(struct obc_session *session, const char *filename, + const char *destname, session_callback_t func, + void *user_data, GError **err) +{ + struct pending_request *p; + + if (session->obex == NULL) { + g_set_error(err, OBEX_IO_ERROR, OBEX_IO_DISCONNECTED, + "Session disconnected"); + return 0; + } + + if (session->p != NULL) { + g_set_error(err, OBEX_IO_ERROR, OBEX_IO_BUSY, "Session busy"); + return 0; + } + + p = pending_request_new(session, NULL, NULL, func, user_data); + + p->req_id = g_obex_copy(session->obex, filename, destname, async_cb, p, + err); + if (*err != NULL) { + pending_request_free(p); + return 0; + } + + session->p = p; + return p->id; +} |