aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog20
-rw-r--r--mail/em-composer-utils.c99
-rw-r--r--mail/em-composer-utils.h3
-rw-r--r--mail/em-folder-view.c6
-rw-r--r--mail/em-popup.c6
5 files changed, 60 insertions, 74 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index a43937af6f..b323fe106b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,23 @@
+2004-07-23 Not Zed <NotZed@Ximian.com>
+
+ ** See bug #61824.
+
+ * em-popup.c (emp_part_popup_reply_sender)
+ (emp_part_popup_reply_list, emp_part_popup_reply_all): use new
+ api. We have no uid/folder to update here.
+
+ * em-folder-view.c (emfv_message_reply): use new api for replying
+ so we can supply the message content and have flags updated.
+
+ * em-composer-utils.c (em_utils_reply_to_message): added optional
+ folder and uid.
+ (em_utils_reply_to_message_by_uid): removed, use the other
+ interface instead.
+ (reply_to_message): just call reply_to_message if we get a message
+ to reply to.
+ (em_utils_reply_to_message): if no message supplied, load it via
+ the uid.
+
2004-07-22 Not Zed <NotZed@Ximian.com>
* em-utils.c (em_utils_part_to_html, em_utils_message_to_html):
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 6625d45c09..daf4acfde3 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1690,72 +1690,54 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message)
e_msg_composer_drop_editor_undo (composer);
}
+static void
+reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message, void *user_data)
+{
+ if (message != NULL)
+ em_utils_reply_to_message(folder, uid, message, GPOINTER_TO_INT(user_data));
+}
+
/**
* em_utils_reply_to_message:
- * @message: message to reply to
+ * @folder: optional folder
+ * @uid: optional uid
+ * @message: message to reply to, optional
* @mode: reply mode
*
* Creates a new composer ready to reply to @message.
+ *
+ * If @message is NULL then @folder and @uid must be set to the
+ * message to be replied to, it will be loaded asynchronously.
+ *
+ * If @message is non null, then it is used directly, @folder and @uid
+ * may be supplied in order to update the message flags once it has
+ * been replied to.
**/
void
-em_utils_reply_to_message (CamelMimeMessage *message, int mode)
+em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message, int mode)
{
CamelInternetAddress *to = NULL, *cc = NULL;
EMsgComposer *composer;
EAccount *account;
-
- account = guess_account (message, NULL);
-
- switch (mode) {
- case REPLY_MODE_SENDER:
- get_reply_sender (message, &to, NULL);
- break;
- case REPLY_MODE_LIST:
- if (get_reply_list (message, &to))
- break;
- case REPLY_MODE_ALL:
- get_reply_all (message, &to, &cc, NULL);
- break;
- }
-
- composer = reply_get_composer (message, account, to, cc, NULL, NULL);
- e_msg_composer_add_message_attachments (composer, message, TRUE);
-
- if (to != NULL)
- camel_object_unref (to);
-
- if (cc != NULL)
- camel_object_unref (cc);
-
- composer_set_body (composer, message);
-
- em_composer_utils_setup_default_callbacks (composer);
-
- gtk_widget_show (GTK_WIDGET (composer));
- e_msg_composer_unset_changed (composer);
-}
-
-static void
-reply_to_message (CamelFolder *folder, const char *uid, CamelMimeMessage *message, void *user_data)
-{
- CamelInternetAddress *to = NULL, *cc = NULL;
const char *postto = NULL;
- EMsgComposer *composer;
- EAccount *account;
guint32 flags;
- int mode;
-
- if (message == NULL)
+
+ if (folder && uid && message == NULL) {
+ mail_get_message(folder, uid, reply_to_message, GINT_TO_POINTER(mode), mail_thread_new);
return;
-
- mode = GPOINTER_TO_INT (user_data);
+ }
- account = guess_account (message, folder);
+ g_return_if_fail(message != NULL);
+
+ account = guess_account (message, NULL);
flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_SEEN;
switch (mode) {
case REPLY_MODE_SENDER:
- get_reply_sender (message, &to, &postto);
+ if (folder)
+ get_reply_sender (message, &to, &postto);
+ else
+ get_reply_sender (message, &to, NULL);
break;
case REPLY_MODE_LIST:
flags |= CAMEL_MESSAGE_ANSWERED_ALL;
@@ -1763,7 +1745,10 @@ reply_to_message (CamelFolder *folder, const char *uid, CamelMimeMessage *messag
break;
case REPLY_MODE_ALL:
flags |= CAMEL_MESSAGE_ANSWERED_ALL;
- get_reply_all (message, &to, &cc, &postto);
+ if (folder)
+ get_reply_all (message, &to, &cc, &postto);
+ else
+ get_reply_all (message, &to, &cc, NULL);
break;
}
@@ -1784,24 +1769,6 @@ reply_to_message (CamelFolder *folder, const char *uid, CamelMimeMessage *messag
e_msg_composer_unset_changed (composer);
}
-/**
- * em_utils_reply_to_message_by_uid:
- * @folder: folder containing message to reply to
- * @uid: message uid
- * @mode: reply mode
- *
- * Creates a new composer ready to reply to the message referenced by
- * @folder and @uid.
- **/
-void
-em_utils_reply_to_message_by_uid (CamelFolder *folder, const char *uid, int mode)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (uid != NULL);
-
- mail_get_message (folder, uid, reply_to_message, GINT_TO_POINTER (mode), mail_thread_new);
-}
-
/* Posting replies... */
static void
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index df92a3f0c2..df971784fd 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -68,8 +68,7 @@ enum {
REPLY_MODE_LIST
};
-void em_utils_reply_to_message (struct _CamelMimeMessage *message, int mode);
-void em_utils_reply_to_message_by_uid (struct _CamelFolder *folder, const char *uid, int mode);
+void em_utils_reply_to_message (struct _CamelFolder *, const char *uid, struct _CamelMimeMessage *message, int mode);
void em_utils_post_reply_to_message_by_uid (struct _CamelFolder *folder, const char *uid);
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 355398e781..51d5eee890 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -1266,15 +1266,15 @@ emfv_message_reply(EMFolderView *emfv, int mode)
((GString *)state->user_data)->str,
((GString *)state->user_data)->len,
"text/html");
- em_utils_reply_to_message (msg, mode);
+ em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, msg, mode);
camel_object_unref(msg);
} else {
- em_utils_reply_to_message_by_uid (emfv->folder, emfv->list->cursor_uid, mode);
+ em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, NULL, mode);
}
html_engine_save_buffer_free(state);
} else {
- em_utils_reply_to_message_by_uid (emfv->folder, emfv->list->cursor_uid, mode);
+ em_utils_reply_to_message(emfv->folder, emfv->list->cursor_uid, NULL, mode);
}
}
diff --git a/mail/em-popup.c b/mail/em-popup.c
index f4ed82e67e..d33bfe0e81 100644
--- a/mail/em-popup.c
+++ b/mail/em-popup.c
@@ -772,7 +772,7 @@ emp_part_popup_reply_sender (GtkWidget *w, EMPopupTarget *t)
CamelMimeMessage *message;
message = (CamelMimeMessage *) camel_medium_get_content_object ((CamelMedium *) t->data.part.part);
- em_utils_reply_to_message (message, REPLY_MODE_SENDER);
+ em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_SENDER);
}
static void
@@ -781,7 +781,7 @@ emp_part_popup_reply_list (GtkWidget *w, EMPopupTarget *t)
CamelMimeMessage *message;
message = (CamelMimeMessage *) camel_medium_get_content_object ((CamelMedium *) t->data.part.part);
- em_utils_reply_to_message (message, REPLY_MODE_LIST);
+ em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_LIST);
}
static void
@@ -790,7 +790,7 @@ emp_part_popup_reply_all (GtkWidget *w, EMPopupTarget *t)
CamelMimeMessage *message;
message = (CamelMimeMessage *) camel_medium_get_content_object ((CamelMedium *) t->data.part.part);
- em_utils_reply_to_message (message, REPLY_MODE_ALL);
+ em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_ALL);
}
static void