changeset 14905:dff16b654f14

[gaim-migrate @ 17677] sf patch #1588433, from Ka-Hing Cheung "prompt again if non-writable dir selected for FT" committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 06 Nov 2006 00:14:30 +0000
parents 0512fddbaaf2
children 1bd0456fe1c3
files libgaim/ft.c
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/ft.c	Mon Nov 06 00:08:00 2006 +0000
+++ b/libgaim/ft.c	Mon Nov 06 00:14:30 2006 +0000
@@ -33,6 +33,8 @@
 
 static GaimXferUiOps *xfer_ui_ops = NULL;
 
+static int gaim_xfer_choose_file(GaimXfer *xfer);
+
 GaimXfer *
 gaim_xfer_new(GaimAccount *account, GaimXferType type, const char *who)
 {
@@ -210,13 +212,26 @@
 {
 	GaimXfer *xfer;
 	struct stat st;
+	gchar *dir;
 
 	xfer = (GaimXfer *)user_data;
 
 	if (g_stat(filename, &st) != 0) {
 		/* File not found. */
 		if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) {
-			gaim_xfer_request_accepted(xfer, filename);
+			dir = g_path_get_dirname(filename);
+
+			if (g_access(dir, W_OK) == 0) {
+				gaim_xfer_request_accepted(xfer, filename);
+			} else {
+				gaim_xfer_ref(xfer);
+				gaim_notify_message(
+					NULL, GAIM_NOTIFY_MSG_ERROR, NULL,
+					_("Directory is not writable."), NULL,
+					(GaimNotifyCloseCallback)gaim_xfer_choose_file, xfer);
+			}
+
+			g_free(dir);
 		}
 		else {
 			gaim_xfer_show_file_error(xfer, filename);