sync with 0.7.4cvs49
authorPaul Mangan <paul@claws-mail.org>
Sun, 21 Apr 2002 09:24:27 +0000 (09:24 +0000)
committerPaul Mangan <paul@claws-mail.org>
Sun, 21 Apr 2002 09:24:27 +0000 (09:24 +0000)
13 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/Makefile.am
src/folder.c
src/imap.c
src/inputdialog.c
src/inputdialog.h
src/mh.c
src/mimeview.c
src/utils.c
src/utils.h

index 4aa161bf2d9afa18f013110194267c99dad21757..0e2ab4b9ad763b760e2c13608413e9ba8a641a0e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2002-04-21
+
+       * src/mh.c: mh_get_new_msg_filename(): new. It returns the filename
+         for new message.
+         mh_add_msg()
+         mh_do_move()
+         mh_do_move_msgs_with_dest()
+         mh_copy_msg()
+         mh_copy_msgs_with_dest(): use mh_get_new_msg_filename().
+       * src/utils.[ch]: added is_file_entry_exist() which returns TRUE
+         if stat() succeeded.
+       * src/imap.c:
+         imap_fetch_msg(): SELECT mailbox before FETCH if required.
+         imap_scan_folder(): set last_num using the value of UIDNEXT.
+         imap_select(): return immediately if there is no need for SELECT.
+         preserve the path of currently selected mailbox.
+         imap_status(): added UIDNEXT.
+
+2002-04-20
+
+       * src/folder.c: folder_item_scan(): removed the warning.
+       * src/inputdialog.[ch]: input_dialog_combo(): added an argument for
+         setting case sensitivity.
+
 2002-04-17
 
        * src/mainwindow.c: main_window_create(): restrict the minimum size.
 2002-04-17
 
        * src/mainwindow.c: main_window_create(): restrict the minimum size.
index bf20ca403a0a52f515c57ef1271d1a99667dc828..f8358c0ca894c61bd6695915f3e0e7c55c6507d2 100644 (file)
@@ -1,3 +1,12 @@
+2002-04-21 [paul]      0.7.4claws85
+
+       * sync with 0.7.4cvs49
+               see ChangeLog entries 2002-04-20 and 2002-04-21
+
+       * src/Makefile.am
+               clean up: remove old 'stock_' element from xpm 
+               filenames.
+
 2002-04-21 [alfons]    0.7.4claws84
 
        apply sync patch from Paul
 2002-04-21 [alfons]    0.7.4claws84
 
        apply sync patch from Paul
index 0738d08ebe81371bc421043b7fd1c69b2cfc0c0b..24f032a95a427370f7e727452bbd328427540477 100644 (file)
@@ -1,3 +1,28 @@
+2002-04-21
+
+       * src/mh.c: mh_get_new_msg_filename(): ¿·µ¬¡£¿·µ¬¥á¥Ã¥»¡¼¥¸¤Î¥Õ¥¡¥¤¥ë
+         Ì¾¤òÊÖ¤¹¡£
+         mh_add_msg()
+         mh_do_move()
+         mh_do_move_msgs_with_dest()
+         mh_copy_msg()
+         mh_copy_msgs_with_dest(): mh_get_new_msg_filename() ¤ò»ÈÍÑ¡£
+       * src/utils.[ch]: is_file_entry_exist() ¤òÄɲᣠstat() ¤¬À®¸ù¤·¤¿¤é
+         TRUE ¤òÊÖ¤¹¡£
+       * src/imap.c:
+         imap_fetch_msg(): É¬ÍפǤ¢¤ì¤Ð FETCH ¤ÎÁ°¤Ë¥á¡¼¥ë¥Ü¥Ã¥¯¥¹¤ò SELECT
+         ¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+         imap_scan_folder(): UIDNEXT ¤ÎÃͤòÍѤ¤¤Æ last_num ¤ò¥»¥Ã¥È¡£
+         imap_select(): SELECT ¤ÎɬÍפ¬¤Ê¤±¤ì¤Ð¤¹¤°¤ËÊÖ¤ë¤è¤¦¤Ë¤·¤¿¡£
+         ¸½ºßÁªÂòÃæ¤Î¥á¡¼¥ë¥Ü¥Ã¥¯¥¹¤Î¥Ñ¥¹¤òÊݸ¡£
+         imap_status(): UIDNEXT ¤òÄɲá£
+
+2002-04-20
+
+       * src/folder.c: folder_item_scan(): ·Ù¹ð¤ò½üµî¡£
+       * src/inputdialog.[ch]: input_dialog_combo(): Â羮ʸ»ú¤Î¶èÊ̤λØÄê¤Î
+         ¤¿¤á¤Î°ú¿ô¤òÄɲá£
+
 2002-04-17
 
        * src/mainwindow.c: main_window_create(): ºÇ¾®¥µ¥¤¥º¤òÀ©¸Â¡£
 2002-04-17
 
        * src/mainwindow.c: main_window_create(): ºÇ¾®¥µ¥¤¥º¤òÀ©¸Â¡£
index 9b94b00aaeb8c20a48badc9c146267d7e20c88b7..69da0eb1b8808cecac7df0178c82fdce268cf2b1 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws84
+EXTRA_VERSION=claws85
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 4672f9041b5ccef2a6ed06aadeeaea2d14a24102..69572941ad57c8c2350185f27626ce96e707f5a5 100644 (file)
@@ -166,27 +166,27 @@ EXTRA_DIST = \
        pixmaps/continue.xpm \
        pixmaps/complete.xpm \
        pixmaps/error.xpm \
        pixmaps/continue.xpm \
        pixmaps/complete.xpm \
        pixmaps/error.xpm \
-       pixmaps/stock_mail.xpm \
-       pixmaps/stock_mail_attach.xpm \
-       pixmaps/stock_mail_receive.xpm \
-       pixmaps/stock_mail_receive_all.xpm \
-       pixmaps/stock_mail_send.xpm \
-       pixmaps/stock_mail_send_queue.xpm \
-       pixmaps/stock_mail_compose.xpm \
-       pixmaps/stock_news_compose.xpm \
-       pixmaps/stock_mail_reply.xpm \
-       pixmaps/stock_mail_reply_to_all.xpm \
-       pixmaps/stock_mail_reply_to_author.xpm \
-       pixmaps/stock_mail_forward.xpm \
-       pixmaps/stock_preferences.xpm \
-       pixmaps/stock_properties.xpm \
-       pixmaps/stock_search.xpm \
-       pixmaps/stock_close.xpm \
-       pixmaps/stock_exec.xpm \
-       pixmaps/stock_trash.xpm \
-       pixmaps/stock_up_arrow.xpm \
-       pixmaps/stock_down_arrow.xpm \
-       pixmaps/stock_paste.xpm \
+       pixmaps/mail.xpm \
+       pixmaps/mail_attach.xpm \
+       pixmaps/mail_receive.xpm \
+       pixmaps/mail_receive_all.xpm \
+       pixmaps/mail_send.xpm \
+       pixmaps/mail_send_queue.xpm \
+       pixmaps/mail_compose.xpm \
+       pixmaps/news_compose.xpm \
+       pixmaps/mail_reply.xpm \
+       pixmaps/mail_reply_to_all.xpm \
+       pixmaps/mail_reply_to_author.xpm \
+       pixmaps/mail_forward.xpm \
+       pixmaps/preferences.xpm \
+       pixmaps/properties.xpm \
+       pixmaps/search.xpm \
+       pixmaps/close.xpm \
+       pixmaps/exec.xpm \
+       pixmaps/trash.xpm \
+       pixmaps/up_arrow.xpm \
+       pixmaps/down_arrow.xpm \
+       pixmaps/paste.xpm \
        pixmaps/tb_address_book.xpm \
        pixmaps/sylpheed-logo.xpm \
        pixmaps/address.xpm \
        pixmaps/tb_address_book.xpm \
        pixmaps/sylpheed-logo.xpm \
        pixmaps/address.xpm \
index 06da57955225cc3bc2435e8e867f038dc943a804..906c2e757448420490d2800f26b59a475b483f3e 100644 (file)
@@ -750,7 +750,7 @@ gint folder_item_scan(FolderItem *item)
 {
        Folder *folder;
 
 {
        Folder *folder;
 
-       g_return_if_fail(item != NULL);
+       g_return_val_if_fail(item != NULL, -1);
 
        folder = item->folder;
        return folder->scan(folder, item);
 
        folder = item->folder;
        return folder->scan(folder, item);
index 8e86b4605bb3a212d4594799b0d634ec5f12b245..747c4a843477046d8130c227db684439d68b8d2f 100644 (file)
@@ -144,8 +144,9 @@ static gint imap_status                     (IMAPSession    *session,
                                         const gchar    *path,
                                         gint           *messages,
                                         gint           *recent,
                                         const gchar    *path,
                                         gint           *messages,
                                         gint           *recent,
-                                        gint           *unseen,
-                                        guint32        *uid_validity);
+                                        guint32        *uid_next,
+                                        guint32        *uid_validity,
+                                        gint           *unseen);
 
 static void imap_parse_namespace               (IMAPSession    *session,
                                                 IMAPFolder     *folder);
 
 static void imap_parse_namespace               (IMAPSession    *session,
                                                 IMAPFolder     *folder);
@@ -589,6 +590,15 @@ gchar *imap_fetch_msg(Folder *folder, FolderItem *item, gint uid)
                return NULL;
        }
 
                return NULL;
        }
 
+       ok = imap_select(session, IMAP_FOLDER(folder), item->path,
+                        NULL, NULL, NULL, NULL);
+       statusbar_pop_all();
+       if (ok != IMAP_SUCCESS) {
+               g_warning(_("can't select mailbox %s\n"), item->path);
+               g_free(filename);
+               return NULL;
+       }
+
        debug_print(_("getting message %d...\n"), uid);
        ok = imap_cmd_fetch(SESSION(session)->sock, (guint32)uid, filename);
 
        debug_print(_("getting message %d...\n"), uid);
        ok = imap_cmd_fetch(SESSION(session)->sock, (guint32)uid, filename);
 
@@ -926,7 +936,7 @@ gint imap_scan_folder(Folder *folder, FolderItem *item)
 {
        IMAPSession *session;
        gint messages, recent, unseen;
 {
        IMAPSession *session;
        gint messages, recent, unseen;
-       guint32 uid_validity;
+       guint32 uid_next, uid_validity;
        gint ok;
 
        g_return_val_if_fail(folder != NULL, -1);
        gint ok;
 
        g_return_val_if_fail(folder != NULL, -1);
@@ -936,13 +946,14 @@ gint imap_scan_folder(Folder *folder, FolderItem *item)
        if (!session) return -1;
 
        ok = imap_status(session, IMAP_FOLDER(folder), item->path,
        if (!session) return -1;
 
        ok = imap_status(session, IMAP_FOLDER(folder), item->path,
-                        &messages, &recent, &unseen, &uid_validity);
+                        &messages, &recent, &uid_next, &uid_validity, &unseen);
        statusbar_pop_all();
        if (ok != IMAP_SUCCESS) return -1;
 
        item->new = unseen > 0 ? recent : 0;
        item->unread = unseen;
        item->total = messages;
        statusbar_pop_all();
        if (ok != IMAP_SUCCESS) return -1;
 
        item->new = unseen > 0 ? recent : 0;
        item->unread = unseen;
        item->total = messages;
+       item->last_num = (messages > 0 && uid_next > 0) ? uid_next - 1 : 0;
        /* item->mtime = uid_validity; */
 
        return 0;
        /* item->mtime = uid_validity; */
 
        return 0;
@@ -1349,6 +1360,8 @@ gint imap_rename_folder(Folder *folder, FolderItem *item, const gchar *name)
 
        real_oldpath = imap_get_real_path(IMAP_FOLDER(folder), item->path);
 
 
        real_oldpath = imap_get_real_path(IMAP_FOLDER(folder), item->path);
 
+       g_free(session->mbox);
+       session->mbox = NULL;
        ok = imap_cmd_examine(SESSION(session)->sock, "INBOX",
                              &exists, &recent, &unseen, &uid_validity);
        statusbar_pop_all();
        ok = imap_cmd_examine(SESSION(session)->sock, "INBOX",
                              &exists, &recent, &unseen, &uid_validity);
        statusbar_pop_all();
@@ -2184,12 +2197,27 @@ static gint imap_select(IMAPSession *session, IMAPFolder *folder,
 {
        gchar *real_path;
        gint ok;
 {
        gchar *real_path;
        gint ok;
+       gint exists_, recent_, unseen_, uid_validity_;
+
+       if (!exists || !recent || !unseen || !uid_validity) {
+               if (session->mbox && strcmp(session->mbox, path) == 0)
+                       return IMAP_SUCCESS;
+               exists = &exists_;
+               recent = &recent_;
+               unseen = &unseen_;
+               uid_validity = &uid_validity_;
+       }
+
+       g_free(session->mbox);
+       session->mbox = NULL;
 
        real_path = imap_get_real_path(folder, path);
        ok = imap_cmd_select(SESSION(session)->sock, real_path,
                             exists, recent, unseen, uid_validity);
        if (ok != IMAP_SUCCESS)
                log_warning(_("can't select folder: %s\n"), real_path);
 
        real_path = imap_get_real_path(folder, path);
        ok = imap_cmd_select(SESSION(session)->sock, real_path,
                             exists, recent, unseen, uid_validity);
        if (ok != IMAP_SUCCESS)
                log_warning(_("can't select folder: %s\n"), real_path);
+       else
+               session->mbox = g_strdup(path);
        g_free(real_path);
 
        return ok;
        g_free(real_path);
 
        return ok;
@@ -2229,8 +2257,9 @@ catch:
 
 static gint imap_status(IMAPSession *session, IMAPFolder *folder,
                        const gchar *path,
 
 static gint imap_status(IMAPSession *session, IMAPFolder *folder,
                        const gchar *path,
-                       gint *messages, gint *recent, gint *unseen,
-                       guint32 *uid_validity)
+                       gint *messages, gint *recent,
+                       guint32 *uid_next, guint32 *uid_validity,
+                       gint *unseen)
 {
        gchar *real_path;
        gchar *real_path_;
 {
        gchar *real_path;
        gchar *real_path_;
@@ -2238,14 +2267,15 @@ static gint imap_status(IMAPSession *session, IMAPFolder *folder,
        GPtrArray *argbuf;
        gchar *str;
 
        GPtrArray *argbuf;
        gchar *str;
 
-       *messages = *recent = *unseen = *uid_validity = 0;
+       *messages = *recent = *uid_next = *uid_validity = *unseen = 0;
 
        argbuf = g_ptr_array_new();
 
        real_path = imap_get_real_path(folder, path);
        QUOTE_IF_REQUIRED(real_path_, real_path);
        imap_cmd_gen_send(SESSION(session)->sock, "STATUS %s "
 
        argbuf = g_ptr_array_new();
 
        real_path = imap_get_real_path(folder, path);
        QUOTE_IF_REQUIRED(real_path_, real_path);
        imap_cmd_gen_send(SESSION(session)->sock, "STATUS %s "
-                         "(MESSAGES RECENT UNSEEN UIDVALIDITY)", real_path_);
+                         "(MESSAGES RECENT UIDNEXT UIDVALIDITY UNSEEN)",
+                         real_path_);
 
        ok = imap_cmd_ok(SESSION(session)->sock, argbuf);
        if (ok != IMAP_SUCCESS) THROW(ok);
 
        ok = imap_cmd_ok(SESSION(session)->sock, argbuf);
        if (ok != IMAP_SUCCESS) THROW(ok);
@@ -2265,12 +2295,15 @@ static gint imap_status(IMAPSession *session, IMAPFolder *folder,
                } else if (!strncmp(str, "RECENT ", 7)) {
                        str += 7;
                        *recent = strtol(str, &str, 10);
                } else if (!strncmp(str, "RECENT ", 7)) {
                        str += 7;
                        *recent = strtol(str, &str, 10);
-               } else if (!strncmp(str, "UNSEEN ", 7)) {
-                       str += 7;
-                       *unseen = strtol(str, &str, 10);
+               } else if (!strncmp(str, "UIDNEXT ", 8)) {
+                       str += 8;
+                       *uid_next = strtoul(str, &str, 10);
                } else if (!strncmp(str, "UIDVALIDITY ", 12)) {
                        str += 12;
                        *uid_validity = strtoul(str, &str, 10);
                } else if (!strncmp(str, "UIDVALIDITY ", 12)) {
                        str += 12;
                        *uid_validity = strtoul(str, &str, 10);
+               } else if (!strncmp(str, "UNSEEN ", 7)) {
+                       str += 7;
+                       *unseen = strtol(str, &str, 10);
                } else {
                        g_warning("invalid STATUS response: %s\n", str);
                        break;
                } else {
                        g_warning("invalid STATUS response: %s\n", str);
                        break;
index 2f7656d55cbd5a51ef819c143fff6883051a801f..ff2cd8dce7ba7834a72e93df7adf5073965b3484 100644 (file)
@@ -116,7 +116,8 @@ gchar *input_dialog_with_invisible(const gchar *title, const gchar *message,
 }
 
 gchar *input_dialog_combo(const gchar *title, const gchar *message,
 }
 
 gchar *input_dialog_combo(const gchar *title, const gchar *message,
-                         const gchar *default_string, GList *list)
+                         const gchar *default_string, GList *list,
+                         gboolean case_sensitive)
 {
        if (dialog && GTK_WIDGET_VISIBLE(dialog)) return NULL;
 
 {
        if (dialog && GTK_WIDGET_VISIBLE(dialog)) return NULL;
 
@@ -137,6 +138,8 @@ gchar *input_dialog_combo(const gchar *title, const gchar *message,
        } else
                gtk_combo_set_popdown_strings(GTK_COMBO(combo), list);
 
        } else
                gtk_combo_set_popdown_strings(GTK_COMBO(combo), list);
 
+       gtk_combo_set_case_sensitive(GTK_COMBO(combo), case_sensitive);
+
        return input_dialog_open(title, message, default_string);
 }
 
        return input_dialog_open(title, message, default_string);
 }
 
index c93bb707c9edb70d149d7bf7a9a27ba9241ace1c..0e9175a80b829e4b726b0c19b15e03b91a2d3c7f 100644 (file)
@@ -31,7 +31,8 @@ gchar *input_dialog_with_invisible    (const gchar    *title,
 gchar *input_dialog_combo              (const gchar    *title,
                                         const gchar    *message,
                                         const gchar    *default_string,
 gchar *input_dialog_combo              (const gchar    *title,
                                         const gchar    *message,
                                         const gchar    *default_string,
-                                        GList          *list);
+                                        GList          *list,
+                                        gboolean        case_sensitive);
 gchar *input_dialog_query_password     (const gchar    *server,
                                         const gchar    *user);
 
 gchar *input_dialog_query_password     (const gchar    *server,
                                         const gchar    *user);
 
index b45a1433ac6cc38c88ce47f6be70751f5f25aa75..bd9f632b8ff0997525c0947b14936b920fc6a8c5 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -47,6 +47,8 @@ static void   mh_folder_init                  (Folder         *folder,
                                                 const gchar    *name,
                                                 const gchar    *path);
 
                                                 const gchar    *name,
                                                 const gchar    *path);
 
+static gchar   *mh_get_new_msg_filename                (FolderItem     *dest);
+
 static GSList  *mh_get_uncached_msgs           (GHashTable     *msg_table,
                                                 FolderItem     *item);
 static MsgInfo *mh_parse_msg                   (const gchar    *file,
 static GSList  *mh_get_uncached_msgs           (GHashTable     *msg_table,
                                                 FolderItem     *item);
 static MsgInfo *mh_parse_msg                   (const gchar    *file,
@@ -177,27 +179,27 @@ gchar *mh_fetch_msg(Folder *folder, FolderItem *item, gint num)
        return file;
 }
 
        return file;
 }
 
-gchar *mh_get_newmsg_filename(FolderItem *dest)
+static gchar *mh_get_new_msg_filename(FolderItem *dest)
 {
        gchar *destfile;
        gchar *destpath;
 {
        gchar *destfile;
        gchar *destpath;
-       gboolean found = FALSE;
 
        destpath = folder_item_get_path(dest);
        g_return_val_if_fail(destpath != NULL, NULL);
 
        destpath = folder_item_get_path(dest);
        g_return_val_if_fail(destpath != NULL, NULL);
+
        if (!is_dir_exist(destpath))
                make_dir_hier(destpath);
 
        if (!is_dir_exist(destpath))
                make_dir_hier(destpath);
 
-       do {
+       for (;;) {
                destfile = g_strdup_printf("%s%c%d", destpath, G_DIR_SEPARATOR,
                                           dest->last_num + 1);
                destfile = g_strdup_printf("%s%c%d", destpath, G_DIR_SEPARATOR,
                                           dest->last_num + 1);
-               if(is_file_exist(destfile)) {
+               if (is_file_entry_exist(destfile)) {
                        dest->last_num++;
                        g_free(destfile);
                        dest->last_num++;
                        g_free(destfile);
-               } else {
-                       found = TRUE;
-               }
-       } while(!found);
+               } else
+                       break;
+       }
+
        g_free(destpath);
 
        return destfile;
        g_free(destpath);
 
        return destfile;
@@ -232,8 +234,8 @@ gint mh_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
                if (dest->last_num < 0) return -1;
        }
 
                if (dest->last_num < 0) return -1;
        }
 
-       destfile = mh_get_newmsg_filename(dest);
-       if(!destfile) return -1;
+       destfile = mh_get_new_msg_filename(dest);
+       g_return_val_if_fail(destfile != NULL, -1);
 
        if (link(file, destfile) < 0) {
                if (copy_file(file, destfile) < 0) {
 
        if (link(file, destfile) < 0) {
                if (copy_file(file, destfile) < 0) {
@@ -278,21 +280,22 @@ static gint mh_do_move(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
 
        prefs = dest->prefs;
 
 
        prefs = dest->prefs;
 
-       destdir = folder_item_get_path(dest);
+       destfile = mh_get_new_msg_filename(dest);
+       g_return_val_if_fail(destfile != NULL, -1);
 
        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(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(msginfo);
 
-       destfile = mh_get_newmsg_filename(dest);
+       destfile = mh_get_new_msg_filename(dest);
        if(!destfile) return -1;
 
        if(!destfile) return -1;
 
+       srcfile = procmsg_get_message_file(msginfo);
 
        if (move_file(srcfile, destfile) < 0) {
                g_free(srcfile);
                g_free(destfile);
 
        if (move_file(srcfile, destfile) < 0) {
                g_free(srcfile);
                g_free(destfile);
-               g_free(destdir);
                return -1;
        }
 
                return -1;
        }
 
@@ -310,6 +313,7 @@ static gint mh_do_move(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        g_free(destfile);
        dest->last_num++;
 
        g_free(destfile);
        dest->last_num++;
 
+       destdir = folder_item_get_path(dest);
        if ((fp = procmsg_open_mark_file(destdir, TRUE)) == NULL)
                g_warning(_("Can't open mark file.\n"));
        else {
        if ((fp = procmsg_open_mark_file(destdir, TRUE)) == NULL)
                g_warning(_("Can't open mark file.\n"));
        else {
@@ -409,8 +413,10 @@ static gint mh_do_move_msgs_with_dest(Folder *folder, FolderItem *dest,
                            msginfo->folder->path, G_DIR_SEPARATOR,
                            msginfo->msgnum, dest->path);
 
                            msginfo->folder->path, G_DIR_SEPARATOR,
                            msginfo->msgnum, dest->path);
 
+               destfile = mh_get_new_msg_filename(dest);
+               if (!destfile) break;
                srcfile = procmsg_get_message_file(msginfo);
                srcfile = procmsg_get_message_file(msginfo);
-               destfile = mh_get_newmsg_filename(dest);
+               destfile = mh_get_new_msg_filename(dest);
                if(!destfile) return -1;
 
                if (move_file(srcfile, destfile) < 0) {
                if(!destfile) return -1;
 
                if (move_file(srcfile, destfile) < 0) {
@@ -477,28 +483,19 @@ gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
 
        prefs = dest->prefs;
 
 
        prefs = dest->prefs;
 
-       destdir = folder_item_get_path(dest);
-       if (!is_dir_exist(destdir))
-               make_dir_hier(destdir);
+       destfile = mh_get_new_msg_filename(dest);
+       g_return_val_if_fail(destfile != NULL, -1);
 
        debug_print(_("Copying message %s%c%d to %s ...\n"),
                    msginfo->folder->path, G_DIR_SEPARATOR,
                    msginfo->msgnum, dest->path);
 
        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(msginfo);
        srcfile = procmsg_get_message_file(msginfo);
-       destfile = mh_get_newmsg_filename(dest);
-       if(!destfile) {
-               g_free(srcfile);
-               if (fp) fclose(fp);
-               return -1;
-       }
-       
-       dest->op_count--;
 
        if (copy_file(srcfile, destfile) < 0) {
                FILE_OP_ERROR(srcfile, "copy");
                g_free(srcfile);
                g_free(destfile);
 
        if (copy_file(srcfile, destfile) < 0) {
                FILE_OP_ERROR(srcfile, "copy");
                g_free(srcfile);
                g_free(destfile);
-               g_free(destdir);
                return -1;
        }
 
                return -1;
        }
 
@@ -516,6 +513,7 @@ gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        g_free(destfile);
        dest->last_num++;
 
        g_free(destfile);
        dest->last_num++;
 
+       destdir = folder_item_get_path(dest);
        if ((fp = procmsg_open_mark_file(destdir, TRUE)) == NULL)
                g_warning(_("Can't open mark file.\n"));
        else {
        if ((fp = procmsg_open_mark_file(destdir, TRUE)) == NULL)
                g_warning(_("Can't open mark file.\n"));
        else {
@@ -620,12 +618,9 @@ gint mh_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
                            msginfo->folder->path, G_DIR_SEPARATOR,
                            msginfo->msgnum, dest->path);
 
                            msginfo->folder->path, G_DIR_SEPARATOR,
                            msginfo->msgnum, dest->path);
 
+               destfile = mh_get_new_msg_filename(dest);
+               if (!destfile) break;
                srcfile = procmsg_get_message_file(msginfo);
                srcfile = procmsg_get_message_file(msginfo);
-               destfile = mh_get_newmsg_filename(dest);
-               if(!destfile) {
-                       g_free(srcfile);
-                       break;
-               }
 
                if (copy_file(srcfile, destfile) < 0) {
                        FILE_OP_ERROR(srcfile, "copy");
 
                if (copy_file(srcfile, destfile) < 0) {
                        FILE_OP_ERROR(srcfile, "copy");
index ff78a740fa1836f63c4e495eab3863cfc79122af..76f8de16982bee2604489ed871b349db00898a51 100644 (file)
@@ -862,7 +862,8 @@ static void mimeview_open_with(MimeView *mimeview)
                 _("Enter the command line to open file:\n"
                   "(`%s' will be replaced with file name)"),
                 prefs_common.mime_open_cmd,
                 _("Enter the command line to open file:\n"
                   "(`%s' will be replaced with file name)"),
                 prefs_common.mime_open_cmd,
-                prefs_common.mime_open_cmd_history);
+                prefs_common.mime_open_cmd_history,
+                TRUE);
        if (cmd) {
                mimeview_view_file(filename, partinfo, cmd);
                g_free(prefs_common.mime_open_cmd);
        if (cmd) {
                mimeview_view_file(filename, partinfo, cmd);
                g_free(prefs_common.mime_open_cmd);
index 715d69adf6f2c6dec8ee692dd96ac67163306f40..140f5f3a4abb1ad375ed0ece697a9775d604521c 100644 (file)
@@ -1438,6 +1438,18 @@ gboolean is_dir_exist(const gchar *dir)
        return FALSE;
 }
 
        return FALSE;
 }
 
+gboolean is_file_entry_exist(const gchar *file)
+{
+       struct stat s;
+
+       if (stat(file, &s) < 0) {
+               if (ENOENT != errno) FILE_OP_ERROR(file, "stat");
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
 gint change_dir(const gchar *dir)
 {
        gchar *prevdir = NULL;
 gint change_dir(const gchar *dir)
 {
        gchar *prevdir = NULL;
index e69dd26631d683ef2641e92f409092b79c48bfa0..f9f93c769337a886273f918874314ef3f9bf711c 100644 (file)
@@ -298,9 +298,15 @@ gchar *get_domain_name             (void);
 off_t get_file_size            (const gchar    *file);
 off_t get_file_size_as_crlf    (const gchar    *file);
 off_t get_left_file_size       (FILE           *fp);
 off_t get_file_size            (const gchar    *file);
 off_t get_file_size_as_crlf    (const gchar    *file);
 off_t get_left_file_size       (FILE           *fp);
+
 gboolean file_exist            (const gchar    *file,
                                 gboolean        allow_fifo);
 gboolean is_dir_exist          (const gchar    *dir);
 gboolean file_exist            (const gchar    *file,
                                 gboolean        allow_fifo);
 gboolean is_dir_exist          (const gchar    *dir);
+gboolean is_file_entry_exist   (const gchar    *file);
+
+#define is_file_exist(file)            file_exist(file, FALSE)
+#define is_file_or_fifo_exist(file)    file_exist(file, TRUE)
+
 gint change_dir                        (const gchar    *dir);
 gint make_dir_hier             (const gchar    *dir);
 gint remove_all_files          (const gchar    *dir);
 gint change_dir                        (const gchar    *dir);
 gint make_dir_hier             (const gchar    *dir);
 gint remove_all_files          (const gchar    *dir);
@@ -318,9 +324,6 @@ gint change_file_mode_rw    (FILE           *fp,
 FILE *my_tmpfile               (void);
 FILE *str_open_as_stream       (const gchar    *str);
 
 FILE *my_tmpfile               (void);
 FILE *str_open_as_stream       (const gchar    *str);
 
-#define is_file_exist(file)            file_exist(file, FALSE)
-#define is_file_or_fifo_exist(file)    file_exist(file, TRUE)
-
 /* process execution */
 gint execute_async             (gchar *const    argv[]);
 gint execute_sync              (gchar *const    argv[]);
 /* process execution */
 gint execute_async             (gchar *const    argv[]);
 gint execute_sync              (gchar *const    argv[]);