From 056f54ee2814a37f40294c45fc78e49bfb40c358 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 9 Nov 2001 19:36:03 +0000 Subject: Was x_evolution_message_parse from folder-browser.c. A space char is no 2001-11-08 Jeffrey Stedfast * mail-tools.c (mail_tools_x_evolution_message_parse): Was x_evolution_message_parse from folder-browser.c. A space char is no longer used to separate the folder URI and the first uid, instead this is now done with a nul-char so update to parse the newer/better format. * component-factory.c (destination_folder_handle_drop): Update to parse the new/better format. * folder-browser.c (x_evolution_message_parse): Moved to mail-tools.c (message_list_drag_data_get): Instead of placing a space char after the folder URI, instead use a nul-char. svn path=/trunk/; revision=14645 --- mail/mail-tools.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'mail/mail-tools.c') diff --git a/mail/mail-tools.c b/mail/mail-tools.c index f403514c66..9d94fb1e78 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -396,3 +396,45 @@ mail_tool_forward_message (CamelMimeMessage *message, gboolean quoted) g_free (body); return ret; } + + +/** + * mail_tools_x_evolution_message_parse: + * @in: GtkSelectionData->data + * @inlen: GtkSelectionData->length + * @uids: pointer to a gptrarray that will be filled with uids on success + * + * Parses the GtkSelectionData and returns a CamelFolder and a list of + * UIDs specified by the selection. + **/ +CamelFolder * +mail_tools_x_evolution_message_parse (char *in, unsigned int inlen, GPtrArray **uids) +{ + /* format: "uri\0uid1\0uid2\0uid3\0...\0uidn" */ + char *inptr, *inend; + CamelFolder *folder; + + if (in == NULL) + return NULL; + + folder = mail_tool_uri_to_folder (in, 0, NULL); + + if (!folder) + return NULL; + + /* split the uids */ + inend = in + inlen; + inptr = in + strlen (in) + 1; + *uids = g_ptr_array_new (); + while (inptr < inend) { + char *start = inptr; + + while (inptr < inend && *inptr) + inptr++; + + g_ptr_array_add (*uids, g_strndup (start, inptr - start)); + inptr++; + } + + return folder; +} -- cgit