aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2001-01-03 19:52:04 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-01-03 19:52:04 +0800
commitc37da1342398fdc4836baa89d0506a0950a10bb6 (patch)
tree58d0977e7b47884a3e0ed644f5ac777336bf9403
parent3df84a345e9cec9fded0e697b660e6c18c91f9d7 (diff)
downloadgsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar.gz
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar.bz2
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar.lz
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar.xz
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar.zst
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.zip
Call mail-callbacks.c:forward_messages(), so the behaviour is the same as
2001-01-03 Not Zed <NotZed@HelixCode.com> * mail-view.c (view_forward_msg): Call mail-callbacks.c:forward_messages(), so the behaviour is the same as from the folder browser. * mail-callbacks.c (forward_messages): New function to forward messages, attached or not. (forward_inlined): Changed to use new forward-messages implementation. (forward_attached): Likewise. (do_forward_attach): Callback for forwarding as attachment, once we have built it. (do_forward_inline): Likewise, for inline, once we have retrieved the message. (forward_message): Removed. * mail-ops.c (mail_build_attachment): New function to build an attachment of messages. (mail_do_attach_message): Removed, functionality superceeded by above. (mail_do_forward_message): Removed. Likewise. (mail_create_folder): Started work on an alternative implementation of create_folder, but not sure about it yet. * mail-tools.c (mail_tool_generate_forward_subject): Remove locking. (mail_tool_make_message_attachment): Free the description when done. svn path=/trunk/; revision=7232
-rw-r--r--mail/ChangeLog28
-rw-r--r--mail/mail-callbacks.c116
-rw-r--r--mail/mail-callbacks.h2
-rw-r--r--mail/mail-ops.c431
-rw-r--r--mail/mail-ops.h9
-rw-r--r--mail/mail-tools.c7
-rw-r--r--mail/mail-view.c14
7 files changed, 236 insertions, 371 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index e923f2cc87..04bf3436d4 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,31 @@
+2001-01-03 Not Zed <NotZed@HelixCode.com>
+
+ * mail-view.c (view_forward_msg): Call
+ mail-callbacks.c:forward_messages(), so the behaviour is the same
+ as from the folder browser.
+
+ * mail-callbacks.c (forward_messages): New function to forward
+ messages, attached or not.
+ (forward_inlined): Changed to use new forward-messages
+ implementation.
+ (forward_attached): Likewise.
+ (do_forward_attach): Callback for forwarding as attachment, once
+ we have built it.
+ (do_forward_inline): Likewise, for inline, once we have retrieved
+ the message.
+ (forward_message): Removed.
+
+ * mail-ops.c (mail_build_attachment): New function to build an
+ attachment of messages.
+ (mail_do_attach_message): Removed, functionality superceeded by
+ above.
+ (mail_do_forward_message): Removed. Likewise.
+ (mail_create_folder): Started work on an alternative
+ implementation of create_folder, but not sure about it yet.
+
+ * mail-tools.c (mail_tool_generate_forward_subject): Remove locking.
+ (mail_tool_make_message_attachment): Free the description when done.
+
2001-01-03 Radek Doulik <rodo@helixcode.com>
* mail-format.c (write_headers): add font color setting for table,
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 736bba530e..a565da9f97 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -477,58 +477,98 @@ enumerate_msg (MessageList *ml, const char *uid, gpointer data)
g_ptr_array_add ((GPtrArray *) data, g_strdup (uid));
}
-static void
-forward_message (FolderBrowser *fb, gboolean attach)
+
+static EMsgComposer *forward_get_composer(const char *subject)
{
EMsgComposer *composer;
- CamelMimeMessage *cursor_msg;
MailConfigIdentity *id;
- GPtrArray *uids;
- gchar *sig_file = NULL;
- gboolean send_html;
-
- cursor_msg = fb->mail_display->current_message;
- g_return_if_fail (cursor_msg != NULL);
-
- if (!check_send_configuration (fb))
- return;
-
+
id = mail_config_get_default_identity ();
- send_html = mail_config_send_html ();
-
- if (id)
- sig_file = id->sig;
-
- composer = e_msg_composer_new_with_sig_file (sig_file, send_html);
- if (!composer)
- return;
-
- uids = g_ptr_array_new ();
- if (attach)
- message_list_foreach (fb->message_list, enumerate_msg, uids);
- else
- g_ptr_array_add (uids, g_strdup (fb->message_list->cursor_uid));
-
- gtk_signal_connect (GTK_OBJECT (composer), "send",
- GTK_SIGNAL_FUNC (composer_send_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer), "postpone",
- GTK_SIGNAL_FUNC (composer_postpone_cb), NULL);
-
- mail_do_forward_message (cursor_msg,
- fb->message_list->folder,
- uids, composer, attach);
+ composer = e_msg_composer_new_with_sig_file(id?id->sig:NULL, mail_config_send_html());
+ if (composer) {
+ gtk_signal_connect (GTK_OBJECT (composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (composer), "postpone",
+ GTK_SIGNAL_FUNC (composer_postpone_cb), NULL);
+ e_msg_composer_set_headers(composer, NULL, NULL, NULL, subject);
+ } else {
+ g_warning("Could not create composer");
+ }
+
+ return composer;
+}
+
+static void
+do_forward_inline(CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
+{
+ char *subject;
+ char *text;
+
+ if (message) {
+ subject = mail_tool_generate_forward_subject(message);
+ text = mail_tool_quote_message (message, _("Forwarded message:\n"));
+
+ if (text) {
+ EMsgComposer *composer = forward_get_composer(subject);
+ if (composer) {
+ e_msg_composer_set_body_text(composer, text);
+ gtk_widget_show((GtkWidget *)composer);
+ }
+ g_free(text);
+ }
+
+ g_free(subject);
+ }
+}
+
+static void
+do_forward_attach(CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data)
+{
+ if (part) {
+ EMsgComposer *composer = forward_get_composer(subject);
+ if (composer) {
+ e_msg_composer_attach(composer, part);
+ gtk_widget_show((GtkWidget *)composer);
+ }
+ }
+}
+
+void
+forward_messages(CamelFolder *folder, GPtrArray *uids, int doinline)
+{
+ if (doinline && uids->len == 1) {
+ mail_get_message(folder, uids->pdata[0], do_forward_inline, NULL, mail_thread_new);
+ } else {
+ mail_build_attachment(folder, uids, do_forward_attach, NULL);
+ }
}
void
forward_inlined (GtkWidget *widget, gpointer user_data)
{
- forward_message (FOLDER_BROWSER (user_data), FALSE);
+ GPtrArray *uids;
+ FolderBrowser *fb = (FolderBrowser *)user_data;
+
+ if (!check_send_configuration (fb))
+ return;
+
+ uids = g_ptr_array_new();
+ g_ptr_array_add(uids, g_strdup (fb->message_list->cursor_uid));
+ forward_messages(fb->message_list->folder, uids, TRUE);
}
void
forward_attached (GtkWidget *widget, gpointer user_data)
{
- forward_message (FOLDER_BROWSER (user_data), TRUE);
+ GPtrArray *uids;
+ FolderBrowser *fb = (FolderBrowser *)user_data;
+
+ if (!check_send_configuration (fb))
+ return;
+
+ uids = g_ptr_array_new();
+ message_list_foreach(fb->message_list, enumerate_msg, uids);
+ forward_messages(fb->message_list->folder, uids, FALSE);
}
static void
diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h
index a94d58fc5c..d529600ceb 100644
--- a/mail/mail-callbacks.h
+++ b/mail/mail-callbacks.h
@@ -75,6 +75,8 @@ void mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const ch
void composer_send_cb (EMsgComposer *composer, gpointer data);
void composer_postpone_cb (EMsgComposer *composer, gpointer data);
+void forward_messages (CamelFolder *folder, GPtrArray *uids, int inline);
+
void mail_print_preview_msg (MailDisplay *md);
void mail_print_msg (MailDisplay *md);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 50464e1859..7f4784e5c7 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1215,6 +1215,12 @@ mail_do_flag_all_messages (CamelFolder *source, gboolean invert,
/* ** SCAN SUBFOLDERS ***************************************************** */
+struct _scan_sub_msg {
+ CamelStore *store;
+ EvolutionStorage *storage;
+};
+
+
typedef struct scan_subfolders_input_s
{
CamelStore *store;
@@ -1369,339 +1375,139 @@ mail_do_scan_subfolders (CamelStore *store, EvolutionStorage *storage)
}
}
-/* ** ATTACH MESSAGE ****************************************************** */
-
-#warning "mail_do_attach_message() isn't used anywhere? Remove after confirming"
-#if 0
-
-typedef struct attach_message_input_s
-{
- EMsgComposer *composer;
- CamelFolder *folder;
- gchar *uid;
-}
-attach_message_input_t;
-
-typedef struct attach_message_data_s
-{
- CamelMimePart *part;
-}
-attach_message_data_t;
-
-static gchar *
-describe_attach_message (gpointer in_data, gboolean gerund)
-{
- attach_message_input_t *input = (attach_message_input_t *) in_data;
-
- if (gerund)
- return
- g_strdup_printf
- (_("Attaching messages from folder \"%s\""),
- mail_tool_get_folder_name (input->folder));
- else
- return g_strdup_printf (_("Attach messages from \"%s\""),
- mail_tool_get_folder_name (input->folder));
-}
-
-static void
-setup_attach_message (gpointer in_data, gpointer op_data, CamelException *ex)
-{
- attach_message_input_t *input = (attach_message_input_t *) in_data;
+/* ** ATTACH MESSAGES ****************************************************** */
- camel_object_ref (CAMEL_OBJECT (input->folder));
- gtk_object_ref (GTK_OBJECT (input->composer));
-}
+struct _build_data {
+ void (*done)(CamelFolder *folder, GPtrArray *uids, CamelMimePart *part, char *subject, void *data);
+ void *data;
+};
-static void
-do_attach_message (gpointer in_data, gpointer op_data, CamelException *ex)
+static void do_build_attachment(CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, void *data)
{
- attach_message_input_t *input = (attach_message_input_t *) in_data;
- attach_message_data_t *data = (attach_message_data_t *) op_data;
-
- CamelMimeMessage *message;
+ struct _build_data *d = data;
+ CamelMultipart *multipart;
CamelMimePart *part;
+ char *subject;
+ int i;
- mail_tool_camel_lock_up ();
- message = camel_folder_get_message (input->folder, input->uid, ex);
- if (!message) {
- mail_tool_camel_lock_down ();
+ if (messages->len == 0) {
+ d->done(folder, messages, NULL, NULL, d->data);
+ g_free(d);
return;
}
- part = mail_tool_make_message_attachment (message);
- camel_object_unref (CAMEL_OBJECT (message));
- mail_tool_camel_lock_down ();
- if (!part)
- return;
+ if (messages->len == 1) {
+ part = mail_tool_make_message_attachment(messages->pdata[0]);
+ } else {
+ multipart = camel_multipart_new();
+ camel_data_wrapper_set_mime_type(CAMEL_DATA_WRAPPER (multipart), "multipart/digest");
+ camel_multipart_set_boundary(multipart, NULL);
+
+ for (i=0;i<messages->len;i++) {
+ part = mail_tool_make_message_attachment(messages->pdata[i]);
+ camel_multipart_add_part(multipart, part);
+ camel_object_unref((CamelObject *)part);
+ }
+ part = camel_mime_part_new();
+ camel_medium_set_content_object(CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER(multipart));
+ camel_object_unref((CamelObject *)multipart);
- data->part = part;
-}
+ camel_mime_part_set_description(part, _("Forwarded messages"));
+ }
-static void
-cleanup_attach_message (gpointer in_data, gpointer op_data,
- CamelException *ex)
-{
- attach_message_input_t *input = (attach_message_input_t *) in_data;
- attach_message_data_t *data = (attach_message_data_t *) op_data;
+ subject = mail_tool_generate_forward_subject(messages->pdata[0]);
+ d->done(folder, messages, part, subject, d->data);
+ g_free(subject);
+ camel_object_unref((CamelObject *)part);
- e_msg_composer_attach (input->composer, data->part);
- camel_object_unref (CAMEL_OBJECT (data->part));
- camel_object_unref (CAMEL_OBJECT (input->folder));
- gtk_object_unref (GTK_OBJECT (input->composer));
- g_free (input->uid);
+ g_free(d);
}
-static const mail_operation_spec op_attach_message = {
- describe_attach_message,
- sizeof (attach_message_data_t),
- setup_attach_message,
- do_attach_message,
- cleanup_attach_message
-};
-
void
-mail_do_attach_message (CamelFolder *folder, const char *uid,
- EMsgComposer *composer)
+mail_build_attachment(CamelFolder *folder, GPtrArray *uids,
+ void (*done)(CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data), void *data)
{
- attach_message_input_t *input;
+ struct _build_data *d;
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (uid != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
- input = g_new (attach_message_input_t, 1);
- input->folder = folder;
- input->uid = g_strdup (uid);
- input->composer = composer;
-
- mail_operation_queue (&op_attach_message, input, TRUE);
+ d = g_malloc(sizeof(*d));
+ d->done = done;
+ d->data = data;
+ mail_get_messages(folder, uids, do_build_attachment, d);
}
-#endif
+/* ** LOAD FOLDER ********************************************************* */
-/* ** FORWARD MESSAGES **************************************************** */
+struct _get_folder_msg {
+ struct _mail_msg msg;
-typedef struct forward_messages_input_s {
- CamelMimeMessage *basis;
- CamelFolder *source;
- GPtrArray *uids;
- EMsgComposer *composer;
- gboolean attach;
-} forward_messages_input_t;
+ char *uri;
+ CamelFolder *folder;
+ void (*done) (char *uri, CamelFolder *folder, void *data);
+ void *data;
+};
-typedef struct forward_messages_data_s {
- gchar *subject;
- GPtrArray *parts;
-} forward_messages_data_t;
+static char *get_folder_desc(struct _mail_msg *mm, int done)
+{
+ struct _get_folder_msg *m = (struct _get_folder_msg *)mm;
+
+ return g_strdup_printf(_("Opening folder %s"), m->uri);
+}
-static gchar *
-describe_forward_messages (gpointer in_data, gboolean gerund)
+static void get_folder_get(struct _mail_msg *mm)
{
- forward_messages_input_t *input = (forward_messages_input_t *) in_data;
+ struct _get_folder_msg *m = (struct _get_folder_msg *)mm;
- if (gerund) {
- if (input->basis->subject)
- return g_strdup_printf (_("Forwarding messages \"%s\""),
- input->basis->subject);
- else
- return g_strdup_printf
- (_("Forwarding a message without a subject"));
- } else {
- if (input->basis->subject)
- return g_strdup_printf (_("Forward message \"%s\""),
- input->basis->subject);
- else
- return g_strdup_printf
- (_("Forward a message without a subject"));
- }
+ m->folder = mail_tool_uri_to_folder(m->uri, &mm->ex);
}
-static void
-setup_forward_messages (gpointer in_data, gpointer op_data,
- CamelException *ex)
+static void get_folder_got(struct _mail_msg *mm)
{
- forward_messages_input_t *input = (forward_messages_input_t *) in_data;
-
- if (!input->attach && input->uids->len > 1) {
- /* Hmmm, this behavior is undefined so lets default
- back to forwarding each message as an attachment. */
-
- input->attach = TRUE;
- }
-
- camel_object_ref (CAMEL_OBJECT (input->basis));
- camel_object_ref (CAMEL_OBJECT (input->source));
- gtk_object_ref (GTK_OBJECT (input->composer));
+ struct _get_folder_msg *m = (struct _get_folder_msg *)mm;
+
+ /* FIXME: what to do when it fails? */
+
+ if (m->done)
+ m->done(m->uri, m->folder, m->data);
}
-static void
-do_forward_messages (gpointer in_data, gpointer op_data, CamelException *ex)
+static void get_folder_free(struct _mail_msg *mm)
{
- forward_messages_input_t *input = (forward_messages_input_t *) in_data;
- forward_messages_data_t *data = (forward_messages_data_t *) op_data;
- CamelMimeMessage *message;
-
- data->parts = g_ptr_array_new ();
-
- mail_tool_camel_lock_up ();
-
- if (input->attach) {
- CamelMimePart *part;
- time_t last_update = 0;
- int i;
-
- for (i = 0; i < input->uids->len; i++) {
- const int last_message = (i+1 == input->uids->len);
- time_t now;
-
- /*
- * Update the time display every 2 seconds
- */
- time (&now);
- if (last_message || ((now - last_update) > 2)){
- mail_op_set_message (_("Retrieving message number %d of %d (uid \"%s\")"),
- i + 1, input->uids->len, (char *) input->uids->pdata[i]);
- last_update = now;
- }
-
- message = camel_folder_get_message (input->source,
- input->uids->pdata[i], ex);
- g_free (input->uids->pdata[i]);
- if (!message) {
- mail_tool_camel_lock_down ();
- return;
- }
-
- part = mail_tool_make_message_attachment (message);
- if (!part) {
- camel_object_unref (CAMEL_OBJECT (message));
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to generate mime part from "
- "message while generating forwarded message."));
- mail_tool_camel_lock_down ();
- return;
- }
-
- camel_object_unref (CAMEL_OBJECT (message));
- g_ptr_array_add (data->parts, part);
- }
- } else {
- message = camel_folder_get_message (input->source,
- input->uids->pdata[0], ex);
- g_free (input->uids->pdata[0]);
- if (!message) {
- mail_tool_camel_lock_down ();
- return;
- }
-
- g_ptr_array_add (data->parts, message);
- }
-
- mail_tool_camel_lock_down ();
-
- data->subject = mail_tool_generate_forward_subject (input->basis);
-}
+ struct _get_folder_msg *m = (struct _get_folder_msg *)mm;
-static void
-cleanup_forward_messages (gpointer in_data, gpointer op_data,
- CamelException *ex)
-{
- forward_messages_input_t *input = (forward_messages_input_t *) in_data;
- forward_messages_data_t *data = (forward_messages_data_t *) op_data;
-
- if (input->attach) {
- if (data->parts->len > 1) {
- /* construct and attach a multipart/digest */
- CamelMimePart *digest;
- CamelMultipart *multipart;
- int i;
-
- multipart = camel_multipart_new ();
- camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart),
- "multipart/digest");
- camel_multipart_set_boundary (multipart, NULL);
-
- for (i = 0; i < data->parts->len; i++) {
- camel_multipart_add_part (multipart, CAMEL_MIME_PART (data->parts->pdata[i]));
- camel_object_unref (CAMEL_OBJECT (data->parts->pdata[i]));
- }
-
- digest = camel_mime_part_new ();
- camel_medium_set_content_object (CAMEL_MEDIUM (digest),
- CAMEL_DATA_WRAPPER (multipart));
- camel_object_unref (CAMEL_OBJECT (multipart));
-
- camel_mime_part_set_description (digest, _("Forwarded messages"));
-
- e_msg_composer_attach (input->composer, CAMEL_MIME_PART (digest));
- camel_object_unref (CAMEL_OBJECT (digest));
- } else if (data->parts->len == 1) {
- /* simply attach the message as message/rfc822 */
- e_msg_composer_attach (input->composer, CAMEL_MIME_PART (data->parts->pdata[0]));
- camel_object_unref (CAMEL_OBJECT (data->parts->pdata[0]));
- }
- } else {
- /* attach as inlined text */
- CamelMimeMessage *message = data->parts->pdata[0];
- char *text;
-
- text = mail_tool_quote_message (message, _("Forwarded message:\n"));
-
- if (text) {
- e_msg_composer_set_body_text (input->composer, text);
- g_free (text);
- }
-
- camel_object_unref (CAMEL_OBJECT (message));
- }
-
- camel_object_unref (CAMEL_OBJECT (input->source));
-
- e_msg_composer_set_headers (input->composer, NULL, NULL, NULL,
- data->subject);
-
- gtk_object_unref (GTK_OBJECT (input->composer));
- g_free (data->subject);
- g_ptr_array_free (data->parts, TRUE);
- g_ptr_array_free (input->uids, TRUE);
- gtk_widget_show (GTK_WIDGET (input->composer));
+ g_free(m->uri);
+ if (m->folder)
+ camel_object_unref((CamelObject *)m->folder);
}
-static const mail_operation_spec op_forward_messages = {
- describe_forward_messages,
- sizeof (forward_messages_data_t),
- setup_forward_messages,
- do_forward_messages,
- cleanup_forward_messages
+static struct _mail_msg_op get_folder_op = {
+ get_folder_desc,
+ get_folder_get,
+ get_folder_got,
+ get_folder_free,
};
void
-mail_do_forward_message (CamelMimeMessage *basis,
- CamelFolder *source,
- GPtrArray *uids,
- EMsgComposer *composer,
- gboolean attach)
+mail_get_folder(const char *uri, void (*done) (char *uri, CamelFolder *folder, void *data), void *data)
{
- forward_messages_input_t *input;
-
- g_return_if_fail (CAMEL_IS_MIME_MESSAGE (basis));
- g_return_if_fail (CAMEL_IS_FOLDER (source));
- g_return_if_fail (uids != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
- input = g_new (forward_messages_input_t, 1);
- input->basis = basis;
- input->source = source;
- input->uids = uids;
- input->composer = composer;
- input->attach = attach;
-
- mail_operation_queue (&op_forward_messages, input, TRUE);
+ struct _get_folder_msg *m;
+
+ m = mail_msg_new(&get_folder_op, NULL, sizeof(*m));
+ m->uri = g_strdup(uri);
+ m->data = data;
+ m->done = done;
+
+ e_thread_put(mail_thread_new, (EMsg *)m);
}
-/* ** LOAD FOLDER ********************************************************* */
+/* ** CREATE FOLDER ******************************************************* */
-struct _get_folder_msg {
+#if 0
+
+/* possible new implementation (not yet finished)
+ However, i'm trying to find a way to remove this entirely and just use get_folder()
+ to do the same thing. But i dont think it can be done, because one works on
+ shell uri's (get folder), and the other only works for mail uri's ? */
+struct _create_folder_msg {
struct _mail_msg msg;
char *uri;
@@ -1710,23 +1516,27 @@ struct _get_folder_msg {
void *data;
};
-static char *get_folder_desc(struct _mail_msg *mm, int done)
+static char *create_folder_desc(struct _mail_msg *mm, int done)
{
- struct _get_folder_msg *m = (struct _get_folder_msg *)mm;
+ struct _create_folder_msg *m = (struct _create_folder_msg *)mm;
return g_strdup_printf(_("Opening folder %s"), m->uri);
}
-static void get_folder_get(struct _mail_msg *mm)
+static void create_folder_get(struct _mail_msg *mm)
{
- struct _get_folder_msg *m = (struct _get_folder_msg *)mm;
+ struct _create_folder_msg *m = (struct _create_folder_msg *)mm;
+ char *uri;
- m->folder = mail_tool_uri_to_folder(m->uri, &mm->ex);
+ /* FIXME: supply a way to make indexes optional */
+ m->folder = mail_tool_get_folder_from_urlname(m->uri, "mbox",
+ CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX,
+ &mm->ex);
}
-static void get_folder_got(struct _mail_msg *mm)
+static void create_folder_got(struct _mail_msg *mm)
{
- struct _get_folder_msg *m = (struct _get_folder_msg *)mm;
+ struct _create_folder_msg *m = (struct _create_folder_msg *)mm;
/* FIXME: what to do when it fails? */
@@ -1734,34 +1544,35 @@ static void get_folder_got(struct _mail_msg *mm)
m->done(m->uri, m->folder, m->data);
}
-static void get_folder_free(struct _mail_msg *mm)
+static void create_folder_free(struct _mail_msg *mm)
{
- struct _get_folder_msg *m = (struct _get_folder_msg *)mm;
+ struct _create_folder_msg *m = (struct _create_folder_msg *)mm;
g_free(m->uri);
if (m->folder)
camel_object_unref((CamelObject *)m->folder);
}
-static struct _mail_msg_op get_folder_op = {
- get_folder_desc,
- get_folder_get,
- get_folder_got,
- get_folder_free,
+static struct _mail_msg_op create_folder_op = {
+ create_folder_desc,
+ create_folder_get,
+ create_folder_got,
+ create_folder_free,
};
void
-mail_get_folder(const char *uri, void (*done) (char *uri, CamelFolder *folder, void *data), void *data)
+mail_create_folder(const char *uri, void (*done) (char *uri, CamelFolder *folder, void *data), void *data)
{
- struct _get_folder_msg *m;
+ struct _create_folder_msg *m;
- m = mail_msg_new(&get_folder_op, NULL, sizeof(*m));
+ m = mail_msg_new(&create_folder_op, NULL, sizeof(*m));
m->uri = g_strdup(uri);
m->data = data;
m->done = done;
e_thread_put(mail_thread_new, (EMsg *)m);
}
+#endif
/* ** CREATE FOLDER ******************************************************* */
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index bd51e1cc32..604c12c5ab 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -55,11 +55,6 @@ void mail_do_flag_messages (CamelFolder *source, GPtrArray *uids,
void mail_do_flag_all_messages (CamelFolder *source, gboolean invert,
guint32 mask, guint32 set);
void mail_do_scan_subfolders (CamelStore *store, EvolutionStorage *storage);
-void mail_do_attach_message (CamelFolder *folder, const char *uid,
- EMsgComposer *composer);
-void mail_do_forward_message (CamelMimeMessage *basis, CamelFolder *source,
- GPtrArray *uids, /*array of allocated gchar *, will all be freed */
- EMsgComposer *composer, gboolean attach);
void mail_do_create_folder (const GNOME_Evolution_ShellComponentListener listener,
const char *uri, const char *type);
void mail_do_setup_trash (const char *name, const char *store_uri, CamelFolder **folder);
@@ -78,6 +73,10 @@ void mail_get_messages(CamelFolder *folder, GPtrArray *uids,
void mail_get_folder(const char *uri,
void (*done) (char *uri, CamelFolder *folder, void *data), void *data);
+/* build an attachment */
+void mail_build_attachment(CamelFolder *folder, GPtrArray *uids,
+ void (*done)(CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data), void *data);
+
void mail_sync_folder(CamelFolder *folder,
void (*done) (CamelFolder *folder, void *data), void *data);
void mail_expunge_folder(CamelFolder *folder,
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 5bfefa758b..a564818b3c 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -370,10 +370,6 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg)
char *fwd_subj, *fromstr;
const CamelInternetAddress *from;
- /* we need to lock around the whole function, as we are
- only getting references to the message's data */
- mail_tool_camel_lock_up();
-
from = camel_mime_message_get_from(msg);
subject = camel_mime_message_get_subject(msg);
@@ -395,8 +391,6 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg)
fwd_subj = g_strdup (_("Fwd: (no subject)"));
}
- mail_tool_camel_lock_down();
-
return fwd_subj;
}
@@ -440,6 +434,7 @@ mail_tool_make_message_attachment (CamelMimeMessage *message)
camel_medium_set_content_object (CAMEL_MEDIUM (part),
CAMEL_DATA_WRAPPER (message));
camel_mime_part_set_content_type (part, "message/rfc822");
+ g_free(desc);
/*camel_object_unref (CAMEL_OBJECT (message));*/
return part;
}
diff --git a/mail/mail-view.c b/mail/mail-view.c
index cd18b4ff69..c923799e83 100644
--- a/mail/mail-view.c
+++ b/mail/mail-view.c
@@ -100,21 +100,11 @@ static void
view_forward_msg (GtkWidget *widget, gpointer user_data)
{
mail_view_data *data = (mail_view_data *) user_data;
-
GPtrArray *uids;
- EMsgComposer *composer;
-
- composer = e_msg_composer_new ();
- if (!composer)
- return;
uids = g_ptr_array_new();
- g_ptr_array_add (uids, g_strdup (data->uid));
-
- gtk_signal_connect (GTK_OBJECT (composer), "send",
- GTK_SIGNAL_FUNC (composer_send_cb), NULL);
-
- mail_do_forward_message (data->msg, data->source, uids, composer, FALSE);
+ g_ptr_array_add(uids, g_strdup (data->uid));
+ forward_messages(data->source, uids, FALSE);
}
static void