]> git.datanom.net - vfolder.git/blob - src/vfolder.h
initial upload
[vfolder.git] / src / vfolder.h
1 /*
2 * $Id: $
3 */
4
5 /* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
6
7 /*
8 * Virtual folder plugin for claws-mail
9 * Claws Mail is Copyright (C) 1999-2012 by the Claws Mail Team
10 *
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.
15 *
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.
20 *
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/>.
23 *
24 */
25
26 #ifndef __VFOLDER_H__
27 #define __VFOLDER_H__
28
29 #include <glib.h>
30
31 G_BEGIN_DECLS
32
33 #include "folder.h"
34 #include <procmsg.h>
35 #include "gettext.h"
36
37 /* Name of directory in rcdir where VFolder will store its data. */
38 #define VFOLDER_DIR "vfolder"
39
40 /* Parent mailbox name */
41 #define VFOLDER_DEFAULT_MAILBOX _("Virtual folders")
42
43 typedef enum {
44 SEARCH_HEADERS = 1, /* from/to/subject */
45 SEARCH_BODY = 2, /* message */
46 SEARCH_BOTH = 4 /* both */
47 } SearchType;
48
49 typedef struct {
50 guint my_num;
51 guint claws_num;
52 } MsgBridge;
53
54 /*typedef enum {
55 BEFORE_ADDING_MSG = 1,
56 BEFORE_DELETING_MSG = 2,
57 AFTER_ADDING_MSG = 4,
58 AFTER_DELETING_MSG = 8
59 } ChangeAction;
60 */
61
62 typedef struct _VFolderItem VFolderItem;
63 typedef MsgInfoList* (*MSGFILTERFUNC) (MsgInfoList* msgs, VFolderItem* item);
64
65 struct _VFolderItem {
66 FolderItem item;
67
68 gchar* filter; /* Regex used to select messages */
69 gboolean frozen; /* Automatic update or not */
70 gboolean deep_copy; /* Copy messages or use reference */
71 SearchType search;
72 gboolean updating; /* Is this VFolder currently updating */
73
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 */
79 };
80
81 gboolean vfolder_init(void);
82 void vfolder_done(void);
83
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);
93
94 #define VFOLDER_ITEM(obj) ((VFolderItem *)obj)
95 #define VFOLDER(obj) ((VFolder *)obj)
96
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))
105
106 G_END_DECLS
107
108 #endif
This page took 0.077301 seconds and 6 git commands to generate.