All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH obexd 1/3] client: add FileTransfer.MoveFile implementation
@ 2011-08-12 12:46 Luiz Augusto von Dentz
  2011-08-12 12:46 ` [PATCH obexd 2/3] client: add FileTransfer.CopyFile implementation Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2011-08-12 12:46 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 client/ftp.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/client/ftp.c b/client/ftp.c
index e81d443..4c04eda 100644
--- a/client/ftp.c
+++ b/client/ftp.c
@@ -316,6 +316,25 @@ static DBusMessage *copy_file(DBusConnection *connection,
 static DBusMessage *move_file(DBusConnection *connection,
 				DBusMessage *message, void *user_data)
 {
+	struct ftp_data *ftp = user_data;
+	struct obc_session *session = ftp->session;
+	GwObex *obex = obc_session_get_obex(session);
+	const char *filename, *destname;
+	int err;
+
+	if (dbus_message_get_args(message, NULL,
+				DBUS_TYPE_STRING, &filename,
+				DBUS_TYPE_STRING, &destname,
+				DBUS_TYPE_INVALID) == FALSE)
+		return g_dbus_create_error(message,
+				"org.openobex.Error.InvalidArguments", NULL);
+
+	if (gw_obex_move(obex, filename, destname, &err) == FALSE) {
+		return g_dbus_create_error(message,
+				"org.openobex.Error.Failed",
+				"%s", OBEX_ResponseToString(err));
+	}
+
 	return dbus_message_new_method_return(message);
 }
 
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH obexd 2/3] client: add FileTransfer.CopyFile implementation
  2011-08-12 12:46 [PATCH obexd 1/3] client: add FileTransfer.MoveFile implementation Luiz Augusto von Dentz
@ 2011-08-12 12:46 ` Luiz Augusto von Dentz
  2011-08-12 12:46 ` [PATCH obexd 3/3] Add move and copy support to ftp-client Luiz Augusto von Dentz
  2011-08-22  7:37 ` [PATCH obexd 1/3] client: add FileTransfer.MoveFile implementation Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2011-08-12 12:46 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 client/ftp.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/client/ftp.c b/client/ftp.c
index 4c04eda..87116cc 100644
--- a/client/ftp.c
+++ b/client/ftp.c
@@ -310,6 +310,25 @@ static DBusMessage *put_file(DBusConnection *connection,
 static DBusMessage *copy_file(DBusConnection *connection,
 				DBusMessage *message, void *user_data)
 {
+	struct ftp_data *ftp = user_data;
+	struct obc_session *session = ftp->session;
+	GwObex *obex = obc_session_get_obex(session);
+	const char *filename, *destname;
+	int err;
+
+	if (dbus_message_get_args(message, NULL,
+				DBUS_TYPE_STRING, &filename,
+				DBUS_TYPE_STRING, &destname,
+				DBUS_TYPE_INVALID) == FALSE)
+		return g_dbus_create_error(message,
+				"org.openobex.Error.InvalidArguments", NULL);
+
+	if (gw_obex_copy(obex, filename, destname, &err) == FALSE) {
+		return g_dbus_create_error(message,
+				"org.openobex.Error.Failed",
+				"%s", OBEX_ResponseToString(err));
+	}
+
 	return dbus_message_new_method_return(message);
 }
 
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH obexd 3/3] Add move and copy support to ftp-client
  2011-08-12 12:46 [PATCH obexd 1/3] client: add FileTransfer.MoveFile implementation Luiz Augusto von Dentz
  2011-08-12 12:46 ` [PATCH obexd 2/3] client: add FileTransfer.CopyFile implementation Luiz Augusto von Dentz
@ 2011-08-12 12:46 ` Luiz Augusto von Dentz
  2011-08-22  7:37 ` [PATCH obexd 1/3] client: add FileTransfer.MoveFile implementation Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2011-08-12 12:46 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 test/ftp-client |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/test/ftp-client b/test/ftp-client
index 4cb4ee5..9bc038d 100755
--- a/test/ftp-client
+++ b/test/ftp-client
@@ -56,6 +56,12 @@ def parse_options():
                       help="Get FILE", metavar="FILE")
     parser.add_option("-p", "--put", dest="put_file",
                       help="Put FILE", metavar="FILE")
+    parser.add_option("-y", "--copy", dest="copy_file",
+                      help="Copy FILE", metavar="FILE")
+    parser.add_option("-m", "--move", dest="move_file",
+                      help="Move FILE", metavar="FILE")
+    parser.add_option("-n", "--destname", dest="dest_file",
+                      help="Destination FILE", metavar="FILE")
     parser.add_option("-r", "--remove", dest="remove_file",
                       help="Remove FILE", metavar="FILE")
     parser.add_option("-v", "--verbose", action="store_true", dest="verbose")
@@ -96,6 +102,18 @@ def remove_file(session, filename):
                     reply_handler=void_reply,
                     error_handler=error)
 
+def move_file(session, filename, destname):
+    session.MoveFile(filename,
+                    destname,
+                    reply_handler=void_reply,
+                    error_handler=error)
+
+def copy_file(session, filename, destname):
+    session.CopyFile(filename,
+                    destname,
+                    reply_handler=void_reply,
+                    error_handler=error)
+
 if  __name__ == '__main__':
 
     dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -140,6 +158,12 @@ if  __name__ == '__main__':
     if options.put_file:
         put_file(ftp, options.put_file)
 
+    if options.move_file:
+        move_file(ftp, options.move_file, options.dest_file)
+
+    if options.copy_file:
+        copy_file(ftp, options.copy_file, options.dest_file)
+
     if options.remove_file:
        remove_file(ftp, options.remove_file)
 
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH obexd 1/3] client: add FileTransfer.MoveFile implementation
  2011-08-12 12:46 [PATCH obexd 1/3] client: add FileTransfer.MoveFile implementation Luiz Augusto von Dentz
  2011-08-12 12:46 ` [PATCH obexd 2/3] client: add FileTransfer.CopyFile implementation Luiz Augusto von Dentz
  2011-08-12 12:46 ` [PATCH obexd 3/3] Add move and copy support to ftp-client Luiz Augusto von Dentz
@ 2011-08-22  7:37 ` Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2011-08-22  7:37 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Fri, Aug 12, 2011, Luiz Augusto von Dentz wrote:
> ---
>  client/ftp.c |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)

Thanks, all three patches have been applied (after a couple of small
coding-style fixes to the first two).

Johan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-22  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-12 12:46 [PATCH obexd 1/3] client: add FileTransfer.MoveFile implementation Luiz Augusto von Dentz
2011-08-12 12:46 ` [PATCH obexd 2/3] client: add FileTransfer.CopyFile implementation Luiz Augusto von Dentz
2011-08-12 12:46 ` [PATCH obexd 3/3] Add move and copy support to ftp-client Luiz Augusto von Dentz
2011-08-22  7:37 ` [PATCH obexd 1/3] client: add FileTransfer.MoveFile implementation Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.