2007-08-24 [paul] 2.10.0cvs168
[claws.git] / src / folder.h
index a49223b94bf25f55f4b815b38dcd9506ed35a524..075e9e2ed55dc484eb632e9f2264fbb9f03ee9ab 100644 (file)
@@ -2,11 +2,11 @@
 
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
  *
  * 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
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -15,8 +15,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #ifndef __FOLDER_H__
@@ -80,7 +80,9 @@ typedef enum
        SORT_BY_STATUS,
        SORT_BY_MIME,
        SORT_BY_TO,
-       SORT_BY_LOCKED
+       SORT_BY_LOCKED,
+       SORT_BY_TAGS,
+       SORT_BY_THREAD_DATE
 } FolderSortKey;
 
 typedef enum
@@ -570,12 +572,45 @@ struct _FolderClass
                                                 MsgInfoList    *msglist,
                                                 GRelation      *msgflags);
        
+       /* Sets batch mode for a FolderItem. It means that numerous flags updates
+        * could follow, and the FolderClass implementation can cache them in order
+        * to process them later when set_false will be called again with the
+        * batch parameter set to FALSE. 
+        */
        void            (*set_batch)            (Folder         *folder,
                                                 FolderItem     *item,
                                                 gboolean        batch);
-       void            (*synchronise)          (FolderItem     *item);
+       /* Called when switching offline or asking for synchronisation. the imple
+        * mentation should do what's necessary to be able to read mails present
+        * in the FolderItem at this time with no network connectivity. 
+        * Days: max number of days of mail to fetch.
+        */
+       void            (*synchronise)          (FolderItem     *item,
+                                                gint            days);
+       
+       /* Passed from claws-mail --subscribe scheme://uri. Implementations
+        * should check if they handle this type of URI, and return TRUE in this
+        * case after having subscribed it.
+        */
        gboolean        (*subscribe)            (Folder         *folder,
                                                 const gchar    *uri);
+       
+       /* Gets the preferred sort key and type for a folderclass. */
+       void            (*get_sort_type)        (Folder         *folder,
+                                                FolderSortKey  *sort_key,
+                                                FolderSortType *sort_type);
+       
+       /* Copies internal FolderItem data from one folderItem to another. Used
+        * when moving folders (this move is in reality a folder creation, content
+        * move, folder delettion).
+        */
+       void            (*copy_private_data)    (Folder         *folder,
+                                                FolderItem     *src,
+                                                FolderItem     *dest);
+
+       void            (*remove_cached_msg)    (Folder         *folder,
+                                                FolderItem     *item,
+                                                MsgInfo        *msginfo);
 };
 
 struct _FolderItem
@@ -593,6 +628,8 @@ struct _FolderItem
        gint unreadmarked_msgs;
        gint marked_msgs;
 
+       gint order;
+
        gint last_num;
 
        MsgCache *cache;
@@ -632,6 +669,7 @@ struct _FolderItem
        SpecialFolderItemType parent_stype;
        gboolean processing_pending;
        gboolean scanning;
+       guint last_seen;
 };
 
 struct _PersistPrefs
@@ -706,6 +744,7 @@ GList *folder_get_list              (void);
 gint   folder_read_list                (void);
 void   folder_write_list       (void);
 void   folder_scan_tree                (Folder *folder, gboolean rebuild);
+void   folder_fast_scan_tree   (Folder *folder);
 FolderItem *folder_create_folder(FolderItem    *parent, const gchar *name);
 gint   folder_item_rename      (FolderItem *item, gchar *newname);
 void   folder_update_op_count          (void);
@@ -724,17 +763,20 @@ FolderItem *folder_find_item_from_path            (const gchar    *path);
 FolderClass *folder_get_class_from_string      (const gchar    *str);
 FolderItem *folder_find_child_item_by_name     (FolderItem     *item,
                                                 const gchar    *name);
-gchar      *folder_get_identifier              (Folder         *folder);
 gchar      *folder_item_get_identifier         (FolderItem     *item);
 FolderItem *folder_find_item_from_identifier   (const gchar    *identifier);
 gchar     *folder_item_get_name                (FolderItem     *item);
 
-Folder     *folder_get_default_folder  (void);
 FolderItem *folder_get_default_inbox   (void);
+FolderItem *folder_get_default_inbox_for_class(FolderType type);
 FolderItem *folder_get_default_outbox  (void);
+FolderItem *folder_get_default_outbox_for_class(FolderType type);
 FolderItem *folder_get_default_draft   (void);
+FolderItem *folder_get_default_draft_for_class(FolderType type);
 FolderItem *folder_get_default_queue   (void);
+FolderItem *folder_get_default_queue_for_class(FolderType type);
 FolderItem *folder_get_default_trash   (void);
+FolderItem *folder_get_default_trash_for_class(FolderType type);
 FolderItem *folder_get_default_processing (void);
 void folder_set_missing_folders                (void);
 void folder_unref_account_all          (PrefsAccount   *account);
@@ -771,7 +813,8 @@ gint   folder_item_add_msgs             (FolderItem     *dest,
                                          gboolean        remove_source);
 gint   folder_item_move_to             (FolderItem     *src,
                                         FolderItem     *dest,
-                                        FolderItem    **new_item);
+                                        FolderItem    **new_item,
+                                        gboolean        copy);
 gint   folder_item_move_msg            (FolderItem     *dest,
                                         MsgInfo        *msginfo);
 gint   folder_item_move_msgs           (FolderItem     *dest,
@@ -791,16 +834,8 @@ void       folder_item_change_msg_flags    (FolderItem     *item,
 gboolean folder_item_is_msg_changed    (FolderItem     *item,
                                         MsgInfo        *msginfo);
 /* return value is locale chaset */
-gchar *folder_item_get_cache_file      (FolderItem     *item);
-gchar *folder_item_get_mark_file       (FolderItem     *item);
 gchar * folder_item_get_identifier     (FolderItem * item);
 
-GHashTable *folder_persist_prefs_new   (Folder *folder);
-void folder_persist_prefs_free         (GHashTable *pptable);
-const PersistPrefs *folder_get_persist_prefs
-                                       (GHashTable *pptable, const char *name);
-
-void folder_item_restore_persist_prefs (FolderItem *item, GHashTable *pptable);
 void folder_clean_cache_memory         (FolderItem *protected_item);
 void folder_clean_cache_memory_force   (void);
 void folder_item_write_cache           (FolderItem *item);
@@ -827,5 +862,8 @@ gboolean folder_have_mailbox                (void);
 gboolean folder_item_free_cache                (FolderItem *item, gboolean force);
 void folder_item_change_type           (FolderItem *item,
                                         SpecialFolderItemType newtype);
-
+gboolean folder_get_sort_type          (Folder         *folder,
+                                        FolderSortKey  *sort_key,
+                                        FolderSortType *sort_type);
+void folder_item_synchronise           (FolderItem *item);
 #endif /* __FOLDER_H__ */