sync with sylpheed 0.7.0cvs7
authorPaul Mangan <paul@claws-mail.org>
Wed, 16 Jan 2002 11:48:36 +0000 (11:48 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 16 Jan 2002 11:48:36 +0000 (11:48 +0000)
27 files changed:
AUTHORS
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/folder.c
src/folder.h
src/foldersel.c
src/imap.c
src/imap.h
src/inc.c
src/inputdialog.c
src/inputdialog.h
src/mainwindow.c
src/mbox_folder.c
src/mbox_folder.h
src/mh.c
src/mh.h
src/mimeview.c
src/news.c
src/news.h
src/prefs_filter.c
src/procmsg.c
src/send.c
src/summaryview.c
src/utils.c
src/utils.h

diff --git a/AUTHORS b/AUTHORS
index 1bf5576..91c34c7 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -96,8 +96,8 @@ contributors (beside the above; based on Changelog)
        Hironori IWANE
        Manrat Chobchuen
        Shimamoto "Neko" Tatsuya
-        Jesse Skinner
-        Willem van Engen
+       Jesse Skinner
+       Willem van Engen
        Tobias Sandhaas
        Thomas Link
        Martin Pool
@@ -105,3 +105,7 @@ contributors (beside the above; based on Changelog)
        Gustavo Noronha Silva
        Simon 'corecode' Schubert
        Dale P. Smith
+       Yukihiro Nakai
+       Watanabe
+       Masaaki Noro
+       Motonobu Ichimura
index 99b32b4..dfc20c0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+2002-01-16
+
+       * src/prefs_filter.c: use inc_(un)lock() instead of
+         inc_autocheck_timer_{remove|set}().
+       * src/summaryview.c: summary_sort(): use gtk_ctree_sort_recursive()
+         instead of gtk_ctree_sort_node() so that messages within threads
+         are also sorted.
+       * src/procmsg.c: procmsg_read_mark_file(): fixed a bug that the
+         target of sizeof was wrong and caused crash on Alpha architecture
+         (thanks to Motonobu Ichimura).
+
+2002-01-15
+
+       * src/foldersel.c:
+         foldersel_gnode_func(): made the names of special folders
+         translated strings.
+         foldersel_set_tree(): move the special folder to the top.
+       * src/inputdialog.[ch]: input_dialog_query_password(): new.
+       * src/imap.c
+         src/inc.c
+         src/news.c
+         src/send.c: use input_dialog_query_password() instead of their
+         own query functions.
+
+2002-01-14
+
+       * src/defs.h: modified the default font.
+       * src/folder.[ch]
+         src/mh.[ch]
+         src/imap.[ch]
+         src/news.[ch]: moved the class definition and some methods to
+         the proper location.
+
+2002-01-11
+
+       * src/mimeview.c: mimeview_save_as()
+         src/summaryview.c: summary_save_as(): put the default filename
+         based on the subject.
+       * src/utils.[ch]: added subst_chars() and subst_for_filename()
+         which substitute some special characters with underscore.
+       * src/filesel.c: filesel_select_file(): select the default filename.
+
+2002-01-10
+
+       * INSTALL
+         INSTALL.jp: added the description and the URL for libjconv.
+       * src/mainwindow.c: menu entries cleanup.
+
 2002-01-09
 
        * README
index dbc2b45..f4c7f05 100644 (file)
@@ -1,3 +1,9 @@
+2001-01-16 [paul]      0.7.0claws6
+
+       * sync with sylpheed 0.7.0cvs7
+               see ChangeLog entries 2002-01-10, 2002-01-11, 2002-01-14,
+               2002-01-15, and 2002-01-16
+
 2002-01-16 [melvin]    0.7.0claws5
 
        * README.claws
index ef620d2..8fc2cb9 100644 (file)
@@ -1,3 +1,50 @@
+2002-01-16
+
+       * src/prefs_filter.c: inc_autocheck_timer_{remove|set}() ¤ÎÂå¤ï¤ê¤Ë
+         inc_(un)lock() ¤ò»ÈÍÑ¡£
+       * src/summaryview.c: summary_sort(): ¥¹¥ì¥Ã¥ÉÆâ¤Î¥á¥Ã¥»¡¼¥¸¤â¥½¡¼¥È
+         ¤µ¤ì¤ë¤è¤¦¤Ë gtk_ctree_sort_node() ¤ÎÂå¤ï¤ê¤Ë
+         gtk_ctree_sort_recursive() ¤ò»ÈÍÑ¡£
+       * src/procmsg.c: procmsg_read_mark_file(): sizeof ¤ÎÂоݤ¬´Ö°ã¤Ã¤Æ
+         ¤¤¤Æ¡¢ Alpha ¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤Ç¥¯¥é¥Ã¥·¥å¤òµ¯¤³¤¹¥Ð¥°¤ò½¤Àµ(»Ô¼
+         ¤µ¤ó thanks)¡£
+
+2002-01-15
+
+       * src/foldersel.c:
+         foldersel_gnode_func(): ÆÃÊÌ¥Õ¥©¥ë¥À¤Î̾Á°¤òËÝÌõºÑʸ»úÎó¤Ë¤·¤¿¡£
+         foldersel_set_tree(): ÆÃÊÌ¥Õ¥©¥ë¥À¤òÀèƬ¤Ë°ÜÆ°¡£
+       * src/inputdialog.[ch]: input_dialog_query_password(): ¿·µ¬¡£
+       * src/imap.c
+         src/inc.c
+         src/news.c
+         src/send.c: ³Æ¼«¤Î¥¯¥¨¥ê´Ø¿ô¤ÎÂå¤ï¤ê¤Ë input_dialog_query_password()
+         ¤ò»ÈÍÑ¡£
+
+2002-01-14
+
+       * src/defs.h: ¥Ç¥Õ¥©¥ë¥È¥Õ¥©¥ó¥È¤ò½¤Àµ¡£
+       * src/folder.[ch]
+         src/mh.[ch]
+         src/imap.[ch]
+         src/news.[ch]: ¥¯¥é¥¹ÄêµÁ¤È¤¤¤¯¤Ä¤«¤Î¥á¥½¥Ã¥É¤òŬÀڤʰÌÃ֤˰ÜÆ°¡£
+
+2002-01-11
+
+       * src/mimeview.c: mimeview_save_as()
+         src/summaryview.c: summary_save_as(): subject ¤Ë´ð¤Å¤¤¤Æ¥Ç¥Õ¥©¥ë¥È
+         ¤Î¥Õ¥¡¥¤¥ë̾¤ò½Ð¤¹¤è¤¦¤Ë¤·¤¿¡£
+       * src/utils.[ch]: subst_chars() ¤È¡¢¤¤¤¯¤Ä¤«¤ÎÆüìʸ»ú¤ò¥¢¥ó¥À¡¼
+         ¥¹¥³¥¢¤ÇÃÖ´¹¤¹¤ë subst_for_filename() ¤òÄɲá£
+       * src/filesel.c: filesel_select_file(): ¥Ç¥Õ¥©¥ë¥È¤Î¥Õ¥¡¥¤¥ë̾¤ò
+         ÁªÂò¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+2002-01-10
+
+       * INSTALL
+         INSTALL.jp: libjconv ¤Î ÀâÌÀ¤È URL ¤òÄɲá£
+       * src/mainwindow.c: ¥á¥Ë¥å¡¼¥¨¥ó¥È¥ê¤ÎÀ°Íý¡£
+
 2002-01-09
 
        * README
index b9197d5..8a5dc4c 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws5
+EXTRA_VERSION=claws6
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 6d1c99c..4ee984c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include "prefs.h"
 #include "account.h"
 #include "prefs_account.h"
-#include "mbox_folder.h"
 #include "prefs_folder_item.h"
 
 static GList *folder_list = NULL;
 
 static void folder_init                (Folder         *folder,
-                                FolderType      type,
                                 const gchar    *name);
 
-static void local_folder_destroy       (LocalFolder    *lfolder);
-static void remote_folder_destroy      (RemoteFolder   *rfolder);
-static void mh_folder_destroy          (MHFolder       *folder);
-static void mbox_folder_destroy                (MboxFolder     *folder);
-static void imap_folder_destroy                (IMAPFolder     *folder);
-static void news_folder_destroy                (NewsFolder     *folder);
-
 static gboolean folder_read_folder_func        (GNode          *node,
                                         gpointer        data);
 static gchar *folder_get_list_path     (void);
@@ -95,55 +86,98 @@ Folder *folder_new(FolderType type, const gchar *name, const gchar *path)
        return folder;
 }
 
-Folder *mh_folder_new(const gchar *name, const gchar *path)
+static void folder_init(Folder *folder, const gchar *name)
 {
-       Folder *folder;
+       FolderItem *item;
 
-       folder = (Folder *)g_new0(MHFolder, 1);
-       folder_init(folder, F_MH, name);
-       LOCAL_FOLDER(folder)->rootpath = g_strdup(path);
+       g_return_if_fail(folder != NULL);
 
-       return folder;
+       folder_set_name(folder, name);
+       folder->type = F_UNKNOWN;
+       folder->account = NULL;
+       folder->inbox = NULL;
+       folder->outbox = NULL;
+       folder->draft = NULL;
+       folder->queue = NULL;
+       folder->trash = NULL;
+       folder->ui_func = NULL;
+       folder->ui_func_data = NULL;
+       item = folder_item_new(name, NULL);
+       item->folder = folder;
+       folder->node = g_node_new(item);
+       folder->data = NULL;
 }
 
-Folder *mbox_folder_new(const gchar *name, const gchar *path)
+void folder_local_folder_init(Folder *folder, const gchar *name,
+                             const gchar *path)
 {
-       /* implementing */
-       Folder *folder;
-
-       folder = (Folder *)g_new0(MboxFolder, 1);
-       folder_init(folder, F_MBOX, name);
+       folder_init(folder, name);
        LOCAL_FOLDER(folder)->rootpath = g_strdup(path);
-
-       return folder;
 }
 
-Folder *maildir_folder_new(const gchar *name, const gchar *path)
+void folder_remote_folder_init(Folder *folder, const gchar *name,
+                              const gchar *path)
 {
-       /* not yet implemented */
-       return NULL;
+       folder_init(folder, name);
+       REMOTE_FOLDER(folder)->session = NULL;
 }
 
-Folder *imap_folder_new(const gchar *name, const gchar *path)
+void folder_destroy(Folder *folder)
 {
-       Folder *folder;
+       g_return_if_fail(folder != NULL);
 
-       folder = (Folder *)g_new0(IMAPFolder, 1);
-       folder_init(folder, F_IMAP, name);
+       switch (folder->type) {
+       case F_MBOX:
+               mbox_folder_destroy(MBOX_FOLDER(folder));
+       case F_MH:
+               mh_folder_destroy(MH_FOLDER(folder));
+               break;
+       case F_IMAP:
+               imap_folder_destroy(IMAP_FOLDER(folder));
+               break;
+       case F_NEWS:
+               news_folder_destroy(NEWS_FOLDER(folder));
+               break;
+       default:
+               break;
+       }
 
-       return folder;
+       folder_list = g_list_remove(folder_list, folder);
+
+       folder_tree_destroy(folder);
+       g_free(folder->name);
+       g_free(folder);
 }
 
-Folder *news_folder_new(const gchar *name, const gchar *path)
+void folder_local_folder_destroy(LocalFolder *lfolder)
 {
-       Folder *folder;
+       g_return_if_fail(lfolder != NULL);
+
+       g_free(lfolder->rootpath);
+}
 
-       folder = (Folder *)g_new0(NewsFolder, 1);
-       folder_init(folder, F_NEWS, name);
+void folder_remote_folder_destroy(RemoteFolder *rfolder)
+{
+       g_return_if_fail(rfolder != NULL);
 
-       return folder;
+       if (rfolder->session)
+               session_destroy(rfolder->session);
 }
 
+#if 0
+Folder *mbox_folder_new(const gchar *name, const gchar *path)
+{
+       /* not yet implemented */
+       return NULL;
+}
+
+Folder *maildir_folder_new(const gchar *name, const gchar *path)
+{
+       /* not yet implemented */
+       return NULL;
+}
+#endif
+
 FolderItem *folder_item_new(const gchar *name, const gchar *path)
 {
        FolderItem *item;
@@ -238,34 +272,6 @@ void folder_set_name(Folder *folder, const gchar *name)
        }
 }
 
-void folder_destroy(Folder *folder)
-{
-       g_return_if_fail(folder != NULL);
-
-       folder_list = g_list_remove(folder_list, folder);
-
-       switch (folder->type) {
-       case F_MH:
-               mh_folder_destroy(MH_FOLDER(folder));
-               break;
-       case F_MBOX:
-               mbox_folder_destroy(MBOX_FOLDER(folder));
-               break;
-       case F_IMAP:
-               imap_folder_destroy(IMAP_FOLDER(folder));
-               break;
-       case F_NEWS:
-               news_folder_destroy(NEWS_FOLDER(folder));
-               break;
-       default:
-               break;
-       }
-
-       folder_tree_destroy(folder);
-       g_free(folder->name);
-       g_free(folder);
-}
-
 void folder_tree_destroy(Folder *folder)
 {
        /* TODO: destroy all FolderItem before */
@@ -958,150 +964,6 @@ gchar *folder_item_get_mark_file(FolderItem *item)
        return file;
 }
 
-
-static void folder_init(Folder *folder, FolderType type, const gchar *name)
-{
-       FolderItem *item;
-
-       g_return_if_fail(folder != NULL);
-
-       folder->type = type;
-       folder_set_name(folder, name);
-       folder->account = NULL;
-       folder->inbox = NULL;
-       folder->outbox = NULL;
-       folder->draft = NULL;
-       folder->queue = NULL;
-       folder->trash = NULL;
-       folder->ui_func = NULL;
-       folder->ui_func_data = NULL;
-       item = folder_item_new(name, NULL);
-       item->folder = folder;
-       folder->node = g_node_new(item);
-       folder->data = NULL;
-
-       switch (type) {
-       case F_MH:
-               folder->get_msg_list        = mh_get_msg_list;
-               folder->fetch_msg           = mh_fetch_msg;
-               folder->add_msg             = mh_add_msg;
-               /*
-               folder->move_msg            = mh_move_msg;
-               folder->move_msgs_with_dest = mh_move_msgs_with_dest;
-               folder->copy_msg            = mh_copy_msg;
-               folder->copy_msgs_with_dest = mh_copy_msgs_with_dest;
-               */
-               folder->copy_msg            = mh_copy_msg;
-               folder->remove_msg          = mh_remove_msg;
-               folder->remove_all_msg      = mh_remove_all_msg;
-               folder->is_msg_changed      = mh_is_msg_changed;
-               folder->scan                = mh_scan_folder;
-               folder->scan_tree           = mh_scan_tree;
-               folder->create_tree         = mh_create_tree;
-               folder->create_folder       = mh_create_folder;
-               folder->rename_folder       = mh_rename_folder;
-               folder->remove_folder       = mh_remove_folder;
-               break;
-       case F_IMAP:
-               folder->get_msg_list        = imap_get_msg_list;
-               folder->fetch_msg           = imap_fetch_msg;
-               folder->add_msg             = imap_add_msg;
-               folder->move_msg            = imap_move_msg;
-               folder->move_msgs_with_dest = imap_move_msgs_with_dest;
-               folder->copy_msg            = imap_copy_msg;
-               folder->copy_msgs_with_dest = imap_copy_msgs_with_dest;
-               folder->remove_msg          = imap_remove_msg;
-               folder->remove_all_msg      = imap_remove_all_msg;
-               folder->scan                = imap_scan_folder;
-               folder->scan_tree           = imap_scan_tree;
-               folder->create_tree         = imap_create_tree;
-               folder->create_folder       = imap_create_folder;
-               folder->remove_folder       = imap_remove_folder;
-               break;
-       case F_NEWS:
-               folder->get_msg_list        = news_get_article_list;
-               folder->fetch_msg           = news_fetch_msg;
-               folder->scan                = news_scan_group;
-               break;
-       case F_MBOX:
-               folder->get_msg_list        = mbox_get_msg_list;
-               folder->fetch_msg           = mbox_fetch_msg;
-               folder->scan                = mbox_scan_folder;
-               folder->add_msg             = mbox_add_msg;
-               folder->remove_all_msg      = mbox_remove_all_msg;
-               folder->remove_msg          = mbox_remove_msg;
-               /*
-               folder->move_msg            = mbox_move_msg;
-               folder->move_msgs_with_dest = mbox_move_msgs_with_dest;
-               folder->copy_msg            = mbox_copy_msg;
-               folder->copy_msgs_with_dest = mbox_copy_msgs_with_dest;
-               */
-               folder->copy_msg            = mbox_copy_msg;
-
-               folder->create_tree         = mbox_create_tree;
-               folder->create_folder       = mbox_create_folder;
-               folder->rename_folder       = mbox_rename_folder;
-               folder->remove_folder       = mbox_remove_folder;
-
-               folder->update_mark         = mbox_update_mark;
-               folder->change_flags        = mbox_change_flags;
-               folder->finished_copy       = mbox_finished_copy;
-
-               break;
-       default:
-               break;
-       }
-
-       switch (type) {
-       case F_MH:
-       case F_MBOX:
-       case F_MAILDIR:
-               LOCAL_FOLDER(folder)->rootpath = NULL;
-               break;
-       case F_IMAP:
-       case F_NEWS:
-               REMOTE_FOLDER(folder)->session = NULL;
-               break;
-       default:
-               break;
-       }
-}
-
-static void local_folder_destroy(LocalFolder *lfolder)
-{
-       g_return_if_fail(lfolder != NULL);
-
-       g_free(lfolder->rootpath);
-}
-
-static void remote_folder_destroy(RemoteFolder *rfolder)
-{
-       g_return_if_fail(rfolder != NULL);
-
-       if (rfolder->session)
-               session_destroy(rfolder->session);
-}
-
-static void mh_folder_destroy(MHFolder *folder)
-{
-       local_folder_destroy(LOCAL_FOLDER(folder));
-}
-
-static void mbox_folder_destroy(MboxFolder *folder)
-{
-       local_folder_destroy(LOCAL_FOLDER(folder));
-}
-
-static void imap_folder_destroy(IMAPFolder *folder)
-{
-       remote_folder_destroy(REMOTE_FOLDER(folder));
-}
-
-static void news_folder_destroy(NewsFolder *folder)
-{
-       remote_folder_destroy(REMOTE_FOLDER(folder));
-}
-
 static gboolean folder_build_tree(GNode *node, gpointer data)
 {
        Folder *folder = FOLDER(data);
index aaee65b..7f0adfd 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 typedef struct _Folder         Folder;
 typedef struct _LocalFolder    LocalFolder;
 typedef struct _RemoteFolder   RemoteFolder;
-typedef struct _MHFolder       MHFolder;
-typedef struct _MboxFolder     MboxFolder;
+#if 0
 typedef struct _MaildirFolder  MaildirFolder;
-typedef struct _IMAPFolder     IMAPFolder;
-typedef struct _NewsFolder     NewsFolder;
+#endif
 typedef struct _FolderItem     FolderItem;
 
 #include "prefs_folder_item.h"
@@ -49,11 +47,9 @@ typedef struct _FolderItem   FolderItem;
                                 FOLDER_TYPE(obj) == F_MBOX    || \
                                 FOLDER_TYPE(obj) == F_MAILDIR)
 
-#define MH_FOLDER(obj)         ((MHFolder *)obj)
-#define MBOX_FOLDER(obj)       ((MboxFolder *)obj)
+#if 0
 #define MAILDIR_FOLDER(obj)    ((MaildirFolder *)obj)
-#define IMAP_FOLDER(obj)       ((IMAPFolder *)obj)
-#define NEWS_FOLDER(obj)       ((NewsFolder *)obj)
+#endif
 
 #define FOLDER_ITEM(obj)       ((FolderItem *)obj)
 
@@ -171,34 +167,12 @@ struct _RemoteFolder
        Session *session;
 };
 
-struct _MHFolder
-{
-       LocalFolder lfolder;
-};
-
-struct _MboxFolder
-{
-       LocalFolder lfolder;
-};
-
+#if 0
 struct _MaildirFolder
 {
        LocalFolder lfolder;
 };
-
-struct _IMAPFolder
-{
-       RemoteFolder rfolder;
-
-       GList *namespace;       /* list of IMAPNameSpace */
-};
-
-struct _NewsFolder
-{
-       RemoteFolder rfolder;
-
-       gboolean use_auth;
-};
+#endif
 
 struct _FolderItem
 {
@@ -242,32 +216,32 @@ typedef struct {
        guint   ret_rcpt        : 1; /* CLAWS */
 } PersistPrefs;
 
+Folder     *folder_new                 (FolderType      type,
+                                        const gchar    *name,
+                                        const gchar    *path);
+void        folder_local_folder_init   (Folder         *folder,
+                                        const gchar    *name,
+                                        const gchar    *path);
+void        folder_remote_folder_init  (Folder         *folder,
+                                        const gchar    *name,
+                                        const gchar    *path);
+
+void        folder_destroy             (Folder         *folder);
+void        folder_local_folder_destroy        (LocalFolder    *lfolder);
+void        folder_remote_folder_destroy(RemoteFolder  *rfolder);
 
-Folder     *folder_new         (FolderType      type,
-                                const gchar    *name,
-                                const gchar    *path);
-Folder     *mh_folder_new      (const gchar    *name,
-                                const gchar    *path);
-Folder     *mbox_folder_new    (const gchar    *name,
-                                const gchar    *path);
-Folder     *maildir_folder_new (const gchar    *name,
-                                const gchar    *path);
-Folder     *imap_folder_new    (const gchar    *name,
-                                const gchar    *path);
-Folder     *news_folder_new    (const gchar    *name,
-                                const gchar    *path);
 FolderItem *folder_item_new    (const gchar    *name,
                                 const gchar    *path);
 void        folder_item_append (FolderItem     *parent,
                                 FolderItem     *item);
 void        folder_item_remove (FolderItem     *item);
 void        folder_item_destroy        (FolderItem     *item);
+
 void        folder_set_ui_func (Folder         *folder,
                                 FolderUIFunc    func,
                                 gpointer        data);
 void        folder_set_name    (Folder         *folder,
                                 const gchar    *name);
-void        folder_destroy     (Folder         *folder);
 void        folder_tree_destroy        (Folder         *folder);
 
 void   folder_add              (Folder         *folder);
index 740a686..6d21250 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -200,9 +200,45 @@ static gboolean foldersel_gnode_func(GtkCTree *ctree, guint depth,
                                     gpointer data)
 {
        FolderItem *item = FOLDER_ITEM(gnode->data);
+       gchar *name;
+
+       switch (item->stype) {
+       case F_INBOX:
+               name = _("Inbox");
+               break;
+       case F_OUTBOX:
+               name = _("Outbox");
+               break;
+       case F_QUEUE:
+               name = _("Queue");
+               break;
+       case F_TRASH:
+               name = _("Trash");
+               break;
+       case F_DRAFT:
+               name = _("Draft");
+               break;
+       default:
+               name = item->name;
+
+               if (!item->parent) {
+                       switch (item->folder->type) {
+                       case F_MBOX:
+                               Xstrcat_a(name, name, " (MBOX)", ); break;
+                       case F_MH:
+                               Xstrcat_a(name, name, " (MH)", ); break;
+                       case F_IMAP:
+                               Xstrcat_a(name, name, " (IMAP4)", ); break;
+                       case F_NEWS:
+                               Xstrcat_a(name, name, " (News)", ); break;
+                       default:
+                               break;
+                       }
+               }
+       }
 
        gtk_ctree_node_set_row_data(ctree, cnode, item);
-       gtk_ctree_set_node_info(ctree, cnode, item->name,
+       gtk_ctree_set_node_info(ctree, cnode, name,
                                FOLDER_SPACING,
                                folderxpm, folderxpmmask,
                                folderopenxpm, folderopenxpmmask,
@@ -218,6 +254,29 @@ static void foldersel_expand_func(GtkCTree *ctree, GtkCTreeNode *node,
                gtk_ctree_expand(ctree, node);
 }
 
+#define SET_SPECIAL_FOLDER(item) \
+{ \
+       if (item) { \
+               GtkCTreeNode *node_, *sibling; \
+ \
+               node_ = gtk_ctree_find_by_row_data \
+                       (GTK_CTREE(ctree), node, item); \
+               if (!node_) \
+                       g_warning("%s not found.\n", item->path); \
+               else { \
+                       if (!prev) \
+                               sibling = GTK_CTREE_ROW(node)->children; \
+                       else \
+                               sibling = GTK_CTREE_ROW(prev)->sibling; \
+                       if (node_ != sibling) \
+                               gtk_ctree_move(GTK_CTREE(ctree), \
+                                              node_, node, sibling); \
+               } \
+ \
+               prev = node_; \
+       } \
+}
+
 static void foldersel_set_tree(Folder *cur_folder)
 {
        Folder *folder;
@@ -229,6 +288,8 @@ static void foldersel_set_tree(Folder *cur_folder)
        gtk_clist_freeze(GTK_CLIST(ctree));
 
        for (; list != NULL; list = list->next) {
+               GtkCTreeNode *prev = NULL;
+
                folder = FOLDER(list->data);
                g_return_if_fail(folder != NULL);
 
@@ -246,6 +307,11 @@ static void foldersel_set_tree(Folder *cur_folder)
                                              foldersel_gnode_func,
                                              NULL);
                gtk_ctree_sort_recursive(GTK_CTREE(ctree), node);
+               SET_SPECIAL_FOLDER(folder->inbox);
+               SET_SPECIAL_FOLDER(folder->outbox);
+               SET_SPECIAL_FOLDER(folder->draft);
+               SET_SPECIAL_FOLDER(folder->queue);
+               SET_SPECIAL_FOLDER(folder->trash);
                gtk_ctree_pre_recursive(GTK_CTREE(ctree), node,
                                        foldersel_expand_func,
                                        NULL);
index e6cd4ed..5e4c0f5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -70,9 +70,11 @@ static GList *session_list = NULL;
 
 static gint imap_cmd_count = 0;
 
+static void imap_folder_init           (Folder         *folder,
+                                        const gchar    *name,
+                                        const gchar    *path);
+
 static IMAPSession *imap_session_get   (Folder         *folder);
-static gchar *imap_query_password      (const gchar    *server,
-                                        const gchar    *user);
 
 static gint imap_scan_tree_recursive   (IMAPSession    *session,
                                         FolderItem     *item,
@@ -248,6 +250,45 @@ static gchar *search_array_starts          (GPtrArray *array,
 static void imap_path_separator_subst          (gchar          *str,
                                                 gchar           separator);
 
+
+Folder *imap_folder_new(const gchar *name, const gchar *path)
+{
+       Folder *folder;
+
+       folder = (Folder *)g_new0(IMAPFolder, 1);
+       imap_folder_init(folder, name, path);
+
+       return folder;
+}
+
+void imap_folder_destroy(IMAPFolder *folder)
+{
+       folder_remote_folder_destroy(REMOTE_FOLDER(folder));
+}
+
+static void imap_folder_init(Folder *folder, const gchar *name,
+                            const gchar *path)
+{
+       folder_remote_folder_init(folder, name, path);
+
+       folder->type = F_IMAP;
+
+       folder->get_msg_list        = imap_get_msg_list;
+       folder->fetch_msg           = imap_fetch_msg;
+       folder->add_msg             = imap_add_msg;
+       folder->move_msg            = imap_move_msg;
+       folder->move_msgs_with_dest = imap_move_msgs_with_dest;
+       folder->copy_msg            = imap_copy_msg;
+       folder->copy_msgs_with_dest = imap_copy_msgs_with_dest;
+       folder->remove_msg          = imap_remove_msg;
+       folder->remove_all_msg      = imap_remove_all_msg;
+       folder->scan                = imap_scan_folder;
+       folder->scan_tree           = imap_scan_tree;
+       folder->create_tree         = imap_create_tree;
+       folder->create_folder       = imap_create_folder;
+       folder->remove_folder       = imap_remove_folder;
+}
+
 static IMAPSession *imap_session_get(Folder *folder)
 {
        RemoteFolder *rfolder = REMOTE_FOLDER(folder);
@@ -309,19 +350,6 @@ static IMAPSession *imap_session_get(Folder *folder)
        return IMAP_SESSION(rfolder->session);
 }
 
-static gchar *imap_query_password(const gchar *server, const gchar *user)
-{
-       gchar *message;
-       gchar *pass;
-
-       message = g_strdup_printf(_("Input password for %s on %s:"),
-                                 user, server);
-       pass = input_dialog_with_invisible(_("Input password"), message, NULL);
-       g_free(message);
-
-       return pass;
-}
-
 Session *imap_session_new(const PrefsAccount *account)
 {
        IMAPSession *session;
@@ -372,7 +400,7 @@ Session *imap_session_new(const PrefsAccount *account)
                pass = account->passwd;
                if (!pass) {
                        gchar *tmp_pass;
-                       tmp_pass = imap_query_password(account->recv_server, account->userid);
+                       tmp_pass = input_dialog_query_password(account->recv_server, account->userid);
                        if (!tmp_pass)
                                return NULL;
                        Xstrdup_a(pass, tmp_pass, {g_free(tmp_pass); return NULL;});
index 4c3beee..1f63d77 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include "session.h"
 #include "procmsg.h"
 
+typedef struct _IMAPFolder     IMAPFolder;
 typedef struct _IMAPSession    IMAPSession;
 typedef struct _IMAPNameSpace  IMAPNameSpace;
 
 #include "prefs_account.h"
 
+#define IMAP_FOLDER(obj)       ((IMAPFolder *)obj)
 #define IMAP_SESSION(obj)      ((IMAPSession *)obj)
 
+struct _IMAPFolder
+{
+       RemoteFolder rfolder;
+
+       GList *namespace;       /* list of IMAPNameSpace */
+};
+
 struct _IMAPSession
 {
        Session session;
@@ -77,6 +86,10 @@ typedef enum
 #define IMAP_IS_DELETED(flags) ((flags & IMAP_FLAG_DELETED) != 0)
 #define IMAP_IS_DRAFT(flags)   ((flags & IMAP_FLAG_DRAFT) != 0)
 
+Folder *imap_folder_new                (const gchar    *name,
+                                        const gchar    *path);
+void    imap_folder_destroy            (IMAPFolder     *folder);
+
 Session *imap_session_new              (const PrefsAccount *account);
 void imap_session_destroy              (IMAPSession    *session);
 void imap_session_destroy_all          (void);
index e315bca..b5b9519 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -414,16 +414,11 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                                g_strdup(pop3_state->ac_prefs->tmp_pass);
                else {
                        gchar *pass;
-                       gchar *message;
 
-                       message = g_strdup_printf
-                               (_("Input password for %s on %s:"),
-                                pop3_state->user,
-                                pop3_state->ac_prefs->recv_server);
+                       pass = input_dialog_query_password
+                               (pop3_state->ac_prefs->recv_server,
+                                pop3_state->user);
 
-                       pass = input_dialog_with_invisible(_("Input password"),
-                                                          message, NULL);
-                       g_free(message);
                        if (inc_dialog->show_dialog)
                                manage_window_focus_in
                                        (inc_dialog->mainwin->window,
index cc8d7d0..7c117c0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -140,6 +140,19 @@ gchar *input_dialog_combo(const gchar *title, const gchar *message,
        return input_dialog_open(title, message, default_string);
 }
 
+gchar *input_dialog_query_password(const gchar *server, const gchar *user)
+{
+       gchar *message;
+       gchar *pass;
+
+       message = g_strdup_printf(_("Input password for %s on %s:"),
+                                 user, server);
+       pass = input_dialog_with_invisible(_("Input password"), message, NULL);
+       g_free(message);
+
+       return pass;
+}
+
 static void input_dialog_create(void)
 {
        GtkWidget *vbox;
index 02b996f..c93bb70 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -32,5 +32,7 @@ gchar *input_dialog_combo             (const gchar    *title,
                                         const gchar    *message,
                                         const gchar    *default_string,
                                         GList          *list);
+gchar *input_dialog_query_password     (const gchar    *server,
+                                        const gchar    *user);
 
 #endif /* __INPUTDIALOG_H__ */
index 5920631..b24d9f9 100644 (file)
@@ -479,42 +479,15 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_View/_Hide read messages"),      NULL, hide_read_messages, 0, "<ToggleItem>"},
        {N_("/_View/Set display _item..."),     NULL, set_display_item_cb, 0, NULL},
        {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Code set"),                NULL, NULL, 0, "<Branch>"},
-       {N_("/_View/_Code set/_Auto detect"),
-        NULL, set_charset_cb, C_AUTO, "<RadioItem>"},
-       {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to"),           NULL, NULL, 0, "<Branch>"},
-       {N_("/_View/_Go to/_Prev message"),     NULL, prev_cb, 0, NULL},
-       {N_("/_View/_Go to/_Next message"),     NULL, next_cb, 0, NULL},
-       {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/P_rev unread message"),
-                                               NULL, prev_unread_cb, 0, NULL},
-       {N_("/_View/_Go to/N_ext unread message"),
-                                               NULL, next_unread_cb, 0, NULL},
-       {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/Prev _marked message"),
-                                               NULL, prev_marked_cb, 0, NULL},
-       {N_("/_View/_Go to/Next m_arked message"),
-                                               NULL, next_marked_cb, 0, NULL},
-       {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/Prev _labeled message"),
-                                               NULL, prev_labeled_cb, 0, NULL},
-       {N_("/_View/_Go to/Next la_beled message"),
-                                               NULL, next_labeled_cb, 0, NULL},
-       {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/Other _folder..."),  "<alt>G", goto_folder_cb, 0, NULL},
-       {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/Open in new _window"),      "<shift><control>N", open_msg_cb, 0, NULL},
-       {N_("/_View/_View source"),             "<control>U", view_source_cb, 0, NULL},
-       {N_("/_View/Show all _header"),         "<control>H", header_window_show_cb, 0, NULL},
-       {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Update"),                  "<alt>U", update_summary_cb,  0, NULL},
 
 #define CODESET_SEPARATOR \
        {N_("/_View/_Code set/---"),            NULL, NULL, 0, "<Separator>"}
 #define CODESET_ACTION(action) \
         NULL, set_charset_cb, action, "/View/Code set/Auto detect"
 
+       {N_("/_View/_Code set"),                NULL, NULL, 0, "<Branch>"},
+       {N_("/_View/_Code set/_Auto detect"),
+        NULL, set_charset_cb, C_AUTO, "<RadioItem>"},
        {N_("/_View/_Code set/---"),            NULL, NULL, 0, "<Separator>"},
        {N_("/_View/_Code set/7bit ascii (US-ASC_II)"),
         CODESET_ACTION(C_US_ASCII)},
@@ -585,6 +558,34 @@ static GtkItemFactoryEntry mainwin_entries[] =
 #undef CODESET_SEPARATOR
 #undef CODESET_ACTION
 
+       {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
+       {N_("/_View/_Go to"),                   NULL, NULL, 0, "<Branch>"},
+       {N_("/_View/_Go to/_Prev message"),     NULL, prev_cb, 0, NULL},
+       {N_("/_View/_Go to/_Next message"),     NULL, next_cb, 0, NULL},
+       {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
+       {N_("/_View/_Go to/P_rev unread message"),
+                                               NULL, prev_unread_cb, 0, NULL},
+       {N_("/_View/_Go to/N_ext unread message"),
+                                               NULL, next_unread_cb, 0, NULL},
+       {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
+       {N_("/_View/_Go to/Prev _marked message"),
+                                               NULL, prev_marked_cb, 0, NULL},
+       {N_("/_View/_Go to/Next m_arked message"),
+                                               NULL, next_marked_cb, 0, NULL},
+       {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
+       {N_("/_View/_Go to/Prev _labeled message"),
+                                               NULL, prev_labeled_cb, 0, NULL},
+       {N_("/_View/_Go to/Next la_beled message"),
+                                               NULL, next_labeled_cb, 0, NULL},
+       {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
+       {N_("/_View/_Go to/Other _folder..."),  "<alt>G", goto_folder_cb, 0, NULL},
+       {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
+       {N_("/_View/Open in new _window"),      "<shift><control>N", open_msg_cb, 0, NULL},
+       {N_("/_View/_View source"),             "<control>U", view_source_cb, 0, NULL},
+       {N_("/_View/Show all _header"),         "<control>H", header_window_show_cb, 0, NULL},
+       {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
+       {N_("/_View/_Update"),                  "<alt>U", update_summary_cb,  0, NULL},
+
        {N_("/_Message"),                       NULL, NULL, 0, "<Branch>"},
        {N_("/_Message/Get new ma_il"), "<alt>I",       inc_mail_cb, 0, NULL},
        {N_("/_Message/Get from _all accounts"),
index c69b08b..b1848bc 100644 (file)
 
 #define MSGBUFSIZE     8192
 
+static void    mbox_folder_init                (Folder         *folder,
+                                                const gchar    *name,
+                                                const gchar    *path);
+
 static gboolean mbox_write_data(FILE * mbox_fp, FILE * new_fp,
                                gchar * new_filename, gint size);
 static gboolean mbox_rewrite(gchar * mbox);
@@ -42,7 +46,39 @@ static gboolean mbox_purge_deleted(gchar * mbox);
 static gchar * mbox_get_new_path(FolderItem * parent, gchar * name);
 static gchar * mbox_get_folderitem_name(gchar * name);
 
+Folder *mbox_folder_new(const gchar *name, const gchar *path)
+{
+       Folder *folder;
+
+       folder = (Folder *)g_new0(MBOXFolder, 1);
+       mbox_folder_init(folder, name, path);
+
+       return folder;
+}
+
+void mbox_folder_destroy(MBOXFolder *folder)
+{
+       folder_local_folder_destroy(LOCAL_FOLDER(folder));
+}
+
+static void mbox_folder_init(Folder *folder, const gchar *name, const gchar *path)
+{
+       folder_local_folder_init(folder, name, path);
+
+       folder->type = F_MBOX;
 
+       folder->get_msg_list        = mbox_get_msg_list;
+       folder->fetch_msg           = mbox_fetch_msg;
+       folder->add_msg             = mbox_add_msg;
+       folder->copy_msg            = mbox_copy_msg;
+       folder->remove_msg          = mbox_remove_msg;
+       folder->remove_all_msg      = mbox_remove_all_msg;
+       folder->scan                = mbox_scan_folder;
+       folder->create_tree         = mbox_create_tree;
+       folder->create_folder       = mbox_create_folder;
+       folder->rename_folder       = mbox_rename_folder;
+       folder->remove_folder       = mbox_remove_folder;
+}
 
 static gchar * mbox_folder_create_parent(const gchar * path)
 {
index 44a6913..4b46496 100644 (file)
@@ -31,6 +31,19 @@ char * mailfile_readheader(mailfile f, int index);
 void mailfile_done(mailfile f);
 int mailfile_count(mailfile f);
 */
+typedef struct _MBOXFolder     MBOXFolder;
+
+#define MBOX_FOLDER(obj)       ((MBOXFolder *)obj)
+
+struct _MBOXFolder
+{
+       LocalFolder lfolder;
+};
+
+Folder *mbox_folder_new        (const gchar    *name,
+                                const gchar    *path);
+void     mbox_folder_destroy   (MBOXFolder     *folder);
+
 
 GSList *mbox_get_msg_list(Folder *folder, FolderItem *item, gboolean use_cache);
 gchar *mbox_fetch_msg(Folder *folder, FolderItem *item, gint num);
index 5d03a5f..76bd09c 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include "procheader.h"
 #include "utils.h"
 
+static void    mh_folder_init                  (Folder         *folder,
+                                                const gchar    *name,
+                                                const gchar    *path);
+
 static GSList  *mh_get_uncached_msgs           (GHashTable     *msg_table,
                                                 FolderItem     *item);
 static MsgInfo *mh_parse_msg                   (const gchar    *file,
@@ -54,6 +58,45 @@ static gboolean mh_rename_folder_func                (GNode          *node,
                                                 gpointer        data);
 
 
+Folder *mh_folder_new(const gchar *name, const gchar *path)
+{
+       Folder *folder;
+
+       folder = (Folder *)g_new0(MHFolder, 1);
+       mh_folder_init(folder, name, path);
+
+       return folder;
+}
+
+void mh_folder_destroy(MHFolder *folder)
+{
+       folder_local_folder_destroy(LOCAL_FOLDER(folder));
+}
+
+static void mh_folder_init(Folder *folder, const gchar *name, const gchar *path)
+{
+       folder_local_folder_init(folder, name, path);
+
+       folder->type = F_MH;
+
+       folder->get_msg_list        = mh_get_msg_list;
+       folder->fetch_msg           = mh_fetch_msg;
+       folder->add_msg             = mh_add_msg;
+       folder->move_msg            = mh_move_msg;
+       folder->move_msgs_with_dest = mh_move_msgs_with_dest;
+       folder->copy_msg            = mh_copy_msg;
+       folder->copy_msgs_with_dest = mh_copy_msgs_with_dest;
+       folder->remove_msg          = mh_remove_msg;
+       folder->remove_all_msg      = mh_remove_all_msg;
+       folder->is_msg_changed      = mh_is_msg_changed;
+       folder->scan                = mh_scan_folder;
+       folder->scan_tree           = mh_scan_tree;
+       folder->create_tree         = mh_create_tree;
+       folder->create_folder       = mh_create_folder;
+       folder->rename_folder       = mh_rename_folder;
+       folder->remove_folder       = mh_remove_folder;
+}
+
 GSList *mh_get_msg_list(Folder *folder, FolderItem *item, gboolean use_cache)
 {
        GSList *mlist;
index 6467279..b26a3f8 100644 (file)
--- a/src/mh.h
+++ b/src/mh.h
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include "folder.h"
 #include "procmsg.h"
 
+typedef struct _MHFolder       MHFolder;
+
+#define MH_FOLDER(obj)         ((MHFolder *)obj)
+
+struct _MHFolder
+{
+       LocalFolder lfolder;
+};
+
+Folder *mh_folder_new          (const gchar    *name,
+                                const gchar    *path);
+void     mh_folder_destroy     (MHFolder       *folder);
+
 GSList  *mh_get_msg_list       (Folder         *folder,
                                 FolderItem     *item,
                                 gboolean        use_cache);
index 6165552..74616bf 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -720,6 +720,7 @@ static void mimeview_display_as_text(MimeView *mimeview)
 static void mimeview_save_as(MimeView *mimeview)
 {
        gchar *filename;
+       gchar *defname = NULL;
        MimeInfo *partinfo;
 
        if (!mimeview->opened) return;
@@ -729,9 +730,14 @@ static void mimeview_save_as(MimeView *mimeview)
                (GTK_CTREE(mimeview->ctree), mimeview->opened);
        g_return_if_fail(partinfo != NULL);
 
-       filename = filesel_select_file
-               (_("Save as"),
-                partinfo->filename ? partinfo->filename : partinfo->name);
+       if (partinfo->filename)
+               defname = partinfo->filename;
+       else if (partinfo->name) {
+               Xstrdup_a(defname, partinfo->name, return);
+               subst_for_filename(defname);
+       }
+
+       filename = filesel_select_file(_("Save as"), defname);
        if (!filename) return;
        if (is_file_exist(filename)) {
                AlertValue aval;
index e58d52a..086b369 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 #define NNTP_PORT      119
 
+static void news_folder_init            (Folder        *folder,
+                                         const gchar   *name,
+                                         const gchar   *path);
+
 static Session *news_session_new        (const gchar   *server,
                                          gushort        port,
                                          const gchar   *userid,
@@ -82,6 +86,33 @@ static GSList *news_delete_old_articles       (GSList        *alist,
 static void news_delete_all_articles    (FolderItem    *item);
 
 
+Folder *news_folder_new(const gchar *name, const gchar *path)
+{
+       Folder *folder;
+
+       folder = (Folder *)g_new0(NewsFolder, 1);
+       news_folder_init(folder, name, path);
+
+       return folder;
+}
+
+void news_folder_destroy(NewsFolder *folder)
+{
+       folder_remote_folder_destroy(REMOTE_FOLDER(folder));
+}
+
+static void news_folder_init(Folder *folder, const gchar *name,
+                            const gchar *path)
+{
+       folder_remote_folder_init(folder, name, path);
+
+       folder->type = F_NEWS;
+
+       folder->get_msg_list = news_get_article_list;
+       folder->fetch_msg    = news_fetch_msg;
+       folder->scan         = news_scan_group;
+}
+
 static Session *news_session_new(const gchar *server, gushort port,
                                 const gchar *userid, const gchar *passwd)
 {
@@ -123,19 +154,6 @@ void news_session_destroy(NNTPSession *session)
        g_free(session->group);
 }
 
-static gchar *news_query_password(const gchar *server, const gchar *user)
-{
-       gchar *message;
-       gchar *pass;
-
-       message = g_strdup_printf(_("Input password for %s on %s:"),
-                                 user, server);
-       pass = input_dialog_with_invisible(_("Input password"), message, NULL);
-       g_free(message);
-
-       return pass;
-}
-
 static Session *news_session_new_for_folder(Folder *folder)
 {
        Session *session;
@@ -152,7 +170,8 @@ static Session *news_session_new_for_folder(Folder *folder)
                if (ac->passwd && ac->passwd[0])
                        passwd = g_strdup(ac->passwd);
                else
-                       passwd = news_query_password(ac->nntp_server, userid);
+                       passwd = input_dialog_query_password(ac->nntp_server,
+                                                            userid);
        }
 
        session = news_session_new(ac->nntp_server,
index 3bb2eef..6280eaa 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include "session.h"
 #include "nntp.h"
 
+typedef struct _NewsFolder     NewsFolder;
 typedef struct _NNTPSession    NNTPSession;
 typedef struct _NewsGroupInfo  NewsGroupInfo;
 
+#define NEWS_FOLDER(obj)       ((NewsFolder *)obj)
 #define NNTP_SESSION(obj)      ((NNTPSession *)obj)
 
+struct _NewsFolder
+{
+       RemoteFolder rfolder;
+
+       gboolean use_auth;
+};
+
 struct _NNTPSession
 {
        Session session;
@@ -47,6 +56,10 @@ struct _NewsGroupInfo
        gchar type;
 };
 
+Folder *news_folder_new                (const gchar    *name,
+                                        const gchar    *folder);
+void    news_folder_destroy            (NewsFolder     *folder);
+
 void news_session_destroy              (NNTPSession    *session);
 NNTPSession *news_session_get          (Folder         *folder);
 
index 10d68a9..0066b35 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -121,7 +121,7 @@ void prefs_filter_open(void)
        if (prefs_rc_is_readonly(FILTER_RC))
                return;
 
-       inc_autocheck_timer_remove();
+       inc_lock();
 
        if (!filter.window) {
                prefs_filter_create();
@@ -870,7 +870,7 @@ static void prefs_filter_ok(void)
 {
        prefs_filter_write_config();
        gtk_widget_hide(filter.window);
-       inc_autocheck_timer_set();      
+       inc_unlock();
 }
 
 static void prefs_filter_cancel(void)
index 2d5cde2..b7e5084 100644 (file)
@@ -445,7 +445,7 @@ static GHashTable *procmsg_read_mark_file(const gchar *folder)
        mark_table = g_hash_table_new(NULL, g_direct_equal);
 
        while (fread(&num, sizeof(num), 1, fp) == 1) {
-               if (fread(&perm_flags, sizeof(flags), 1, fp) != 1) break;
+               if (fread(&perm_flags, sizeof(perm_flags), 1, fp) != 1) break;
 
                flags = g_new0(MsgFlags, 1);
                flags->perm_flags = perm_flags;
index 61aa884..7ba30d4 100644 (file)
@@ -76,8 +76,6 @@ static SendProgressDialog *send_progress_dialog_create(void);
 static void send_progress_dialog_destroy(SendProgressDialog *dialog);
 static void send_cancel(GtkWidget *widget, gpointer data);
 
-static gchar *send_query_password(const gchar *server, const gchar *user);
-
 
 gint send_message(const gchar *file, PrefsAccount *ac_prefs, GSList *to_list)
 {
@@ -306,8 +304,8 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list,
                        else if (ac_prefs->tmp_pass)
                                pass = ac_prefs->tmp_pass;
                        else {
-                               pass = send_query_password(ac_prefs->smtp_server,
-                                                          ac_prefs->smtp_userid);
+                               pass = input_dialog_query_password
+                                       (ac_prefs->smtp_server, ac_prefs->smtp_userid);
                                if (!pass) pass = g_strdup("");
                                ac_prefs->tmp_pass = pass;
                        }
@@ -318,8 +316,8 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list,
                        } else if (ac_prefs->tmp_pass)
                                pass = ac_prefs->tmp_pass;
                        else {
-                               pass = send_query_password(ac_prefs->smtp_server,
-                                                          ac_prefs->userid);
+                               pass = input_dialog_query_password
+                                       (ac_prefs->smtp_server, ac_prefs->userid);
                                if (!pass) pass = g_strdup("");
                                ac_prefs->tmp_pass = pass;
                        }
@@ -605,16 +603,3 @@ static void send_cancel(GtkWidget *widget, gpointer data)
 
        dialog->cancelled = TRUE;
 }
-
-static gchar *send_query_password(const gchar *server, const gchar *user)
-{
-       gchar *message;
-       gchar *pass;
-
-       message = g_strdup_printf(_("Input password for %s on %s:"),
-                                 user, server);
-       pass = input_dialog_with_invisible(_("Input password"), message, NULL);
-       g_free(message);
-
-       return pass;
-}
index 35f6821..29cffcf 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -3194,13 +3194,18 @@ void summary_save_as(SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        MsgInfo *msginfo;
+       gchar *filename = NULL;
        gchar *src, *dest;
 
        if (!summaryview->selected) return;
        msginfo = gtk_ctree_node_get_row_data(ctree, summaryview->selected);
        if (!msginfo) return;
 
-       dest = filesel_select_file(_("Save as"), NULL);
+       if (msginfo->subject) {
+               Xstrdup_a(filename, msginfo->subject, return);
+               subst_for_filename(filename);
+       }
+       dest = filesel_select_file(_("Save as"), filename);
        if (!dest) return;
        if (is_file_exist(dest)) {
                AlertValue aval;
index 54b5710..173900b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -940,6 +940,22 @@ void subst_char(gchar *str, gchar orig, gchar subst)
        }
 }
 
+void subst_chars(gchar *str, gchar *orig, gchar subst)
+{
+       register gchar *p = str;
+
+       while (*p) {
+               if (strchr(orig, *p) != NULL)
+                       *p = subst;
+               p++;
+       }
+}
+
+void subst_for_filename(gchar *str)
+{
+       subst_chars(str, " \t\r\n\"/\\", '_');
+}
+
 gboolean is_header_line(const gchar *str)
 {
        if (str[0] == ':') return FALSE;
index 3a65b15..e41939d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -263,6 +263,10 @@ void unfold_line                   (gchar          *str);
 void subst_char                                (gchar          *str,
                                         gchar           orig,
                                         gchar           subst);
+void subst_chars                       (gchar          *str,
+                                        gchar          *orig,
+                                        gchar           subst);
+void subst_for_filename                        (gchar          *str);
 gboolean is_header_line                        (const gchar    *str);
 gboolean is_ascii_str                  (const guchar   *str);
 gint get_quote_level                   (const gchar    *str);