2005-01-27 [colin] 1.0.0cvs18.1
authorColin Leroy <colin@colino.net>
Thu, 27 Jan 2005 11:11:16 +0000 (11:11 +0000)
committerColin Leroy <colin@colino.net>
Thu, 27 Jan 2005 11:11:16 +0000 (11:11 +0000)
* 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

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/compose.c
src/compose.h
src/mainwindow.c
src/messageview.c
src/procmsg.c
src/procmsg.h
src/summaryview.c
src/toolbar.c

index e8f1fd8e1fa5e8e044157efde20b09cff2d36e08..d37fceca8414cd067ae39c270dc43ab147f7ff3b 100644 (file)
@@ -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
index a1983c9d32edd5b658629d7736c4d18f322bdd20..0a31e2c156554e492d2007e4df0dbfd668d924c8 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index 323ee75cd3d545522b5725c709d2be2f84cd9f03..81ab4d558b88d965143a18fbac0c714f1b4bea4d 100644 (file)
@@ -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}
index 7c83307125ee4d16580dc050ea1b541b1995ed8f..e557568ba26945b65f1d22e17e8838507c34d88b 100644 (file)
@@ -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);
+}
index 146735f64dc1f1289c3fb8a65d757bb93c055dff..d9423e3217912028e797376094bf91ee0f8d2d5b 100644 (file)
@@ -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__ */
index 33b7fca34db0af4f9ba3de8d488ec6dc54729b06..0073e87b8d27132028654316c9ebaa0c4b1f7e0f 100644 (file)
@@ -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);
 }
 
index b10c53858645aedc89211c1373f48683fd43b6d8..d98eb1448814f4a7147f8b764520a6889bc87dee 100644 (file)
@@ -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)
index 023ef34bf276aa8adf03acfbd52d9779da743fe8..1d69e28dee89bf39007797f3034923eeaafe5b54 100644 (file)
@@ -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;
+}
index a5b5b764947d28479a9067d459bc9f8ab1639db7..7c6a8b2c4199b5d62ff9b4f961c2a2cc5db803c4 100644 (file)
@@ -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__ */
index 63082d22c3fd0a6c37176e23174e090ff0473209..2b52d8c856cadc428ac0e4c549a2cd2e98faf7b1 100644 (file)
@@ -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);
 }
 
index 045743dd3101b6d88d677f1f5045da34e8c3a66c..3dc906309e44d3ec99ed1171c11673bbfeb49b0f 100644 (file)
@@ -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 */