aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-11-20 05:22:12 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-11-20 05:22:12 +0800
commitdc497cb36bd6b3b00752195bfc6cfebfb11a1a7a (patch)
tree18179a15653a7d8ad2993682facd7767970e8c3d
parent23a30c833da72e2ab2b1287b5a7101e9a7aadc8f (diff)
downloadgsoc2013-evolution-dc497cb36bd6b3b00752195bfc6cfebfb11a1a7a.tar
gsoc2013-evolution-dc497cb36bd6b3b00752195bfc6cfebfb11a1a7a.tar.gz
gsoc2013-evolution-dc497cb36bd6b3b00752195bfc6cfebfb11a1a7a.tar.bz2
gsoc2013-evolution-dc497cb36bd6b3b00752195bfc6cfebfb11a1a7a.tar.lz
gsoc2013-evolution-dc497cb36bd6b3b00752195bfc6cfebfb11a1a7a.tar.xz
gsoc2013-evolution-dc497cb36bd6b3b00752195bfc6cfebfb11a1a7a.tar.zst
gsoc2013-evolution-dc497cb36bd6b3b00752195bfc6cfebfb11a1a7a.zip
Same.
2003-11-19 Jeffrey Stedfast <fejj@ximian.com> * em-utils.c (em_utils_selection_set_urilist): Same. * em-format-html-display.c (efhd_drag_data_get): Same as below. * em-folder-tree.c (drag_text_uri_list): Terminate each url of a text/uri-list with a \r\n. svn path=/trunk/; revision=23451
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/em-folder-tree.c19
-rw-r--r--mail/em-format-html-display.c6
-rw-r--r--mail/em-utils.c13
-rw-r--r--mail/message-list.c10
5 files changed, 36 insertions, 21 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 6a056c25b0..8c18a6ab6e 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2003-11-19 Jeffrey Stedfast <fejj@ximian.com>
+
+ * em-utils.c (em_utils_selection_set_urilist): Same.
+
+ * em-format-html-display.c (efhd_drag_data_get): Same as below.
+
+ * em-folder-tree.c (drag_text_uri_list): Terminate each url of a
+ text/uri-list with a \r\n.
+
2003-11-19 Ettore Perazzoli <ettore@ximian.com>
* GNOME_Evolution_Mail.server.in.in: Add an
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 79c2ba0bd3..fc3de1f8ea 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -698,7 +698,7 @@ drag_text_uri_list (EMFolderTree *emft, CamelFolder *src, GtkSelectionData *sele
const char *tmpdir;
CamelStore *store;
GPtrArray *uids;
- char *url;
+ GString *url;
if (!(tmpdir = e_mkdtemp ("drag-n-drop-XXXXXX"))) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -707,12 +707,13 @@ drag_text_uri_list (EMFolderTree *emft, CamelFolder *src, GtkSelectionData *sele
return;
}
- url = g_strdup_printf ("mbox:%s", tmpdir);
- if (!(store = camel_session_get_store (session, url, ex))) {
+ url = g_string_new ("mbox:");
+ g_string_append (url, tmpdir);
+ if (!(store = camel_session_get_store (session, url->str, ex))) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Could not create temporary mbox store: %s"),
camel_exception_get_description (ex));
- g_free (url);
+ g_string_free (url, TRUE);
return;
}
@@ -723,7 +724,7 @@ drag_text_uri_list (EMFolderTree *emft, CamelFolder *src, GtkSelectionData *sele
camel_exception_get_description (ex));
camel_object_unref (store);
- g_free (url);
+ g_string_free (url, TRUE);
return;
}
@@ -737,13 +738,15 @@ drag_text_uri_list (EMFolderTree *emft, CamelFolder *src, GtkSelectionData *sele
_("Could not copy messages to temporary mbox folder: %s"),
camel_exception_get_description (ex));
} else {
- memcpy (url, "file", 4);
- gtk_selection_data_set (selection, selection->target, 8, url, strlen (url));
+ /* replace "mbox:" with "file:" */
+ memcpy (url->str, "file", 4);
+ g_string_append (url, "\r\n");
+ gtk_selection_data_set (selection, selection->target, 8, url->str, url->len);
}
camel_folder_free_uids (src, uids);
camel_object_unref (dest);
- g_free (url);
+ g_string_free (url, TRUE);
}
static gboolean
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 779e70a69a..6aa74be4f1 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -984,10 +984,10 @@ efhd_drag_data_get(GtkWidget *w, GdkDragContext *drag, GtkSelectionData *data, g
stream = camel_stream_mem_new();
/* TODO: shoudl format_format_text run on the content-object? */
/* TODO: should we just do format_content? */
- if (camel_content_type_is (((CamelDataWrapper *)part)->mime_type, "text", "*"))
+ if (camel_content_type_is (((CamelDataWrapper *)part)->mime_type, "text", "*")) {
/* FIXME: this should be an em_utils method, it only needs a default charset param */
em_format_format_text((EMFormat *)pobject->format, stream, (CamelDataWrapper *)part);
- else {
+ } else {
CamelDataWrapper *dw = camel_medium_get_content_object((CamelMedium *)part);
camel_data_wrapper_decode_to_stream(dw, stream);
@@ -1010,7 +1010,7 @@ efhd_drag_data_get(GtkWidget *w, GdkDragContext *drag, GtkSelectionData *data, g
if (path == NULL)
return;
- uri = g_strdup_printf("file://%s", path);
+ uri = g_strdup_printf("file://%s\r\n", path);
g_free(path);
gtk_selection_data_set(data, data->target, 8, uri, strlen(uri));
g_object_set_data_full((GObject *)w, "e-drag-uri", uri, g_free);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index ab5c86c131..0519fe02a5 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1837,7 +1837,7 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr
{
const char *tmpdir;
CamelStream *fstream;
- char *uri;
+ char *uri, *p;
int fd;
tmpdir = e_mkdtemp("drag-n-drop-XXXXXX");
@@ -1847,16 +1847,19 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr
/* FIXME: this used to save a single message with the subject
as the filename but it was unsafe, and makes this messier,
the pain */
-
- uri = alloca(strlen(tmpdir)+16);
- sprintf(uri, "file:///%s/mbox", tmpdir);
+
+ p = uri = g_alloca (strlen (tmpdir) + 16);
+ p += sprintf (uri, "file:///%s/mbox", tmpdir);
fd = open(uri + 7, O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd == -1)
return;
-
+
fstream = camel_stream_fs_new_with_fd(fd);
if (fstream) {
+ /* terminate with \r\n to be compliant with the spec */
+ strcpy (p, "\r\n");
+
if (em_utils_write_messages_to_stream(folder, uids, fstream) == 0)
gtk_selection_data_set(data, data->target, 8, uri, strlen(uri));
diff --git a/mail/message-list.c b/mail/message-list.c
index 430d2f4896..7e62aa58f0 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1508,13 +1508,13 @@ ml_tree_drag_data_get (ETree *tree, int row, ETreePath path, int col,
if (uids->len > 0) {
switch (info) {
- case 0 /*DND_TARGET_TYPE_X_UID_LIST */:
+ case 0 /* DND_TARGET_TYPE_X_UID_LIST */:
em_utils_selection_set_uidlist(data, ml->folder_uri, uids);
break;
- case 1 /*DND_TARGET_TYPE_MESSAGE_RFC822*/:
+ case 1 /* DND_TARGET_TYPE_MESSAGE_RFC822 */:
em_utils_selection_set_mailbox(data, ml->folder, uids);
break;
- case 2 /*DND_TARGET_TYPE_TEXT_URI_LIST*/:
+ case 2 /* DND_TARGET_TYPE_TEXT_URI_LIST */:
em_utils_selection_set_urilist(data, ml->folder, uids);
break;
}
@@ -1537,10 +1537,10 @@ ml_tree_drag_data_received (ETree *tree, int row, ETreePath path, int col,
guarantee on what the content would be */
switch (info) {
- case 1 /*DND_TARGET_TYPE_MESSAGE_RFC822*/:
+ case 1 /* DND_TARGET_TYPE_MESSAGE_RFC822 */:
em_utils_selection_get_mailbox(data, ml->folder);
break;
- case 0 /*DND_TARGET_TYPE_X_EVOLUTION_MESSAGE*/:
+ case 0 /* DND_TARGET_TYPE_X_UID_LIST */:
ml_selection_received_uidlist(ml, data);
break;
}