2007-08-27 [colin] 2.10.0cvs179
[claws.git] / src / folder.h
blob075e9e2ed55dc484eb632e9f2264fbb9f03ee9ab
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
3 /*
4 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
5 * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef __FOLDER_H__
23 #define __FOLDER_H__
25 #include <glib.h>
26 #include <time.h>
28 typedef struct _Folder Folder;
29 typedef struct _FolderClass FolderClass;
31 typedef struct _FolderItem FolderItem;
32 typedef struct _FolderUpdateData FolderUpdateData;
33 typedef struct _FolderItemUpdateData FolderItemUpdateData;
34 typedef struct _PersistPrefs PersistPrefs;
36 #define FOLDER(obj) ((Folder *)obj)
37 #define FOLDER_CLASS(obj) (FOLDER(obj)->klass)
38 #define FOLDER_TYPE(obj) (FOLDER(obj)->klass->type)
40 #define FOLDER_IS_LOCAL(obj) (FOLDER_TYPE(obj) == F_MH || \
41 FOLDER_TYPE(obj) == F_MBOX || \
42 FOLDER_TYPE(obj) == F_MAILDIR)
44 #define FOLDER_ITEM(obj) ((FolderItem *)obj)
46 #define FOLDER_UPDATE_HOOKLIST "folder_update"
47 #define FOLDER_ITEM_UPDATE_HOOKLIST "folder_item_update"
49 typedef enum
51 F_MH,
52 F_MBOX,
53 F_MAILDIR,
54 F_IMAP,
55 F_NEWS,
56 F_UNKNOWN
57 } FolderType;
59 typedef enum
61 F_NORMAL,
62 F_INBOX,
63 F_OUTBOX,
64 F_DRAFT,
65 F_QUEUE,
66 F_TRASH
67 } SpecialFolderItemType;
69 typedef enum
71 SORT_BY_NONE,
72 SORT_BY_NUMBER,
73 SORT_BY_SIZE,
74 SORT_BY_DATE,
75 SORT_BY_FROM,
76 SORT_BY_SUBJECT,
77 SORT_BY_SCORE,
78 SORT_BY_LABEL,
79 SORT_BY_MARK,
80 SORT_BY_STATUS,
81 SORT_BY_MIME,
82 SORT_BY_TO,
83 SORT_BY_LOCKED,
84 SORT_BY_TAGS,
85 SORT_BY_THREAD_DATE
86 } FolderSortKey;
88 typedef enum
90 SORT_ASCENDING,
91 SORT_DESCENDING
92 } FolderSortType;
94 typedef enum
96 F_MOVE_OK = 0,
97 F_MOVE_FAILED_DEST_IS_PARENT = -1,
98 F_MOVE_FAILED_DEST_IS_CHILD = -2,
99 F_MOVE_FAILED_DEST_OUTSIDE_MAILBOX = -3,
100 F_MOVE_FAILED = -4
101 } FolderItemMoveResult;
103 typedef enum
105 FOLDER_ADD_FOLDER = 1 << 0,
106 FOLDER_REMOVE_FOLDER = 1 << 1,
107 FOLDER_TREE_CHANGED = 1 << 2,
108 FOLDER_ADD_FOLDERITEM = 1 << 3,
109 FOLDER_REMOVE_FOLDERITEM = 1 << 4,
110 FOLDER_RENAME_FOLDERITEM = 1 << 5
111 } FolderUpdateFlags;
113 typedef enum
115 F_ITEM_UPDATE_MSGCNT = 1 << 0,
116 F_ITEM_UPDATE_CONTENT = 1 << 1,
117 F_ITEM_UPDATE_ADDMSG = 1 << 2,
118 F_ITEM_UPDATE_REMOVEMSG = 1 << 3,
119 F_ITEM_UPDATE_NAME = 1 << 4
120 } FolderItemUpdateFlags;
122 typedef void (*FolderUIFunc) (Folder *folder,
123 FolderItem *item,
124 gpointer data);
125 typedef void (*FolderDestroyNotify) (Folder *folder,
126 FolderItem *item,
127 gpointer data);
128 typedef void (*FolderItemFunc) (FolderItem *item,
129 gpointer data);
132 #include "folder_item_prefs.h"
134 #include "procmsg.h"
135 #include "msgcache.h"
136 #include "xml.h"
137 #include "prefs_account.h"
139 struct _Folder
141 FolderClass *klass;
143 gchar *name;
144 PrefsAccount *account;
145 guint sort;
147 FolderItem *inbox;
148 FolderItem *outbox;
149 FolderItem *draft;
150 FolderItem *queue;
151 FolderItem *trash;
153 FolderUIFunc ui_func;
154 gpointer ui_func_data;
156 GNode *node;
158 gpointer data;
160 GHashTable *newsart;
163 struct _FolderClass
166 * A numeric identifier for the FolderClass. Will be removed in the future
168 FolderType type;
170 * A string identifier for the FolderClass. Currently used in folderlist.xml.
171 * Should be lowercase.
173 gchar *idstr;
175 * A string for the User Interface that identifies the FolderClass to the
176 * user. Can be upper and lowercase unlike the idstr.
178 gchar *uistr;
180 /* virtual functions */
182 /* Folder funtions */
184 * Create a new \c Folder of this \c FolderClass.
186 * \param name The name of the new Folder
187 * \param path The path of the new Folder
188 * \return The new \c Folder, or \c NULL when creating the \c Folder
189 * failed
191 Folder *(*new_folder) (const gchar *name,
192 const gchar *path);
194 * Destroy a \c Folder of this \c FolderClass, frees all resources
195 * allocated by the Folder
197 * \param folder The \c Folder that should be destroyed.
199 void (*destroy_folder) (Folder *folder);
201 * Set the Folder's internal attributes from an \c XMLTag. Also sets the
202 * parameters of the root-FolderItem of the \c Folder. If \c NULL
203 * the default function of the basic \ยข FolderClass is used, so it
204 * must not be \c NULL if one of the parent \c FolderClasses has a \c set_xml
205 * function. In that case the parent \c FolderClass' \c set_xml function
206 * can be used or it has to be called with the \c folder and \c tag by
207 * the implementation.
209 * \param folder The \c Folder which's attributes should be updated
210 * \param tag The \c XMLTag containing the \c XMLAttrs for the attributes
212 void (*set_xml) (Folder *folder,
213 XMLTag *tag);
215 * Get an \c XMLTag for the attributes of the \c Folder and the root-FolderItem
216 * of the \c Folder. If \c NULL the default implementation for the basic
217 * FolderClass will be used, so it must not be \c NULL if one of the
218 * parent \c FolderClasses has it's own implementation for \c get_xml.
219 * In that case the parent FolderClass' \c get_xml function can be
220 * used or the \c XMLTag has to be fetched from the parent's \c get_xml
221 * function and then the \c FolderClass specific attributes can be
222 * added to it.
224 * \param Folder The \c Folder which's attributes should be set in the
225 * \c XMLTag's \c XMLAttrs
226 * \return XMLTag An \c XMLTag with \c XMLAttrs containing the \c Folder's
227 * attributes.
229 XMLTag *(*get_xml) (Folder *folder);
231 * Rebuild the folder tree from the folder's data
232 * \todo New implementations of MH and IMAP are actually syncronizing
233 * the tree with the folder by reusing the old \c FolderItems.
234 * Claws still destroys the old tree before calling this function.
236 * \param folder The folder which's tree should be rebuild
237 * \return 0 on success, a negative number otherwise
239 gint (*scan_tree) (Folder *folder);
241 gint (*create_tree) (Folder *folder);
243 /* FolderItem functions */
245 * Create a new \c FolderItem structure for the \c FolderClass.
246 * \c FolderClasses can have their own \c FolderItem structure with
247 * extra attributes.
249 * \param folder The \c Folder for that a \c FolderItem should be
250 * created
251 * \return The new \c FolderItem or NULL in case of an error
253 FolderItem *(*item_new) (Folder *folder);
255 * Destroy a \c FolderItem from this \c FolderClass. The \c FolderClass
256 * has to free all private resources used by the \c FolderItem.
258 * \param folder The \c Folder of the \c FolderItem
259 * \param item The \c FolderItem that should be destroyed
261 void (*item_destroy) (Folder *folder,
262 FolderItem *item);
264 * Set the \c FolderItem's internal attributes from an \c XMLTag. If
265 * \c NULL the default function of the basic \c FolderClass is used, so it
266 * must not be \c NULL if one of the parent \c FolderClasses has a \c item_set_xml
267 * function. In that case the parent \c FolderClass' \c item_set_xml function
268 * can be used or it has to be called with the \c folder, \c item and \c tag by
269 * the implementation.
271 * \param folder The \c Folder of the \c FolderItem
272 * \param item The \c FolderItems which's attributes should be set
273 * \param tag The \c XMLTag with \c XMLAttrs for the \c FolderItem's
274 * attributes
276 void (*item_set_xml) (Folder *folder,
277 FolderItem *item,
278 XMLTag *tag);
280 * Get an \c XMLTag for the attributes of the \c FolderItem If \c NULL
281 * the default implementation for the basic \c FolderClass will be used,
282 * so it must not be \c NULL if one of the parent \c FolderClasses has
283 * it's own implementation for \c item_get_xml. In that case the parent
284 * FolderClass' \c item_get_xml function can be used or the \c XMLTag
285 * has to be fetched from the parent's \c item_get_xml function and
286 * then the \c FolderClass specific attributes can be added to it.
288 * \param folder The \c Folder of the \c FolderItem
289 * \parem item The \c FolderItem which's attributes should be set in
290 * the \c XMLTag's \c XMLAttrs
291 * \return An \c XMLTag with \c XMLAttrs containing the \c FolderItem's
292 * attributes.
294 XMLTag *(*item_get_xml) (Folder *folder,
295 FolderItem *item);
297 * Get a local path for the \c FolderItem where Sylpheed can save
298 * it's cache data. For local directory based folders this can be the
299 * real path. For other folders it can be the local cache directory.
301 * \param folder The \c Folder of the \c FolderItem
302 * \param item The \c FolderItem for that a path should be returned
303 * \return A path for the \c FolderItem
305 gchar *(*item_get_path) (Folder *folder,
306 FolderItem *item);
308 * Create a new \c FolderItem. The function must use folder_item_append
309 * to add the new \c FolderItem to the folder tree
311 * \param folder The \c Folder in which a new \c FolderItem should be
312 * created
313 * \param parent \c The parent \c FolderItem for the new \c FolderItem
314 * \parem name The name for the new \c FolderItem
315 * \return The new \c FolderItem
317 FolderItem *(*create_folder) (Folder *folder,
318 FolderItem *parent,
319 const gchar *name);
321 * Rename a \c FolderItem
323 * \param folder The \c Folder of the \c FolderItem that should be
324 * renamed
325 * \param item The \c FolderItem that should be renamed
326 * \param name The new name of the \c FolderItem
327 * \return 0 on success, a negative number otherwise
329 gint (*rename_folder) (Folder *folder,
330 FolderItem *item,
331 const gchar *name);
333 * Remove a \c FolderItem from the \c Folder
335 * \param folder The \c Folder that contains the \c FolderItem
336 * \param item The \c FolderItem that should be removed
337 * \return 0 on sucess, a negative number otherwise
339 gint (*remove_folder) (Folder *folder,
340 FolderItem *item);
342 * Close a \c FolderItem. Called when the user deselects a
343 * \c FolderItem.
345 * \attention In Sylpheed-Main operations can only be done on the
346 * \c FolderItem that is opened in the SummaryView. This
347 * \c FolderItem will be closed when you select a new
348 * \c FolderItem in the FolderView. In Claws operations can
349 * be done any time on any folder and you should not expect
350 * that all \c FolderItems get closed after operations
352 * \param folder The \c Folder that contains the \c FolderItem
353 * \param item The \c FolderItem that should be closed
354 * \return 0 on success, a negative number otherwise
356 gint (*close) (Folder *folder,
357 FolderItem *item);
359 * Get the list of message numbers for the messages in the \c FolderItem
361 * \param folder The \c Folder that contains the \c FolderItem
362 * \param item The \c FolderItem for which the message numbers should
363 * be fetched
364 * \param list Pointer to a GSList where message numbers have to be
365 * added. Because of the implementation of the GSList that
366 * changes the pointer of the GSList itself when the first
367 * item is added this is a pointer to a pointer to a
368 * GSList structure. Use *item = g_slist_...(*item, ...)
369 * operations to modify the list.
370 * \param old_uids_valid In some \c Folders the old UIDs can be invalid.
371 * Set this pointer to a gboolean to TRUE if the
372 * old UIDs are still valid, otherwise set it to
373 * FALSE and the folder system will discard it's
374 * cache data of the previously know UIDs
375 * \return The number of message numbers add to the list on success,
376 * a negative number otherwise.
378 gint (*get_num_list) (Folder *folder,
379 FolderItem *item,
380 GSList **list,
381 gboolean *old_uids_valid);
383 * Tell the folder system if a \c FolderItem should be scanned
384 * (cache data syncronized with the folder content) when it is required
385 * because the \c FolderItem's content changed. If NULL the folder
386 * system will not do automatic scanning of \c FolderItems
388 * \param folder The \c Folder that contains the \c FolderItem
389 * \param item The \c FolderItem which's content should be checked
390 * \return TRUE if the \c FolderItem should be scanned, FALSE otherwise
392 gboolean (*scan_required) (Folder *folder,
393 FolderItem *item);
395 /* Message functions */
397 * Get a MsgInfo for a message in a \c FolderItem
399 * \param folder The \c Folder containing the message
400 * \param item The \c FolderItem containing the message
401 * \param num The message number of the message
402 * \return A pointer to a \c MsgInfo decribing the message or \c
403 * NULL in case of an error
405 MsgInfo *(*get_msginfo) (Folder *folder,
406 FolderItem *item,
407 gint num);
409 * Get \c MsgInfos for a list of message numbers
411 * \param folder The \c Folder containing the message
412 * \param item The \c FolderItem containing the message
413 * \param msgnum_list A list of message numbers for which the
414 * \c MsgInfos should be fetched
415 * \return A list of \c MsgInfos for the messages in the \c msgnum_list
416 * that really exist. Messages that are not found can simply
417 * be left out.
419 MsgInfoList *(*get_msginfos) (Folder *folder,
420 FolderItem *item,
421 MsgNumberList *msgnum_list);
423 * Get the filename for a message. This can either be the real message
424 * file for local folders or a temporary file for remote folders.
426 * \param folder The \c Folder containing the message
427 * \param item The \c FolderItem containing the message
428 * \param num The message number of the message
429 * \return A string with the filename of the message file. The returned
430 * string has to be freed with \c g_free(). If message is not
431 * available return NULL.
433 gchar *(*fetch_msg) (Folder *folder,
434 FolderItem *item,
435 gint num);
436 gchar *(*fetch_msg_full) (Folder *folder,
437 FolderItem *item,
438 gint num,
439 gboolean headers,
440 gboolean body);
442 * Add a single message file to a folder with the given flags (if
443 * flag handling is supported by the folder)
445 * \param folder The target \c Folder for the message
446 * \param dest the target \c FolderItem for the message
447 * \param file The file that contains the message
448 * \param flags The flags the new message should have in the folder
449 * \return 0 on success, a negative number otherwise
451 gint (*add_msg) (Folder *folder,
452 FolderItem *dest,
453 const gchar *file,
454 MsgFlags *flags);
456 * Add multiple messages to a \c FolderItem. If NULL the folder
457 * system will add messages with \c add_msg one by one
459 * \param folder The target \c Folder for the messages
460 * \param dest the target \c FolderItem for the messages
461 * \param file_list A list of \c MsgFileInfos which contain the
462 * filenames and flags for the new messages
463 * \param relation Insert tuples of (MsgFileInfo, new message number) to
464 * provide feedback for the folder system which new
465 * message number a \c MsgFileInfo got in dest. Insert
466 * 0 if the new message number is unknown.
468 gint (*add_msgs) (Folder *folder,
469 FolderItem *dest,
470 GSList *file_list,
471 GRelation *relation);
473 * Copy a message to a FolderItem
475 * \param folder The \c Folder of the destination FolderItem
476 * \param dest The destination \c FolderItem for the message
477 * \param msginfo The message that should be copied
478 * \return The message number the copied message got, 0 if it is
479 * unknown because message numbers are assigned by an external
480 * system and not available after copying or a negative number
481 * if an error occuried
483 gint (*copy_msg) (Folder *folder,
484 FolderItem *dest,
485 MsgInfo *msginfo);
487 * Copy multiple messages to a \c FolderItem. If \c NULL the folder
488 * system will use \c copy_msg to copy messages one by one.
490 * \param folder The \c Folder of the destination FolderItem
491 * \param dest The destination \c FolderItem for the message
492 * \param msglist A list of \c MsgInfos which should be copied to dest
493 * \param relation Insert tuples of (MsgInfo, new message number) to
494 * provide feedback for the folder system which new
495 * message number a \c MsgInfo got in dest. Insert
496 * 0 if the new message number is unknown.
497 * \return 0 on success, a negative number otherwise
499 gint (*copy_msgs) (Folder *folder,
500 FolderItem *dest,
501 MsgInfoList *msglist,
502 GRelation *relation);
504 * Remove a message from a \c FolderItem.
506 * \param folder The \c Folder of the message
507 * \param item The \c FolderItem containing the message
508 * \param num The message number of the message
509 * \return 0 on success, a negative number otherwise
511 gint (*remove_msg) (Folder *folder,
512 FolderItem *item,
513 gint num);
514 gint (*remove_msgs) (Folder *folder,
515 FolderItem *item,
516 MsgInfoList *msglist,
517 GRelation *relation);
519 * Remove all messages in a \ c FolderItem
521 * \param folder The \c Folder of the \c FolderItem
522 * \param item The \FolderItem which's messages should be deleted
523 * \return 0 on succes, a negative number otherwise
525 gint (*remove_all_msg) (Folder *folder,
526 FolderItem *item);
528 * Check if a message has been modified by someone else
530 * \param folder The \c Folder of the message
531 * \param item The \c FolderItem containing the message
532 * \param msginfo The \c MsgInfo for the message that should be checked
533 * \return \c TRUE if the message was modified, \c FALSE otherwise
535 gboolean (*is_msg_changed) (Folder *folder,
536 FolderItem *item,
537 MsgInfo *msginfo);
539 * Update a message's flags in the folder data. If NULL only the
540 * internal flag management will be used. The function has to set
541 * \c msginfo->flags.perm_flags. It does not have to set the flags
542 * that it got as \c newflags. If a flag can not be set in this
543 * \c FolderClass the function can refuse to set it. Flags that are not
544 * supported by the \c FolderClass should not be refused. They will be
545 * managed by the internal cache in this case.
547 * \param folder The \c Folder of the message
548 * \param item The \c FolderItem of the message
549 * \param msginfo The \c MsgInfo for the message which's flags should be
550 * updated
551 * \param newflags The flags the message should get
553 void (*change_flags) (Folder *folder,
554 FolderItem *item,
555 MsgInfo *msginfo,
556 MsgPermFlags newflags);
558 * Get the flags for a list of messages. Flags that are not supported
559 * by the folder should be preserved. They can be copied from
560 * \c msginfo->flags.perm_flags
562 * \param folder The \c Folder of the messages
563 * \param item The \c FolderItem of the messages
564 * \param msglist The list of \c MsgInfos for which the flags should
565 * be returned
566 * \param msgflags A \c GRelation for tuples of (MsgInfo, new permanent
567 * flags for MsgInfo). Add tuples for the messages in msglist
568 * \return 0 on success, a negative number otherwise
570 gint (*get_flags) (Folder *folder,
571 FolderItem *item,
572 MsgInfoList *msglist,
573 GRelation *msgflags);
575 /* Sets batch mode for a FolderItem. It means that numerous flags updates
576 * could follow, and the FolderClass implementation can cache them in order
577 * to process them later when set_false will be called again with the
578 * batch parameter set to FALSE.
580 void (*set_batch) (Folder *folder,
581 FolderItem *item,
582 gboolean batch);
583 /* Called when switching offline or asking for synchronisation. the imple
584 * mentation should do what's necessary to be able to read mails present
585 * in the FolderItem at this time with no network connectivity.
586 * Days: max number of days of mail to fetch.
588 void (*synchronise) (FolderItem *item,
589 gint days);
591 /* Passed from claws-mail --subscribe scheme://uri. Implementations
592 * should check if they handle this type of URI, and return TRUE in this
593 * case after having subscribed it.
595 gboolean (*subscribe) (Folder *folder,
596 const gchar *uri);
598 /* Gets the preferred sort key and type for a folderclass. */
599 void (*get_sort_type) (Folder *folder,
600 FolderSortKey *sort_key,
601 FolderSortType *sort_type);
603 /* Copies internal FolderItem data from one folderItem to another. Used
604 * when moving folders (this move is in reality a folder creation, content
605 * move, folder delettion).
607 void (*copy_private_data) (Folder *folder,
608 FolderItem *src,
609 FolderItem *dest);
611 void (*remove_cached_msg) (Folder *folder,
612 FolderItem *item,
613 MsgInfo *msginfo);
616 struct _FolderItem
618 SpecialFolderItemType stype;
620 gchar *name; /* UTF-8 */
621 gchar *path; /* UTF-8 */
623 time_t mtime;
625 gint new_msgs;
626 gint unread_msgs;
627 gint total_msgs;
628 gint unreadmarked_msgs;
629 gint marked_msgs;
631 gint order;
633 gint last_num;
635 MsgCache *cache;
637 /* special flags */
638 guint no_sub : 1; /* no child allowed? */
639 guint no_select : 1; /* not selectable? */
640 guint collapsed : 1; /* collapsed item */
641 guint thread_collapsed : 1; /* collapsed item */
642 guint threaded : 1; /* threaded folder view */
643 guint hide_read_msgs : 1; /* hide read messages */
644 guint ret_rcpt : 1; /* return receipt */
645 guint search_match : 1;
647 gint op_count;
648 guint opened : 1; /* opened by summary view */
649 FolderItemUpdateFlags update_flags; /* folderview for this folder should be updated */
651 FolderSortKey sort_key;
652 FolderSortType sort_type;
654 GNode *node;
656 Folder *folder;
658 PrefsAccount *account;
660 gboolean apply_sub;
662 GSList *mark_queue;
664 gpointer data;
666 FolderItemPrefs * prefs;
668 /* for faster search of special parents */
669 SpecialFolderItemType parent_stype;
670 gboolean processing_pending;
671 gboolean scanning;
672 guint last_seen;
675 struct _PersistPrefs
677 FolderSortKey sort_key;
678 FolderSortType sort_type;
679 guint collapsed : 1;
680 guint thread_collapsed : 1;
681 guint threaded : 1;
682 guint hide_read_msgs : 1; /* CLAWS */
683 guint ret_rcpt : 1; /* CLAWS */
686 struct _FolderUpdateData
688 Folder *folder;
689 FolderUpdateFlags update_flags;
690 FolderItem *item;
693 struct _FolderItemUpdateData
695 FolderItem *item;
696 FolderItemUpdateFlags update_flags;
697 MsgInfo *msg;
700 void folder_system_init (void);
701 void folder_register_class (FolderClass *klass);
702 void folder_unregister_class (FolderClass *klass);
703 Folder *folder_new (FolderClass *type,
704 const gchar *name,
705 const gchar *path);
706 void folder_init (Folder *folder,
707 const gchar *name);
709 void folder_destroy (Folder *folder);
711 void folder_set_xml (Folder *folder,
712 XMLTag *tag);
713 XMLTag *folder_get_xml (Folder *folder);
715 FolderItem *folder_item_new (Folder *folder,
716 const gchar *name,
717 const gchar *path);
718 void folder_item_append (FolderItem *parent,
719 FolderItem *item);
720 void folder_item_remove (FolderItem *item);
721 void folder_item_remove_children (FolderItem *item);
722 void folder_item_destroy (FolderItem *item);
723 FolderItem *folder_item_parent (FolderItem *item);
725 void folder_item_set_xml (Folder *folder,
726 FolderItem *item,
727 XMLTag *tag);
728 XMLTag *folder_item_get_xml (Folder *folder,
729 FolderItem *item);
731 void folder_set_ui_func (Folder *folder,
732 FolderUIFunc func,
733 gpointer data);
734 void folder_set_name (Folder *folder,
735 const gchar *name);
736 void folder_set_sort (Folder *folder,
737 guint sort);
738 void folder_tree_destroy (Folder *folder);
740 void folder_add (Folder *folder);
741 void folder_remove (Folder *folder);
743 GList *folder_get_list (void);
744 gint folder_read_list (void);
745 void folder_write_list (void);
746 void folder_scan_tree (Folder *folder, gboolean rebuild);
747 void folder_fast_scan_tree (Folder *folder);
748 FolderItem *folder_create_folder(FolderItem *parent, const gchar *name);
749 gint folder_item_rename (FolderItem *item, gchar *newname);
750 void folder_update_op_count (void);
751 void folder_func_to_all_folders (FolderItemFunc function,
752 gpointer data);
753 void folder_count_total_msgs(guint *new_msgs, guint *unread_msgs,
754 guint *unreadmarked_msgs, guint *marked_msgs,
755 guint *total_msgs);
756 gchar *folder_get_status (GPtrArray *folders,
757 gboolean full);
759 Folder *folder_find_from_path (const gchar *path);
760 Folder *folder_find_from_name (const gchar *name,
761 FolderClass *klass);
762 FolderItem *folder_find_item_from_path (const gchar *path);
763 FolderClass *folder_get_class_from_string (const gchar *str);
764 FolderItem *folder_find_child_item_by_name (FolderItem *item,
765 const gchar *name);
766 gchar *folder_item_get_identifier (FolderItem *item);
767 FolderItem *folder_find_item_from_identifier (const gchar *identifier);
768 gchar *folder_item_get_name (FolderItem *item);
770 FolderItem *folder_get_default_inbox (void);
771 FolderItem *folder_get_default_inbox_for_class(FolderType type);
772 FolderItem *folder_get_default_outbox (void);
773 FolderItem *folder_get_default_outbox_for_class(FolderType type);
774 FolderItem *folder_get_default_draft (void);
775 FolderItem *folder_get_default_draft_for_class(FolderType type);
776 FolderItem *folder_get_default_queue (void);
777 FolderItem *folder_get_default_queue_for_class(FolderType type);
778 FolderItem *folder_get_default_trash (void);
779 FolderItem *folder_get_default_trash_for_class(FolderType type);
780 FolderItem *folder_get_default_processing (void);
781 void folder_set_missing_folders (void);
782 void folder_unref_account_all (PrefsAccount *account);
784 /* return value is locale encoded file name */
785 gchar *folder_item_get_path (FolderItem *item);
787 gint folder_item_open (FolderItem *item);
788 gint folder_item_close (FolderItem *item);
789 gint folder_item_scan (FolderItem *item);
790 gint folder_item_scan_full (FolderItem *item,
791 gboolean filtering);
792 gint folder_item_syncronize_flags (FolderItem *item);
793 void folder_item_scan_foreach (GHashTable *table);
794 MsgInfo *folder_item_get_msginfo (FolderItem *item,
795 gint num);
796 MsgInfo *folder_item_get_msginfo_by_msgid(FolderItem *item,
797 const gchar *msgid);
798 GSList *folder_item_get_msg_list (FolderItem *item);
799 /* return value is locale charset */
800 gchar *folder_item_fetch_msg (FolderItem *item,
801 gint num);
802 gchar *folder_item_fetch_msg_full (FolderItem *item,
803 gint num,
804 gboolean get_headers,
805 gboolean get_body);
806 gint folder_item_fetch_all_msg (FolderItem *item);
807 gint folder_item_add_msg (FolderItem *dest,
808 const gchar *file,
809 MsgFlags *flags,
810 gboolean remove_source);
811 gint folder_item_add_msgs (FolderItem *dest,
812 GSList *file_list,
813 gboolean remove_source);
814 gint folder_item_move_to (FolderItem *src,
815 FolderItem *dest,
816 FolderItem **new_item,
817 gboolean copy);
818 gint folder_item_move_msg (FolderItem *dest,
819 MsgInfo *msginfo);
820 gint folder_item_move_msgs (FolderItem *dest,
821 GSList *msglist);
822 gint folder_item_copy_msg (FolderItem *dest,
823 MsgInfo *msginfo);
824 gint folder_item_copy_msgs (FolderItem *dest,
825 GSList *msglist);
826 gint folder_item_remove_msg (FolderItem *item,
827 gint num);
828 gint folder_item_remove_msgs (FolderItem *item,
829 GSList *msglist);
830 gint folder_item_remove_all_msg (FolderItem *item);
831 void folder_item_change_msg_flags (FolderItem *item,
832 MsgInfo *msginfo,
833 MsgPermFlags newflags);
834 gboolean folder_item_is_msg_changed (FolderItem *item,
835 MsgInfo *msginfo);
836 /* return value is locale chaset */
837 gchar * folder_item_get_identifier (FolderItem * item);
839 void folder_clean_cache_memory (FolderItem *protected_item);
840 void folder_clean_cache_memory_force (void);
841 void folder_item_write_cache (FolderItem *item);
842 void folder_item_set_default_flags (FolderItem *dest, MsgFlags *flags);
844 void folder_item_apply_processing (FolderItem *item);
846 void folder_item_update (FolderItem *item,
847 FolderItemUpdateFlags update_flags);
848 void folder_item_update_recursive (FolderItem *item,
849 FolderItemUpdateFlags update_flags);
850 void folder_item_update_freeze (void);
851 void folder_item_update_thaw (void);
852 void folder_item_set_batch (FolderItem *item, gboolean batch);
853 gboolean folder_has_parent_of_type (FolderItem *item, SpecialFolderItemType type);
854 void folder_synchronise (Folder *folder);
855 gboolean folder_want_synchronise (Folder *folder);
856 void folder_item_process_open (FolderItem *item,
857 void (*before_proc_func)(gpointer data),
858 void (*after_proc_func)(gpointer data),
859 gpointer data);
860 gboolean folder_subscribe (const gchar *uri);
861 gboolean folder_have_mailbox (void);
862 gboolean folder_item_free_cache (FolderItem *item, gboolean force);
863 void folder_item_change_type (FolderItem *item,
864 SpecialFolderItemType newtype);
865 gboolean folder_get_sort_type (Folder *folder,
866 FolderSortKey *sort_key,
867 FolderSortType *sort_type);
868 void folder_item_synchronise (FolderItem *item);
869 #endif /* __FOLDER_H__ */