From 514cc9d0bb0761412852d2f7d84fb2434aa42a40 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 8 Feb 2012 11:44:04 +0200 Subject: [PATCH] obexd: introduce obc_session_delete --- obexd/client/session.c | 29 +++++++++++++++++++++++++++++ obexd/client/session.h | 3 +++ 2 files changed, 32 insertions(+) diff --git a/obexd/client/session.c b/obexd/client/session.c index dfc912d31..7e7dea626 100644 --- a/obexd/client/session.c +++ b/obexd/client/session.c @@ -1365,3 +1365,32 @@ guint obc_session_move(struct obc_session *session, const char *filename, session->p = p; return p->id; } + +guint obc_session_delete(struct obc_session *session, const char *file, + 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_delete(session->obex, file, 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 64548e930..ac5c27a59 100644 --- a/obexd/client/session.h +++ b/obexd/client/session.h @@ -86,3 +86,6 @@ guint obc_session_copy(struct obc_session *session, const char *filename, guint obc_session_move(struct obc_session *session, const char *filename, const char *destname, session_callback_t func, void *user_data, GError **err); +guint obc_session_delete(struct obc_session *session, const char *file, + session_callback_t func, void *user_data, + GError **err); -- 2.47.3