aboutsummaryrefslogtreecommitdiffstats
path: root/mail/component-factory.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-18 04:45:57 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-18 04:45:57 +0800
commitbbfb9268af8e5d8c5a0ac346ba13efc00783d46c (patch)
tree5a1dbb6d08fb030995efa38c13edd985046dc1cb /mail/component-factory.c
parentc1f19b88db7658700348d91b4e2310cb8502b5ea (diff)
downloadgsoc2013-evolution-bbfb9268af8e5d8c5a0ac346ba13efc00783d46c.tar
gsoc2013-evolution-bbfb9268af8e5d8c5a0ac346ba13efc00783d46c.tar.gz
gsoc2013-evolution-bbfb9268af8e5d8c5a0ac346ba13efc00783d46c.tar.bz2
gsoc2013-evolution-bbfb9268af8e5d8c5a0ac346ba13efc00783d46c.tar.lz
gsoc2013-evolution-bbfb9268af8e5d8c5a0ac346ba13efc00783d46c.tar.xz
gsoc2013-evolution-bbfb9268af8e5d8c5a0ac346ba13efc00783d46c.tar.zst
gsoc2013-evolution-bbfb9268af8e5d8c5a0ac346ba13efc00783d46c.zip
Fix to correctly handle text/uri-lists that contain more than a single
2001-07-17 Jeffrey Stedfast <fejj@ximian.com> * folder-browser.c (message_list_drag_data_recieved): Fix to correctly handle text/uri-lists that contain more than a single url. * component-factory.c (destination_folder_handle_drop): Fix to correctly handle text/uri-lists that contain more than a single url. svn path=/trunk/; revision=11174
Diffstat (limited to 'mail/component-factory.c')
-rw-r--r--mail/component-factory.c62
1 files changed, 34 insertions, 28 deletions
diff --git a/mail/component-factory.c b/mail/component-factory.c
index f9dc27dee2..5502fa7683 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -369,14 +369,14 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *des
const GNOME_Evolution_ShellComponentDnd_Data *data,
gpointer user_data)
{
- char *url, *in, *inptr, *inend;
+ char *tmp, *url, **urls, *in, *inptr, *inend;
gboolean retval = FALSE;
CamelFolder *folder;
CamelStream *stream;
CamelException ex;
GPtrArray *uids;
CamelURL *uri;
- int type, fd;
+ int i, type, fd;
if (action == GNOME_Evolution_ShellComponentDnd_ACTION_LINK)
return FALSE; /* we can't create links */
@@ -395,36 +395,42 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *des
if (!folder)
return FALSE;
- url = g_strndup (data->bytes._buffer, data->bytes._length);
- inend = strchr (url, '\n');
- if (inend)
- *inend = '\0';
+ tmp = g_strndup (data->bytes._buffer, data->bytes._length);
+ urls = g_strsplit (tmp, "\n", 0);
+ g_free (tmp);
- /* get the path component */
- g_strstrip (url);
- uri = camel_url_new (url, NULL);
- g_free (url);
- url = uri->path;
- uri->path = NULL;
- camel_url_free (uri);
-
- fd = open (url, O_RDONLY);
- if (fd == -1) {
+ retval = TRUE;
+ for (i = 0; urls[i] != NULL && retval; i++) {
+ /* get the path component */
+ url = g_strstrip (urls[i]);
+
+ uri = camel_url_new (url, NULL);
+ g_free (url);
+ url = uri->path;
+ uri->path = NULL;
+ camel_url_free (uri);
+
+ fd = open (url, O_RDONLY);
+ if (fd == -1) {
+ g_free (url);
+ /* FIXME: okay, so what do we do in this case? */
+ continue;
+ }
+
+ stream = camel_stream_fs_new_with_fd (fd);
+ message_rfc822_dnd (folder, stream, &ex);
+ camel_object_unref (CAMEL_OBJECT (stream));
+ camel_object_unref (CAMEL_OBJECT (folder));
+
+ retval = !camel_exception_is_set (&ex);
+
+ if (action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE && retval)
+ unlink (url);
+
g_free (url);
- return FALSE;
}
- stream = camel_stream_fs_new_with_fd (fd);
- message_rfc822_dnd (folder, stream, &ex);
- camel_object_unref (CAMEL_OBJECT (stream));
- camel_object_unref (CAMEL_OBJECT (folder));
-
- retval = !camel_exception_is_set (&ex);
-
- if (action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE && retval)
- unlink (url);
-
- g_free (url);
+ g_free (urls);
break;
case ACCEPTED_DND_TYPE_MESSAGE_RFC822:
folder = mail_tool_uri_to_folder (physical_uri, &ex);