5 /* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
8 * Virtual folder plugin for claws-mail
9 * Claws Mail is Copyright (C) 1999-2012 by the Claws Mail Team
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
37 /* Name of directory in rcdir where VFolder will store its data. */
38 #define VFOLDER_DIR "vfolder"
40 /* Parent mailbox name */
41 #define VFOLDER_DEFAULT_MAILBOX _("Virtual folders")
44 SEARCH_HEADERS
= 1, /* from/to/subject */
45 SEARCH_BODY
= 2, /* message */
46 SEARCH_BOTH
= 4 /* both */
55 BEFORE_ADDING_MSG = 1,
56 BEFORE_DELETING_MSG = 2,
58 AFTER_DELETING_MSG = 8
62 typedef struct _VFolderItem VFolderItem
;
63 typedef MsgInfoList
* (*MSGFILTERFUNC
) (MsgInfoList
* msgs
, VFolderItem
* item
);
68 gchar
* filter
; /* Regex used to select messages */
69 gboolean frozen
; /* Automatic update or not */
70 gboolean deep_copy
; /* Copy messages or use reference */
72 gboolean updating
; /* Is this VFolder currently updating */
74 FolderItem
* source
; /* Source folder for virtual folder */
75 // MsgInfoList* msginfos; /* List of MsgInfo */
76 GHashTable
* me_to_claws
; /* Hashtable containing MsgBridge */
77 GHashTable
* claws_to_me
; /* Hashtable containing MsgBridge */
78 MSGFILTERFUNC msg_filter_func
; /* Active filter function */
81 gboolean
vfolder_init(void);
82 void vfolder_done(void);
84 FolderClass
* vfolder_folder_get_class(void);
85 VFolderItem
* vfolder_get_vfolder_item(const gchar
* name
);
86 GList
* vfolder_get_vfolder_items(void);
87 GList
* vfolder_get_vfolder_from_source(FolderItem
* source
);
88 gboolean
vfolder_add_message_to_bridge(VFolderItem
* item
, MsgBridge
* bridge
);
89 gboolean
vfolder_replace_key_in_bridge(VFolderItem
* item
, guint from
, guint to
);
90 MsgInfo
* vfolder_find_msg_from_claws_num(VFolderItem
* item
, guint msgnum
);
91 MsgInfo
* vfolder_find_msg_from_vfolder_num(VFolderItem
* item
, guint msgnum
);
92 void vfolder_folder_item_update_msgs(VFolderItem
* item
, FolderItemUpdateFlags flag
);
94 #define VFOLDER_ITEM(obj) ((VFolderItem *)obj)
95 #define VFOLDER(obj) ((VFolder *)obj)
97 #define IS_VFOLDER_FOLDER(folder) \
98 ((folder) && (folder->klass == vfolder_folder_get_class()))
99 #define IS_VFOLDER_FOLDER_ITEM(item) \
100 ((item) && (item->folder->klass == vfolder_folder_get_class()))
101 #define IS_VFOLDER_MSGINFO(msginfo) \
102 ((msginfo) && (msginfo->folder) && IS_VFOLDER_FOLDER_ITEM(msginfo->folder))
103 #define IS_VFOLDER_FROZEN(item) ((item) && (item->frozen))
104 #define IS_VFOLDER_DEEP_COPY(item) ((item) && (item->deep_copy))