changeset 31604:85d5f1e37fdb

When drag-dropping an image into an IM window and sending as an inline image in a direct IM, strip the full path from the filename and just use the basename.ext. Fixes #13098
author Mark Doliner <mark@kingant.net>
date Tue, 25 Jan 2011 09:39:59 +0000
parents 59bcbc35f9c0
children b010ad8724ba
files pidgin/gtkutils.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkutils.c	Sun Jan 23 21:57:49 2011 +0000
+++ b/pidgin/gtkutils.c	Tue Jan 25 09:39:59 2011 +0000
@@ -1463,6 +1463,7 @@
 
 static void dnd_image_ok_callback(_DndData *data, int choice)
 {
+	const gchar *shortname;
 	gchar *filedata;
 	size_t size;
 	struct stat st;
@@ -1517,7 +1518,9 @@
 
 			break;
 		}
-		id = purple_imgstore_add_with_id(filedata, size, data->filename);
+		shortname = strrchr(data->filename, G_DIR_SEPARATOR);
+		shortname = shortname ? shortname + 1 : data->filename;
+		id = purple_imgstore_add_with_id(filedata, size, shortname);
 
 		gtk_text_buffer_get_iter_at_mark(GTK_IMHTML(gtkconv->entry)->text_buffer, &iter,
 						 gtk_text_buffer_get_insert(GTK_IMHTML(gtkconv->entry)->text_buffer));