sync with sylpheed 0.7.0cvs33
authorPaul Mangan <paul@claws-mail.org>
Tue, 5 Feb 2002 13:27:32 +0000 (13:27 +0000)
committerPaul Mangan <paul@claws-mail.org>
Tue, 5 Feb 2002 13:27:32 +0000 (13:27 +0000)
14 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/compose.c
src/foldersel.c
src/folderview.c
src/imap.c
src/mainwindow.c
src/mh.c
src/sourcewindow.c
src/summaryview.c
src/summaryview.h
src/utils.c

index da8feaf..fbf4f29 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2002-02-05
+
+       * src/compose.c: compose_exec_ext_editor_real(): replaced
+         g_strsplit() with strsplit_with_quote().
+       * src/foldersel.c
+         src/folderview.c: folderview_drag_motion_cb(): minor code cleanups.
+       * src/folderview.c:
+         folderview_drag_motion_cb()
+         folderview_drag_received_cb(): allow dropping into IMAP4 folder.
+       * src/utils.c: get_file_size_as_crlf(): use fgets() instead of
+         fread().
+       * src/imap.c
+         imap_copy_msg()
+         imap_copy_msgs_with_dest(): use imap_add_msg() if the source
+         of the message is different from the current mailbox.
+         Return the correct value.
+         imap_cmd_append(): properly implemented the APPEND command.
+
 2002-02-04
 
        * src/mainwindow.c
@@ -8,6 +26,19 @@
        * src/mainwindow.c
          src/prefs_common.c: changed the default shortcut of 'compose new
          message'.
+       * src/mainwindow.c
+         src/summaryview.[ch]: summary_display_msg_selected(): new.
+         Show the selected message if 'Show all header' is selected.
+       * src/mh.c
+         src/sourcewindow.c: changed some procmsg_get_message_file_path()
+         to procmsg_get_message_file() to be sure the message is
+         retrieved.
+       * src/folderview.c: folderview_drag_motion_cb(): allow DnD from
+         any folder to MH folder.
+         folderview_drag_received_cb(): copy messages instead of moving
+         if the source folder is news or IMAP.
+       * src/mainwindow.c
+         src/summaryview.c: allow copy from news folder.
 
 2002-02-03
 
index 963ca3a..65f038f 100644 (file)
@@ -1,3 +1,8 @@
+2002-02-05 [paul]      0.7.0claws49
+
+       * sync with sylpheed 0.7.0cvs33
+               see ChangeLog entries 2002-02-04 (last 4 entries) and 2002-02-05
+
 2002-02-05 [paul]      0.7.0claws48
 
        * src/compose.c
index 96a0f25..e5d9047 100644 (file)
@@ -1,3 +1,22 @@
+2002-02-05
+
+       * src/compose.c: compose_exec_ext_editor_real(): g_strsplit() ¤ò
+         strsplit_with_quote() ¤ÇÃÖ¤­´¹¤¨¤¿¡£
+       * src/foldersel.c
+         src/folderview.c: folderview_drag_motion_cb(): ¾¯¤·¥³¡¼¥É¤ÎÀ°Íý¡£
+       * src/folderview.c:
+         folderview_drag_motion_cb()
+         folderview_drag_received_cb(): IMAP4 ¥Õ¥©¥ë¥À¤Ø¤Î¥É¥í¥Ã¥×¤ò²Äǽ
+         ¤Ë¤·¤¿¡£
+       * src/utils.c: get_file_size_as_crlf(): fread() ¤ÎÂå¤ï¤ê¤Ë fgets()
+         ¤ò»ÈÍÑ¡£
+       * src/imap.c
+         imap_copy_msg()
+         imap_copy_msgs_with_dest(): ¥á¥Ã¥»¡¼¥¸¤Î¥½¡¼¥¹¤¬¸½ºß¤Î¥á¡¼¥ë
+         ¥Ü¥Ã¥¯¥¹¤È°Û¤Ê¤Ã¤Æ¤¤¤ì¤Ð imap_add_msg() ¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+         Àµ¤·¤¤ÃͤòÊÖ¤¹¤è¤¦¤Ë¤·¤¿¡£
+         imap_cmd_append(): APPEND ¥³¥Þ¥ó¥É¤òÀµ¤·¤¯¼ÂÁõ¡£
+
 2002-02-04
 
        * src/mainwindow.c
@@ -8,6 +27,21 @@
        * src/mainwindow.c
          src/prefs_common.c: ¡Ö¿·µ¬¥á¥Ã¥»¡¼¥¸¤òºîÀ®¡×¤Î¥Ç¥Õ¥©¥ë¥È¤Î
          ¥·¥ç¡¼¥È¥«¥Ã¥È¤òÊѹ¹¡£
+       * src/mainwindow.c
+         src/summaryview.[ch]: summary_display_msg_selected(): ¿·µ¬¡£
+         ¡ÖÁ´¤Æ¤Î¥Ø¥Ã¥À¤òɽ¼¨¡×¤òÁªÂò¤·¤¿¤éÁªÂò¤µ¤ì¤¿¥á¥Ã¥»¡¼¥¸¤òɽ¼¨
+         ¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/mh.c
+         src/sourcewindow.c: ¤¤¤¯¤Ä¤«¤Î procmsg_get_message_file_path()
+         ¤ò procmsg_get_message_file() ¤ËÊѹ¹¤·¡¢¥á¥Ã¥»¡¼¥¸¤¬³Î¼Â¤Ë
+         ¼èÆÀ¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/folderview.c: folderview_drag_motion_cb(): Ç¤°Õ¤Î¥Õ¥©¥ë¥À
+         ¤«¤é MH ¥Õ¥©¥ë¥À¤Ø¤Î DnD ¤òµö²Ä¡£
+         folderview_drag_received_cb(): ¥É¥é¥Ã¥°¸µ¥Õ¥©¥ë¥À¤¬¥Ë¥å¡¼¥¹
+         ¤¢¤ë¤¤¤Ï IMAP ¤Î¾ì¹ç¥á¥Ã¥»¡¼¥¸¤ò°ÜÆ°¤¹¤ë¤«¤ï¤ê¤Ë¥³¥Ô¡¼¤¹¤ë¤è¤¦¤Ë
+         ¤·¤¿¡£
+       * src/mainwindow.c
+         src/summaryview.c: ¥Ë¥å¡¼¥¹¥Õ¥©¥ë¥À¤«¤é¤Î¥³¥Ô¡¼¤òµö²Ä¡£
 
 2002-02-03
 
index ed55d02..fbcf7a9 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws48
+EXTRA_VERSION=claws49
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 247ced0..5b32266 100644 (file)
@@ -5497,7 +5497,7 @@ static gint compose_exec_ext_editor_real(const gchar *file)
                g_snprintf(buf, sizeof(buf), def_cmd, file);
        }
 
-       cmdline = g_strsplit(buf, " ", 1024);
+       cmdline = strsplit_with_quote(buf, " ", 1024);
        execvp(cmdline[0], cmdline);
 
        perror("execvp");
index 6d21250..64c45f7 100644 (file)
@@ -63,17 +63,26 @@ static FolderItem *folder_item;
 
 static gboolean cancelled;
 
-static void foldersel_create(void);
-static void foldersel_init(void);
-static void foldersel_set_tree(Folder *cur_folder);
-static void foldersel_selected(GtkCList *clist, gint row, gint column,
-                              GdkEvent *event, gpointer data);
-
-static void foldersel_ok(GtkButton *button, gpointer data);
-static void foldersel_cancel(GtkButton *button, gpointer data);
-static void foldersel_activated(void);
-static gint delete_event(GtkWidget *widget, GdkEventAny *event, gpointer data);
-static void key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data);
+static void foldersel_create   (void);
+static void foldersel_init     (void);
+static void foldersel_set_tree (Folder         *cur_folder);
+static void foldersel_selected (GtkCList       *clist,
+                                gint            row,
+                                gint            column,
+                                GdkEvent       *event,
+                                gpointer        data);
+
+static void foldersel_ok       (GtkButton      *button,
+                                gpointer        data);
+static void foldersel_cancel   (GtkButton      *button,
+                                gpointer        data);
+static void foldersel_activated        (void);
+static gint delete_event       (GtkWidget      *widget,
+                                GdkEventAny    *event,
+                                gpointer        data);
+static void key_pressed                (GtkWidget      *widget,
+                                GdkEventKey    *event,
+                                gpointer        data);
 
 FolderItem *foldersel_folder_sel(Folder *cur_folder,
                                 const gchar *default_folder)
index d3a3f21..6628c07 100644 (file)
@@ -2297,29 +2297,24 @@ static gboolean folderview_drag_motion_cb(GtkWidget      *widget,
                                          FolderView     *folderview)
 {
        gint row, column;
-       FolderItem *item, *current_item;
+       FolderItem *item, *src_item;
        GtkCTreeNode *node = NULL;
        gboolean acceptable = FALSE;
 
-       if (gtk_clist_get_selection_info(GTK_CLIST(widget),
-                                        x - 24, y - 24, &row, &column)) {
+       if (gtk_clist_get_selection_info
+               (GTK_CLIST(widget), x - 24, y - 24, &row, &column)) {
                node = gtk_ctree_node_nth(GTK_CTREE(widget), row);
                item = gtk_ctree_node_get_row_data(GTK_CTREE(widget), node);
-               current_item = folderview->summaryview->folder_item;
-               if (item != NULL &&
-                   item->path != NULL &&
-                   current_item != NULL &&
-                   current_item != item) {
-                       switch (item->folder->type){
+               src_item = folderview->summaryview->folder_item;
+               if (item && item->folder && item->path &&
+                   src_item && src_item != item) {
+                       switch (item->folder->type) {
                        case F_MH:
-                               if (current_item->folder->type == F_MH)
-                                   acceptable = TRUE;
-                               break;
                        case F_IMAP:
-                               if (current_item->folder->account == item->folder->account)
-                                   acceptable = TRUE;
+                               acceptable = TRUE;
                                break;
                        default:
+                               break;
                        }
                }
        }
@@ -2357,16 +2352,17 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
                                        FolderView       *folderview)
 {
        gint row, column;
-       FolderItem *item;
+       FolderItem *item, *src_item;
        GtkCTreeNode *node;
 
-       if (gtk_clist_get_selection_info(GTK_CLIST(widget),
-                                        x - 24, y - 24, &row, &column) == 0)
+       if (gtk_clist_get_selection_info
+               (GTK_CLIST(widget), x - 24, y - 24, &row, &column) == 0)
                return;
 
        node = gtk_ctree_node_nth(GTK_CTREE(widget), row);
        item = gtk_ctree_node_get_row_data(GTK_CTREE(widget), node);
-       if (item != NULL) {
+       src_item = folderview->summaryview->folder_item;
+       if (item && src_item) {
                switch (drag_context->action) {
                        case GDK_ACTION_COPY:
                                summary_copy_selected_to(folderview->summaryview, item);
@@ -2375,9 +2371,13 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
                        case GDK_ACTION_MOVE:
                        case GDK_ACTION_DEFAULT:
                        default:
-                               summary_move_selected_to(folderview->summaryview, item);
-                               gtk_drag_finish(drag_context, TRUE, TRUE, time);
-                               break;
+               if (src_item->folder->type != item->folder->type ||
+                   (src_item->folder->type == F_IMAP &&
+                    src_item->folder != item->folder))
+                       summary_copy_selected_to(folderview->summaryview, item);
+               else
+                       summary_move_selected_to(folderview->summaryview, item);
+               gtk_drag_finish(drag_context, TRUE, TRUE, time);
                }
        } else
                gtk_drag_finish(drag_context, FALSE, FALSE, time);
index fba1032..e9ea649 100644 (file)
@@ -33,7 +33,6 @@
 #include <time.h>
 
 #include "intl.h"
-#include "prefs_account.h"
 #include "imap.h"
 #include "socket.h"
 #include "ssl.h"
@@ -42,6 +41,7 @@
 #include "procheader.h"
 #include "folder.h"
 #include "statusbar.h"
+#include "prefs_account.h"
 #include "codeconv.h"
 #include "utils.h"
 #include "inputdialog.h"
@@ -610,7 +610,7 @@ gint imap_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
                        FILE_OP_ERROR(file, "unlink");
        }
 
-       return dest->last_num;
+       return 0;
 }
 
 static gint imap_do_copy(Folder *folder, FolderItem *dest, MsgInfo *msginfo,
@@ -655,7 +655,10 @@ static gint imap_do_copy(Folder *folder, FolderItem *dest, MsgInfo *msginfo,
        g_free(destdir);
        statusbar_pop_all();
 
-       return ok;
+       if (ok == IMAP_SUCCESS)
+               return 0;
+       else
+               return -1;
 }
 
 static gint imap_do_copy_msgs_with_dest(Folder *folder, FolderItem *dest, 
@@ -666,7 +669,7 @@ static gint imap_do_copy_msgs_with_dest(Folder *folder, FolderItem *dest,
        GSList *cur;
        MsgInfo *msginfo;
        IMAPSession *session;
-       gint ok;
+       gint ok = IMAP_SUCCESS;
 
        g_return_val_if_fail(folder != NULL, -1);
        g_return_val_if_fail(dest != NULL, -1);
@@ -710,7 +713,10 @@ static gint imap_do_copy_msgs_with_dest(Folder *folder, FolderItem *dest,
        g_free(destdir);
        statusbar_pop_all();
 
-       return IMAP_SUCCESS;
+       if (ok == IMAP_SUCCESS)
+               return 0;
+       else
+               return -1;
 }
 
 gint imap_move_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
@@ -726,13 +732,50 @@ gint imap_move_msgs_with_dest(Folder *folder, FolderItem *dest,
 
 gint imap_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
 {
-       return imap_do_copy(folder, dest, msginfo, FALSE);
+       gchar *srcfile;
+       gint ret = 0;
+
+       g_return_val_if_fail(folder != NULL, -1);
+       g_return_val_if_fail(dest != NULL, -1);
+       g_return_val_if_fail(msginfo != NULL, -1);
+       g_return_val_if_fail(msginfo->folder != NULL, -1);
+
+       if (folder == msginfo->folder->folder)
+               return imap_do_copy(folder, dest, msginfo, FALSE);
+
+       srcfile = procmsg_get_message_file(msginfo);
+       if (!srcfile) return -1;
+
+       ret = imap_add_msg(folder, dest, srcfile, FALSE);
+
+       g_free(srcfile);
+
+       return ret;
 }
 
 gint imap_copy_msgs_with_dest(Folder *folder, FolderItem *dest, 
                              GSList *msglist)
 {
-       return imap_do_copy_msgs_with_dest(folder, dest, msglist, FALSE);
+       MsgInfo *msginfo;
+       GSList *cur;
+       gint ret = 0;
+
+       g_return_val_if_fail(folder != NULL, -1);
+       g_return_val_if_fail(dest != NULL, -1);
+       g_return_val_if_fail(msglist != NULL, -1);
+
+       msginfo = (MsgInfo *)msglist->data;
+       if (folder == msginfo->folder->folder)
+               return imap_do_copy_msgs_with_dest
+                       (folder, dest, msglist, FALSE);
+
+       for (cur = msglist; cur != NULL; cur = cur->next) {
+               msginfo = (MsgInfo *)msglist->data;
+               ret = imap_copy_msg(folder, dest, msginfo);
+               if (ret != 0) break;
+       }
+
+       return ret;
 }
 
 gint imap_remove_msg(Folder *folder, FolderItem *item, gint uid)
@@ -1411,6 +1454,12 @@ static SockInfo *imap_open(const gchar *server, gushort port)
 static SockInfo *imap_init_sock(SockInfo *sock)
 {
        imap_cmd_count = 0;
+
+       if (imap_cmd_noop(sock) != IMAP_SUCCESS) {
+               sock_close(sock);
+               return NULL;
+       }
+
        return sock;
 }
 
@@ -2286,19 +2335,48 @@ static gint imap_cmd_append(SockInfo *sock, const gchar *destfolder,
        gint ok;
        gint size;
        gchar *destfolder_;
+       gchar buf[BUFFSIZE];
+       FILE *fp;
 
        g_return_val_if_fail(file != NULL, IMAP_ERROR);
 
        size = get_file_size_as_crlf(file);
+       if ((fp = fopen(file, "r")) == NULL) {
+               FILE_OP_ERROR(file, "fopen");
+               return -1;
+       }
        QUOTE_IF_REQUIRED(destfolder_, destfolder);
-       imap_cmd_gen_send(sock, "APPEND %s {%d}", destfolder_, size);
-       ok = imap_cmd_ok(sock, NULL);
-       if (ok != IMAP_SUCCESS) {
+       imap_cmd_gen_send(sock, "APPEND %s (\\Seen) {%d}", destfolder_, size);
+
+       ok = imap_cmd_gen_recv(sock, buf, sizeof(buf));
+       if (ok != IMAP_SUCCESS || buf[0] != '+' || buf[1] != ' ') {
                log_warning(_("can't append %s to %s\n"), file, destfolder_);
+               fclose(fp);
+               return IMAP_ERROR;
+       }
+
+       log_print("IMAP4> %s\n", _("(sending file...)"));
+
+       while (fgets(buf, sizeof(buf), fp) != NULL) {
+               strretchomp(buf);
+               if (sock_puts(sock, buf) < 0) {
+                       fclose(fp);
+                       sock_close(sock);
+                       return -1;
+               }
+       }
+
+       if (ferror(fp)) {
+               FILE_OP_ERROR(file, "fgets");
+               fclose(fp);
+               sock_close(sock);
                return -1;
        }
 
-       return ok;
+       sock_puts(sock, "");
+
+       fclose(fp);
+       return imap_cmd_ok(sock, NULL);
 }
 
 static gint imap_cmd_copy(SockInfo *sock, guint32 uid, const gchar *destfolder)
index 58f50a6..4c30eea 100644 (file)
@@ -1074,7 +1074,7 @@ void main_window_reflect_prefs_all(void)
                else
                        gtk_widget_show(mainwin->exec_btn);
 
-               summary_redisplay_msg(mainwin->summaryview, FALSE);
+               summary_redisplay_msg(mainwin->summaryview);
                headerview_set_visibility(mainwin->messageview->headerview,
                                          prefs_common.display_header_pane);
        }
@@ -1365,11 +1365,12 @@ typedef enum
        M_EXEC                = 1 << 4,
        M_ALLOW_REEDIT        = 1 << 5,
        M_HAVE_ACCOUNT        = 1 << 6,
-       M_THREADED            = 1 << 7,
+       M_THREADED            = 1 << 7,
        M_UNTHREADED          = 1 << 8,
-       M_NEWS                = 1 << 9,
-       M_HAVE_NEWS_ACCOUNT   = 1 << 10,
-       M_HIDE_READ_MSG       = 1 << 11
+       M_ALLOW_DELETE        = 1 << 9,
+       M_NEWS                = 1 << 10,
+       M_HAVE_NEWS_ACCOUNT   = 1 << 11,
+       M_HIDE_READ_MSG       = 1 << 12
 } SensitiveCond;
 
 static SensitiveCond main_window_get_current_state(MainWindow *mainwin)
@@ -1386,10 +1387,13 @@ static SensitiveCond main_window_get_current_state(MainWindow *mainwin)
        if (selection != SUMMARY_NONE)
                state |= M_MSG_EXIST;
        if (item) {
+               state |= M_EXEC;
                if (item->threaded)
                        state |= M_THREADED;
                else
-                       state |= M_UNTHREADED;
+                       state |= M_UNTHREADED;  
+               if (item->folder->type != F_NEWS)
+                       state |= M_ALLOW_DELETE;
 
                if (selection == SUMMARY_NONE && item->hide_read_msgs
                    || selection != SUMMARY_NONE)
@@ -1400,8 +1404,6 @@ static SensitiveCond main_window_get_current_state(MainWindow *mainwin)
                state |= M_TARGET_EXIST;
        if (selection == SUMMARY_SELECTED_SINGLE)
                state |= M_SINGLE_TARGET_EXIST;
-       if (item && item->folder->type != F_NEWS)
-               state |= M_EXEC;
        if (mainwin->summaryview->folder_item &&
            mainwin->summaryview->folder_item->folder->type == F_NEWS)
                state |= M_NEWS;
@@ -1444,7 +1446,7 @@ void main_window_set_toolbar_sensitive(MainWindow *mainwin)
                /* {mainwin->prefs_btn      , M_UNLOCKED},
                {mainwin->account_btn    , M_UNLOCKED}, */
                {mainwin->next_btn        , M_MSG_EXIST},
-               {mainwin->delete_btn      , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
+               {mainwin->delete_btn      , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
                {mainwin->exec_btn        , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
                {NULL, 0}
        };
@@ -1510,11 +1512,11 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/Message/Forward"               , M_HAVE_ACCOUNT|M_TARGET_EXIST},
                {"/Message/Bounce"                , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
                {"/Message/Re-edit"               , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
-               {"/Message/Move..."               , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
+               {"/Message/Move..."               , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
                {"/Message/Copy..."               , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
-               {"/Message/Delete"                , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
+               {"/Message/Delete"                , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
                {"/Message/Mark"                  , M_TARGET_EXIST},
-               {"/Message/Delete duplicated messages", M_MSG_EXIST|M_EXEC|M_UNLOCKED},
+               {"/Message/Delete duplicated messages", M_MSG_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
 
                {"/Tool/Add sender to address book", M_SINGLE_TARGET_EXIST},
                {"/Tool/Filter messages"           , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
@@ -2614,7 +2616,7 @@ static void view_source_cb(MainWindow *mainwin, guint action,
 static void show_all_header_cb(MainWindow *mainwin, guint action,
                               GtkWidget *widget)
 {
-       summary_redisplay_msg(mainwin->summaryview, TRUE);
+       summary_display_msg_selected(mainwin->summaryview, TRUE);
 }
 
 static void reedit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
@@ -2665,7 +2667,7 @@ static void set_charset_cb(MainWindow *mainwin, guint action,
        g_free(prefs_common.force_charset);
        prefs_common.force_charset = str ? g_strdup(str) : NULL;
 
-       summary_redisplay_msg(mainwin->summaryview, FALSE);
+       summary_redisplay_msg(mainwin->summaryview);
 
        debug_print(_("forced charset: %s\n"), str ? str : "Auto-Detect");
 }
index eeb7fc6..1ad48c9 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -269,7 +269,7 @@ gint mh_move_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        debug_print(_("Moving message %s%c%d to %s ...\n"),
                    msginfo->folder->path, G_DIR_SEPARATOR,
                    msginfo->msgnum, dest->path);
-       srcfile = procmsg_get_message_file_path(msginfo);
+       srcfile = procmsg_get_message_file(msginfo);
 
        destfile = mh_get_newmsg_filename(dest);
        if(!destfile) return -1;
@@ -366,7 +366,7 @@ gint mh_move_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
                            msginfo->folder->path, G_DIR_SEPARATOR,
                            msginfo->msgnum, dest->path);
 
-               srcfile = procmsg_get_message_file_path(msginfo);
+               srcfile = procmsg_get_message_file(msginfo);
                destfile = mh_get_newmsg_filename(dest);
                if(!destfile) return -1;
 
@@ -437,7 +437,7 @@ gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        debug_print(_("Copying message %s%c%d to %s ...\n"),
                    msginfo->folder->path, G_DIR_SEPARATOR,
                    msginfo->msgnum, dest->path);
-       srcfile = procmsg_get_message_file_path(msginfo);
+       srcfile = procmsg_get_message_file(msginfo);
        destfile = mh_get_newmsg_filename(dest);
        if(!destfile) {
                g_free(srcfile);
@@ -584,7 +584,7 @@ gint mh_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
                            msginfo->folder->path, G_DIR_SEPARATOR,
                            msginfo->msgnum, dest->path);
 
-               srcfile = procmsg_get_message_file_path(msginfo);
+               srcfile = procmsg_get_message_file(msginfo);
                destfile = mh_get_newmsg_filename(dest);
                if(!destfile) {
                        g_free(srcfile);
index 44cfd1d..95987fe 100644 (file)
@@ -129,7 +129,7 @@ void source_window_show_msg(SourceWindow *sourcewin, MsgInfo *msginfo)
 
        g_return_if_fail(msginfo != NULL);
 
-       file = procmsg_get_message_file_path(msginfo);
+       file = procmsg_get_message_file(msginfo);
        g_return_if_fail(file != NULL);
 
        if ((fp = fopen(file, "r")) == NULL) {
index bdf7bcc..550985a 100644 (file)
@@ -1037,10 +1037,10 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
 
        if (summaryview->folder_item->folder->type != F_NEWS) {
                menu_set_sensitive(ifactory, "/Move...", TRUE);
-               menu_set_sensitive(ifactory, "/Copy...", TRUE);
                menu_set_sensitive(ifactory, "/Delete", TRUE);
        }
 
+       menu_set_sensitive(ifactory, "/Copy...", TRUE);
        menu_set_sensitive(ifactory, "/Execute", TRUE);
 
         menu_set_sensitive(ifactory, "/Mark", TRUE);
@@ -2378,14 +2378,22 @@ static void summary_display_msg_full(SummaryView *summaryview,
        summary_unlock(summaryview);
 }
 
-void summary_redisplay_msg(SummaryView *summaryview, gboolean all_headers)
+void summary_display_msg_selected(SummaryView *summaryview,
+                                 gboolean all_headers)
+{
+       summaryview->displayed = NULL;
+       summary_display_msg_full(summaryview, summaryview->selected, FALSE,
+                                all_headers);
+}
+
+void summary_redisplay_msg(SummaryView *summaryview)
 {
        GtkCTreeNode *node;
 
        if (summaryview->displayed) {
                node = summaryview->displayed;
                summaryview->displayed = NULL;
-               summary_display_msg_full(summaryview, node, FALSE, all_headers);
+               summary_display_msg(summaryview, node);
        }
 }
 
@@ -3188,8 +3196,7 @@ void summary_copy_selected_to(SummaryView *summaryview, FolderItem *to_folder)
        GList *cur;
 
        if (!to_folder) return;
-       if (!summaryview->folder_item ||
-           summaryview->folder_item->folder->type == F_NEWS) return;
+       if (!summaryview->folder_item) return;
 
        if (summary_is_locked(summaryview)) return;
 
@@ -3219,8 +3226,7 @@ void summary_copy_to(SummaryView *summaryview)
 {
        FolderItem *to_folder;
 
-       if (!summaryview->folder_item ||
-           summaryview->folder_item->folder->type == F_NEWS) return;
+       if (!summaryview->folder_item) return;
 
        to_folder = foldersel_folder_sel(NULL, NULL);
        summary_copy_selected_to(summaryview, to_folder);
@@ -3332,8 +3338,7 @@ gboolean summary_execute(SummaryView *summaryview)
        GtkCList *clist = GTK_CLIST(summaryview->ctree);
        GtkCTreeNode *node, *next;
 
-       if (!summaryview->folder_item ||
-           summaryview->folder_item->folder->type == F_NEWS) return FALSE;
+       if (!summaryview->folder_item) return FALSE;
 
        if (summary_is_locked(summaryview)) return FALSE;
        summary_lock(summaryview);
@@ -3863,7 +3868,7 @@ static void summary_filter_func(GtkCTree *ctree, GtkCTreeNode *node,
 
        if (global_processing == NULL) {
                /* old filtering */
-               file = procmsg_get_message_file_path(msginfo);
+               file = procmsg_get_message_file(msginfo);
                dest = filter_get_dest_folder(prefs_common.fltlist, file);
                g_free(file);
 
@@ -4389,7 +4394,7 @@ void summary_set_column_order(SummaryView *summaryview)
        if (!summaryview->displayed)
                messageview_clear(summaryview->messageview);
        else
-               summary_redisplay_msg(summaryview, TRUE);
+               summary_redisplay_msg(summaryview);
 }
 
 
@@ -4605,7 +4610,7 @@ static void summary_execute_cb(SummaryView *summaryview, guint action,
 static void summary_show_all_header_cb(SummaryView *summaryview,
                                       guint action, GtkWidget *widget)
 {
-       summary_redisplay_msg(summaryview, TRUE);
+       summary_display_msg_selected(summaryview, TRUE);
 }
 
 static void summary_add_address_cb(SummaryView *summaryview,
@@ -4676,9 +4681,7 @@ static void summary_start_drag(GtkWidget *widget, gint button, GdkEvent *event,
        g_return_if_fail(summaryview != NULL);
        g_return_if_fail(summaryview->folder_item != NULL);
        g_return_if_fail(summaryview->folder_item->folder != NULL);
-       if (summaryview->folder_item->folder->type == F_NEWS ||
-           summaryview->selected == NULL)
-               return;
+       if (summaryview->selected == NULL) return;
 
        list = gtk_target_list_new(summary_drag_types, 1);
 
@@ -4704,7 +4707,7 @@ static void summary_drag_data_get(GtkWidget        *widget,
                     cur != NULL; cur = cur->next) {
                        msginfo = gtk_ctree_node_get_row_data
                                (ctree, GTK_CTREE_NODE(cur->data));
-                       tmp2 = procmsg_get_message_file_path(msginfo);
+                       tmp2 = procmsg_get_message_file(msginfo);
                        if (!tmp2) continue;
                        tmp1 = g_strconcat("file:/", tmp2, NULL);
                        g_free(tmp2);
index 8093c24..a33b4bb 100644 (file)
@@ -215,8 +215,9 @@ gint summary_write_cache      (SummaryView          *summaryview);
 void summary_pass_key_press_event (SummaryView         *summaryview,
                                   GdkEventKey          *event);
 
-void summary_redisplay_msg       (SummaryView          *summaryview,
+void summary_display_msg_selected (SummaryView         *summaryview,
                                   gboolean              all_headers);
+void summary_redisplay_msg       (SummaryView          *summaryview);
 void summary_open_msg            (SummaryView          *summaryview);
 void summary_view_source         (SummaryView          *summaryview);
 void summary_reedit              (SummaryView          *summaryview);
index 74843a3..8d7ce66 100644 (file)
@@ -1303,41 +1303,20 @@ off_t get_file_size_as_crlf(const gchar *file)
 {
        FILE *fp;
        off_t size = 0;
-       gint left;
-       gint line_len;
-       gchar buf[BUFSIZ];
-       gchar *p, *prev;
+       gchar buf[BUFFSIZE];
 
        if ((fp = fopen(file, "r")) == NULL) {
                FILE_OP_ERROR(file, "fopen");
                return -1;
        }
 
-       while ((left = fread(buf, sizeof(gchar), sizeof(buf), fp)) > 0) {
-               prev = buf;
-
-               if (left < sizeof(buf) && ferror(fp))
-                       break;
-
-               do {
-                       p = memchr(prev, '\n', left);
-                       if (p != NULL) {
-                               line_len = p - prev;
-                               if (p > buf && *(p - 1) == '\r')
-                                       size += line_len + 1;
-                               else
-                                       size += line_len + 2;
-                               left -= line_len + 1;
-                               prev = p + 1;
-                       } else {
-                               size += left;
-                               break;
-                       }
-               } while (left > 0);
+       while (fgets(buf, sizeof(buf), fp) != NULL) {
+               strretchomp(buf);
+               size += strlen(buf) + 2;
        }
 
        if (ferror(fp)) {
-               FILE_OP_ERROR(file, "fread");
+               FILE_OP_ERROR(file, "fgets");
                size = -1;
        }