aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-tools.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail-tools.c')
-rw-r--r--mail/mail-tools.c42
1 files changed, 42 insertions, 0 deletions
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;
+}