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 4aa161b..0e2ab4b 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.
index bf20ca4..f8358c0 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
index 0738d08..24f032a 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(): ºÇ¾®¥µ¥¤¥º¤òÀ©¸Â¡£
index 9b94b00..69da0eb 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 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
index 4672f90..6957294 100644 (file)
@@ -166,27 +166,27 @@ EXTRA_DIST = \
        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 \
index 06da579..906c2e7 100644 (file)
@@ -750,7 +750,7 @@ gint folder_item_scan(FolderItem *item)
 {
        Folder *folder;
 
-       g_return_if_fail(item != NULL);
+       g_return_val_if_fail(item != NULL, -1);
 
        folder = item->folder;
        return folder->scan(folder, item);
index 8e86b46..747c4a8 100644 (file)
@@ -144,8 +144,9 @@ static gint imap_status                     (IMAPSession    *session,
                                         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);
@@ -589,6 +590,15 @@ gchar *imap_fetch_msg(Folder *folder, FolderItem *item, gint uid)
                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);
 
@@ -926,7 +936,7 @@ gint imap_scan_folder(Folder *folder, FolderItem *item)
 {
        IMAPSession *session;
        gint messages, recent, unseen;
-       guint32 uid_validity;
+       guint32 uid_next, uid_validity;
        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,
-                        &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;
+       item->last_num = (messages > 0 && uid_next > 0) ? uid_next - 1 : 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);
 
+       g_free(session->mbox);
+       session->mbox = NULL;
        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;
+       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);
+       else
+               session->mbox = g_strdup(path);
        g_free(real_path);
 
        return ok;
@@ -2229,8 +2257,9 @@ catch:
 
 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_;
@@ -2238,14 +2267,15 @@ static gint imap_status(IMAPSession *session, IMAPFolder *folder,
        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 "
-                         "(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);
@@ -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, "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, "UNSEEN ", 7)) {
+                       str += 7;
+                       *unseen = strtol(str, &str, 10);
                } else {
                        g_warning("invalid STATUS response: %s\n", str);
                        break;
index 2f7656d..ff2cd8d 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,
-                         const gchar *default_string, GList *list)
+                         const gchar *default_string, GList *list,
+                         gboolean case_sensitive)
 {
        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);
 
+       gtk_combo_set_case_sensitive(GTK_COMBO(combo), case_sensitive);
+
        return input_dialog_open(title, message, default_string);
 }
 
index c93bb70..0e9175a 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,
-                                        GList          *list);
+                                        GList          *list,
+                                        gboolean        case_sensitive);
 gchar *input_dialog_query_password     (const gchar    *server,
                                         const gchar    *user);
 
index b45a143..bd9f632 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);
 
+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,
@@ -177,27 +179,27 @@ gchar *mh_fetch_msg(Folder *folder, FolderItem *item, gint num)
        return file;
 }
 
-gchar *mh_get_newmsg_filename(FolderItem *dest)
+static gchar *mh_get_new_msg_filename(FolderItem *dest)
 {
        gchar *destfile;
        gchar *destpath;
-       gboolean found = FALSE;
 
        destpath = folder_item_get_path(dest);
        g_return_val_if_fail(destpath != NULL, NULL);
+
        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);
-               if(is_file_exist(destfile)) {
+               if (is_file_entry_exist(destfile)) {
                        dest->last_num++;
                        g_free(destfile);
-               } else {
-                       found = TRUE;
-               }
-       } while(!found);
+               } else
+                       break;
+       }
+
        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;
        }
 
-       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) {
@@ -278,21 +280,22 @@ static gint mh_do_move(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
 
        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);
 
-       destfile = mh_get_newmsg_filename(dest);
+       destfile = mh_get_new_msg_filename(dest);
        if(!destfile) return -1;
 
+       srcfile = procmsg_get_message_file(msginfo);
 
        if (move_file(srcfile, destfile) < 0) {
                g_free(srcfile);
                g_free(destfile);
-               g_free(destdir);
                return -1;
        }
 
@@ -310,6 +313,7 @@ static gint mh_do_move(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        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 {
@@ -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);
 
+               destfile = mh_get_new_msg_filename(dest);
+               if (!destfile) break;
                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) {
@@ -477,28 +483,19 @@ gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
 
        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);
+
        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);
-               g_free(destdir);
                return -1;
        }
 
@@ -516,6 +513,7 @@ gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        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 {
@@ -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);
 
+               destfile = mh_get_new_msg_filename(dest);
+               if (!destfile) break;
                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");
index ff78a74..76f8de1 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,
-                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);
index 715d69a..140f5f3 100644 (file)
@@ -1438,6 +1438,18 @@ gboolean is_dir_exist(const gchar *dir)
        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;
index e69dd26..f9f93c7 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);
+
 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);
@@ -318,9 +324,6 @@ gint change_file_mode_rw    (FILE           *fp,
 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[]);