From: Colin Leroy Date: Thu, 27 Jan 2005 11:11:16 +0000 (+0000) Subject: 2005-01-27 [colin] 1.0.0cvs18.1 X-Git-Tag: rel_1_9_6~79 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=e3c8d430d143286f90fdf10bd550497e2242db96 2005-01-27 [colin] 1.0.0cvs18.1 * src/messageview.c * src/summaryview.c * src/mainwindow.c * src/compose.c * src/compose.h * src/procmsg.c * src/procmsg.h * src/toolbar.c Sync with HEAD --- diff --git a/ChangeLog-gtk2.claws b/ChangeLog-gtk2.claws index e8f1fd8e1..d37fceca8 100644 --- a/ChangeLog-gtk2.claws +++ b/ChangeLog-gtk2.claws @@ -1,3 +1,15 @@ +2005-01-27 [colin] 1.0.0cvs18.1 + + * src/messageview.c + * src/summaryview.c + * src/mainwindow.c + * src/compose.c + * src/compose.h + * src/procmsg.c + * src/procmsg.h + * src/toolbar.c + Sync with HEAD + 2005-01-26 [paul] 1.0.0cvs15.2 * src/compose.c diff --git a/PATCHSETS b/PATCHSETS index a1983c9d3..0a31e2c15 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -345,3 +345,4 @@ ( cvs diff -u -r 1.654.2.377 -r 1.654.2.378 configure.ac; cvs diff -u -r 1.382.2.86 -r 1.382.2.87 src/compose.c; ) > 1.0.0cvs14.1.patchset ( cvs diff -u -r 1.654.2.378 -r 1.654.2.379 configure.ac; cvs diff -u -r 1.2.4.2 -r 1.2.4.3 src/common/template.c; ) > 1.0.0cvs15.1.patchset ( cvs diff -u -r 1.382.2.87 -r 1.382.2.88 src/compose.c; ) > 1.0.0cvs15.2.patchset +( cvs diff -u -r 1.94.2.38 -r 1.94.2.39 src/messageview.c; cvs diff -u -r 1.395.2.47 -r 1.395.2.48 src/summaryview.c; cvs diff -u -r 1.274.2.27 -r 1.274.2.28 src/mainwindow.c; cvs diff -u -r 1.382.2.88 -r 1.382.2.89 src/compose.c; cvs diff -u -r 1.50.2.6 -r 1.50.2.7 src/compose.h; cvs diff -u -r 1.150.2.18 -r 1.150.2.19 src/procmsg.c; cvs diff -u -r 1.60.2.9 -r 1.60.2.10 src/procmsg.h; cvs diff -u -r 1.43.2.12 -r 1.43.2.13 src/toolbar.c; ) > 1.0.0cvs18.1.patchset diff --git a/configure.ac b/configure.ac index 323ee75cd..81ab4d558 100644 --- a/configure.ac +++ b/configure.ac @@ -11,9 +11,9 @@ MINOR_VERSION=0 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=15 +EXTRA_VERSION=18 EXTRA_RELEASE= -EXTRA_GTK2_VERSION=.2 +EXTRA_GTK2_VERSION=.1 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION} diff --git a/src/compose.c b/src/compose.c index 7c8330712..e557568ba 100644 --- a/src/compose.c +++ b/src/compose.c @@ -7619,3 +7619,38 @@ static void compose_add_field_list( Compose *compose, GList *listAddress ) { * End of Source. */ +void compose_reply_from_messageview(MessageView *msgview, GSList *msginfo_list, + guint action) +{ + gchar *body; + GSList *new_msglist = NULL; + + g_return_if_fail(msgview != NULL); + + g_return_if_fail(msginfo_list != NULL); + + if (g_slist_length(msginfo_list) == 1) { + MimeInfo *mimeinfo = messageview_get_selected_mime_part(msgview); + MsgInfo *orig_msginfo = (MsgInfo *)msginfo_list->data; + + if (mimeinfo != NULL && mimeinfo->type == MIMETYPE_MESSAGE && + !g_ascii_strcasecmp(mimeinfo->subtype, "rfc822")) { + + MsgInfo *tmp_msginfo = procmsg_msginfo_new_from_mimeinfo( + orig_msginfo, mimeinfo); + if (tmp_msginfo != NULL) { + new_msglist = g_slist_append(NULL, tmp_msginfo); + } + } + } + + body = messageview_get_selection(msgview); + + if (new_msglist) { + compose_reply_mode((ComposeMode)action, new_msglist, body); + g_slist_free(new_msglist); + } else + compose_reply_mode((ComposeMode)action, msginfo_list, body); + + g_free(body); +} diff --git a/src/compose.h b/src/compose.h index 146735f64..d9423e321 100644 --- a/src/compose.h +++ b/src/compose.h @@ -33,6 +33,7 @@ typedef struct _AttachInfo AttachInfo; #include "prefs_account.h" #include "undo.h" #include "toolbar.h" +#include "messageview.h" #ifdef USE_ASPELL #include "gtkaspell.h" @@ -281,5 +282,8 @@ void compose_destroy_all (void); void compose_draft (gpointer data); void compose_toolbar_cb (gint action, gpointer data); +void compose_reply_from_messageview (MessageView *msgview, + GSList *msginfo_list, + guint action); #endif /* __COMPOSE_H__ */ diff --git a/src/mainwindow.c b/src/mainwindow.c index 33b7fca34..0073e87b8 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -2476,16 +2476,12 @@ void main_window_reply_cb(MainWindow *mainwin, guint action, { MessageView *msgview = (MessageView*)mainwin->messageview; GSList *msginfo_list = NULL; - gchar *body; g_return_if_fail(msgview != NULL); msginfo_list = summary_get_selection(mainwin->summaryview); g_return_if_fail(msginfo_list != NULL); - - body = messageview_get_selection(msgview); - compose_reply_mode((ComposeMode)action, msginfo_list, body); - g_free(body); + compose_reply_from_messageview(msgview, msginfo_list, action); g_slist_free(msginfo_list); } diff --git a/src/messageview.c b/src/messageview.c index b10c53858..d98eb1448 100644 --- a/src/messageview.c +++ b/src/messageview.c @@ -1380,94 +1380,14 @@ static void compose_cb(gpointer data, guint action, GtkWidget *widget) static void reply_cb(gpointer data, guint action, GtkWidget *widget) { MessageView *messageview = (MessageView *)data; - GSList *mlist = NULL; + GSList *msginfo_list = NULL; MsgInfo *msginfo; - gchar *text = NULL; - ComposeMode mode = (ComposeMode)action; - TextView *textview; - - msginfo = messageview->msginfo; - mlist = g_slist_append(NULL, msginfo); - textview = messageview_get_current_textview(messageview); - text = gtkut_editable_get_selection - (GTK_EDITABLE(textview->text)); - if (text && *text == '\0') { - g_free(text); - text = NULL; - } + g_return_if_fail(messageview->msginfo); - switch (mode) { - case COMPOSE_REPLY: - compose_reply(msginfo, prefs_common.reply_with_quote, - FALSE, prefs_common.default_reply_list, FALSE, text); - break; - case COMPOSE_REPLY_WITH_QUOTE: - compose_reply(msginfo, TRUE, FALSE, prefs_common.default_reply_list, FALSE, text); - break; - case COMPOSE_REPLY_WITHOUT_QUOTE: - compose_reply(msginfo, FALSE, FALSE, prefs_common.default_reply_list, FALSE, NULL); - break; - case COMPOSE_REPLY_TO_SENDER: - compose_reply(msginfo, prefs_common.reply_with_quote, - FALSE, FALSE, TRUE, text); - break; - case COMPOSE_FOLLOWUP_AND_REPLY_TO: - compose_followup_and_reply_to(msginfo, - prefs_common.reply_with_quote, - FALSE, FALSE, text); - break; - case COMPOSE_REPLY_TO_SENDER_WITH_QUOTE: - compose_reply(msginfo, TRUE, FALSE, FALSE, TRUE, text); - break; - case COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE: - compose_reply(msginfo, FALSE, FALSE, FALSE, TRUE, NULL); - break; - case COMPOSE_REPLY_TO_ALL: - compose_reply(msginfo, prefs_common.reply_with_quote, - TRUE, FALSE, FALSE, text); - break; - case COMPOSE_REPLY_TO_ALL_WITH_QUOTE: - compose_reply(msginfo, TRUE, TRUE, FALSE, FALSE, text); - break; - case COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE: - compose_reply(msginfo, FALSE, TRUE, FALSE, FALSE, NULL); - break; - case COMPOSE_REPLY_TO_LIST: - compose_reply(msginfo, prefs_common.reply_with_quote, - FALSE, TRUE, FALSE, text); - break; - case COMPOSE_REPLY_TO_LIST_WITH_QUOTE: - compose_reply(msginfo, TRUE, FALSE, TRUE, FALSE, text); - break; - case COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE: - compose_reply(msginfo, FALSE, FALSE, TRUE, FALSE, NULL); - break; - case COMPOSE_FORWARD: - if (prefs_common.forward_as_attachment) { - compose_reply_mode(COMPOSE_FORWARD_AS_ATTACH, mlist, text); - return; - } else { - compose_reply_mode(COMPOSE_FORWARD_INLINE, mlist, text); - return; - } - break; - case COMPOSE_FORWARD_INLINE: - compose_forward(NULL, msginfo, FALSE, text, FALSE); - break; - case COMPOSE_FORWARD_AS_ATTACH: - compose_forward_multiple(NULL, mlist); - break; - case COMPOSE_REDIRECT: - compose_redirect(NULL, msginfo); - break; - default: - g_warning("compose_reply(): invalid Compose Mode: %d\n", mode); - } - - /* summary_set_marks_selected(summaryview); */ - g_free(text); - g_slist_free(mlist); + msginfo_list = g_slist_append(msginfo_list, messageview->msginfo); + compose_reply_from_messageview(messageview, msginfo_list, action); + g_list_free(msginfo_list); } static void reedit_cb(gpointer data, guint action, GtkWidget *widget) diff --git a/src/procmsg.c b/src/procmsg.c index 023ef34bf..1d69e28de 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -892,8 +892,12 @@ MsgInfo *procmsg_msginfo_get_full_info(MsgInfo *msginfo) if (msginfo == NULL) return NULL; - file = procmsg_get_message_file(msginfo); - if (!file) { + file = procmsg_get_message_file_path(msginfo); + if (!file || !is_file_exist(file)) { + g_free(file); + file = procmsg_get_message_file(msginfo); + } + if (!file || !is_file_exist(file)) { g_warning("procmsg_msginfo_get_full_info(): can't get message file.\n"); return NULL; } @@ -1640,3 +1644,37 @@ gboolean procmsg_msginfo_filter(MsgInfo *msginfo) return FALSE; } + +MsgInfo *procmsg_msginfo_new_from_mimeinfo(MsgInfo *src_msginfo, MimeInfo *mimeinfo) +{ + MsgInfo *tmp_msginfo = NULL; + MsgFlags flags = {0, 0}; + + + if (!mimeinfo || mimeinfo->type != MIMETYPE_MESSAGE || + g_ascii_strcasecmp(mimeinfo->subtype, "rfc822")) { + g_warning("procmsg_msginfo_new_from_mimeinfo(): unsuitable mimeinfo"); + return NULL; + } + + if (mimeinfo->content == MIMECONTENT_MEM) { + gchar *tmpfile = get_tmp_file(); + str_write_to_file(mimeinfo->data.mem, tmpfile); + g_free(mimeinfo->data.mem); + mimeinfo->content == MIMECONTENT_FILE; + mimeinfo->data.filename = g_strdup(tmpfile); + g_free(tmpfile); + } + + tmp_msginfo = procheader_parse_file(mimeinfo->data.filename, + flags, TRUE, FALSE); + + if (tmp_msginfo != NULL) { + tmp_msginfo->folder = src_msginfo->folder; + tmp_msginfo->plaintext_file = g_strdup(mimeinfo->data.filename); + } else { + g_warning("procmsg_msginfo_new_from_mimeinfo(): Can't generate new msginfo"); + } + + return tmp_msginfo; +} diff --git a/src/procmsg.h b/src/procmsg.h index a5b5b7649..7c6a8b2c4 100644 --- a/src/procmsg.h +++ b/src/procmsg.h @@ -306,5 +306,8 @@ void procmsg_update_unread_children (MsgInfo *info, void procmsg_msginfo_set_to_folder (MsgInfo *msginfo, FolderItem *to_folder); gboolean procmsg_msginfo_filter (MsgInfo *msginfo); +MsgInfo *procmsg_msginfo_new_from_mimeinfo + (MsgInfo *src_msginfo, + MimeInfo *mimeinfo); #endif /* __PROCMSG_H__ */ diff --git a/src/summaryview.c b/src/summaryview.c index 63082d22c..2b52d8c85 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -4683,17 +4683,12 @@ static void summary_reply_cb(SummaryView *summaryview, guint action, { MessageView *msgview = (MessageView*)summaryview->messageview; GSList *msginfo_list; - gchar *body; g_return_if_fail(msgview != NULL); msginfo_list = summary_get_selection(summaryview); g_return_if_fail(msginfo_list != NULL); - - body = messageview_get_selection(msgview); - - compose_reply_mode((ComposeMode)action, msginfo_list, body); - g_free(body); + compose_reply_from_messageview(msgview, msginfo_list, action); g_slist_free(msginfo_list); } diff --git a/src/toolbar.c b/src/toolbar.c index 045743dd3..3dc906309 100644 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -1812,7 +1812,6 @@ static void toolbar_reply(gpointer data, guint action) MainWindow *mainwin; MessageView *msgview; GSList *msginfo_list = NULL; - gchar *body; g_return_if_fail(toolbar_item != NULL); @@ -1824,6 +1823,7 @@ static void toolbar_reply(gpointer data, guint action) break; case TOOLBAR_MSGVIEW: msgview = (MessageView*)toolbar_item->parent; + g_return_if_fail(msgview != NULL); msginfo_list = g_slist_append(msginfo_list, msgview->msginfo); break; default: @@ -1831,12 +1831,8 @@ static void toolbar_reply(gpointer data, guint action) } g_return_if_fail(msgview != NULL); - body = messageview_get_selection(msgview); - g_return_if_fail(msginfo_list != NULL); - compose_reply_mode((ComposeMode)action, msginfo_list, body); - - g_free(body); + compose_reply_from_messageview(msgview, msginfo_list, action); g_slist_free(msginfo_list); /* TODO: update reply state ion summaryview */