changeset 3621:e9f66d245253

[gaim-migrate @ 3742] Give a totsize of -1 if you want the filesize to be unknown upon asking. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Thu, 10 Oct 2002 05:57:07 +0000
parents 8856bb4b284e
children 2ef75915a13c
files src/ft.c
diffstat 1 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ft.c	Wed Oct 09 16:31:33 2002 +0000
+++ b/src/ft.c	Thu Oct 10 05:57:07 2002 +0000
@@ -72,6 +72,8 @@
 	int bytesleft;
 };
 
+
+
 static int ft_choose_file(gpointer a, struct file_transfer *xfer);
 static void ft_cancel(gpointer w, struct file_transfer *xfer);
 static void ft_delete(struct file_transfer *xfer);
@@ -100,6 +102,7 @@
 	struct file_transfer *xfer = ft_new(FILE_TRANSFER_TYPE_RECEIVE, gc,
 			who);
 	char *buf;
+	char *sizebuf;
 	static const char *sizestr[4] = { "bytes", "KB", "MB", "GB" };
 	float sizemag = (float)totsize;
 	int szindex = 0;
@@ -115,14 +118,21 @@
 		szindex++;
 	}
 
-	if (xfer->totfiles == 1) 
-		buf = g_strdup_printf(_("%s requests that %s accept a file: %s (%.3g %s)"),
-		who, xfer->gc->username, initname,
-		sizemag, sizestr[szindex]);
+	if (totsize == -1)
+		sizebuf = g_strdup_printf(_("Unkown"));
 	else
-		buf = g_strdup_printf(_("%s requests that %s accept %d files: %s (%.3g %s)"),
+		sizebuf = g_strdup_printf("%.3g %s", sizemag, sizestr[szindex]);
+
+	if (xfer->totfiles == 1) {
+		buf = g_strdup_printf(_("%s requests that %s accept a file: %s (%s)"),
+		who, xfer->gc->username, initname, sizebuf);
+	} else {
+		buf = g_strdup_printf(_("%s requests that %s accept %d files: %s (%s)"),
 		who, xfer->gc->username, xfer->totfiles,
-		initname, sizemag, sizestr[szindex]);
+		initname, sizebuf);
+	}
+
+	g_free(sizebuf);
 
 	if (msg) {
 		char *newmsg = g_strconcat(buf, ": ", msg, NULL);