summaryrefslogtreecommitdiff
path: root/client/session.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-02-08 11:44:03 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-08 12:41:27 +0200
commit59d667b53c284b4ea0e4926f9f64b64ba82c952a (patch)
tree0b189c913683219cbf737ee564ac9edc97cecf43 /client/session.c
parent00b4314feb4613117be5fd9ea50406756d685b91 (diff)
downloadobexd-59d667b53c284b4ea0e4926f9f64b64ba82c952a.tar.gz
client: introduce obc_session_move
Diffstat (limited to 'client/session.c')
-rw-r--r--client/session.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/client/session.c b/client/session.c
index a78d061..dfc912d 100644
--- a/client/session.c
+++ b/client/session.c
@@ -1335,3 +1335,33 @@ guint obc_session_copy(struct obc_session *session, const char *filename,
session->p = p;
return p->id;
}
+
+guint obc_session_move(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_move(session->obex, filename, destname, async_cb, p,
+ err);
+ if (*err != NULL) {
+ pending_request_free(p);
+ return 0;
+ }
+
+ session->p = p;
+ return p->id;
+}