# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../ircp/dest_hotfix.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
# 
# More information can be found in the files COPYING and README.
# 
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---
diff -pruN ircp-0.3/src/ircp.c ircp-0.3_patch/src/ircp.c
--- ircp-0.3/src/ircp.c	2002-12-01 18:34:41.000000000 +0100
+++ ircp-0.3_patch/src/ircp.c	2004-05-27 10:23:01.008095904 +0200
@@ -72,10 +72,15 @@ int main(int argc, char *argv[])
 			return -1;
 		}
 
-		if(argc >= 3)
+		if(argc >= 3){
+			downloadpath = (char *)malloc(strlen(argv[2]+1));
+			sprintf(downloadpath, "%s", argv[2]);
 			inbox = argv[2];
-		else
+		} else {
+			downloadpath = (char *)malloc(2);
+			sprintf(downloadpath, ".");
 			inbox = ".";
+		}
 
 		ircp_srv_recv(srv, inbox);
 #ifdef DEBUG_TCP
diff -pruN ircp-0.3/src/ircp.h ircp-0.3_patch/src/ircp.h
--- ircp-0.3/src/ircp.h	2002-12-01 18:34:41.000000000 +0100
+++ ircp-0.3_patch/src/ircp.h	2004-05-27 10:21:24.422779104 +0200
@@ -22,6 +22,8 @@ enum {
 	IRCP_EV_RECEIVING,
 };
 
+char *downloadpath;
+
 /* Number of bytes passed at one time to OBEX */
 #define STREAM_CHUNK 4096
 
diff -pruN ircp-0.3/src/ircp_server.c ircp-0.3_patch/src/ircp_server.c
--- ircp-0.3/src/ircp_server.c	2002-12-01 18:34:41.000000000 +0100
+++ ircp-0.3_patch/src/ircp_server.c	2004-05-27 10:22:44.161656952 +0200
@@ -223,15 +223,19 @@ static int new_file(ircp_server_t *srv, 
 		}
 	}
 	if(name == NULL)	{
+#if 0
 		DEBUG(0, "Got a PUT without a name. Refusing\n");
 		/* Send back error */
 		OBEX_ObjectSetRsp(object, OBEX_RSP_BAD_REQUEST, OBEX_RSP_BAD_REQUEST);
 		srv->infocb(IRCP_EV_ERR, "");
 		goto out;
+#endif
+		name=(char *)malloc(28);
+		sprintf(name, "ircp_receive_i_have_no_name");
 	}
 
 	srv->infocb(IRCP_EV_RECEIVING, name);	
-	srv->fd = ircp_open_safe("", name);
+	srv->fd = ircp_open_safe(downloadpath, name);
 	
 	ret = srv->fd;