Diff between aa38bd05293f1d90d65c5096d490de37d2d1a0d3 and 5c1c3c5d1157354ce937ba0a61b5e2503e8b9182

Changed Files

File Additions Deletions Status
obexd/client/session.c +30 -0 modified
obexd/client/session.h +3 -0 modified

Full Patch

diff --git a/obexd/client/session.c b/obexd/client/session.c
index 2467e85..a78d061 100644
--- a/obexd/client/session.c
+++ b/obexd/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;
+}
diff --git a/obexd/client/session.h b/obexd/client/session.h
index a424054..57f3fcd 100644
--- a/obexd/client/session.h
+++ b/obexd/client/session.h
@@ -80,3 +80,6 @@ guint obc_session_setpath(struct obc_session *session, const char *path,
 guint obc_session_mkdir(struct obc_session *session, const char *folder,
 				session_callback_t func, void *user_data,
 				GError **err);
+guint obc_session_copy(struct obc_session *session, const char *filename,
+				const char *destname, session_callback_t func,
+				void *user_data, GError **err);