2006-01-09 [wwp] 1.9.100cvs127
[claws.git] / src / filtering.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2002 Hiroyuki Yamamoto & The Sylpheed Claws Team
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef FILTER_NEW_H
21
22 #define FILTER_NEW_H
23
24 #include <glib.h>
25 #include "matcher.h"
26 #include "procmsg.h"
27
28 struct _FilteringAction {
29         gint    type;
30         gint    account_id;
31         gchar  *destination;
32         gint    labelcolor;
33         gint    score;
34 };
35
36 typedef struct _FilteringAction FilteringAction;
37
38 struct _FilteringProp {
39         gchar *name;
40         MatcherList * matchers;
41         GSList * action_list;
42 };
43
44 typedef struct _FilteringProp FilteringProp;
45
46 /* extern GSList * prefs_filtering; */
47
48
49 FilteringAction * filteringaction_new(int type, int account_id,
50                                       gchar * destination,
51                                       gint labelcolor, gint score);
52 void filteringaction_free(FilteringAction *action);
53 FilteringAction * filteringaction_parse(gchar **str);
54 gboolean filteringaction_apply_action_list (GSList *action_list, MsgInfo *info);
55
56 FilteringProp * filteringprop_new(const gchar *name,
57                                   MatcherList *matchers,
58                                   GSList *action_list);
59 void filteringprop_free(FilteringProp *prop);
60
61 FilteringProp * filteringprop_parse(gchar **str);
62
63 void filter_msginfo_move_or_delete(GSList *filtering_list, MsgInfo *info);
64 gboolean filter_message_by_msginfo(GSList *flist, MsgInfo *info);
65
66 gchar * filteringaction_to_string(gchar *dest, gint destlen, FilteringAction *action);
67 void prefs_filtering_write_config(void);
68 void prefs_filtering_read_config(void);
69 gchar * filteringaction_list_to_string(GSList * action_list);
70 gchar * filteringprop_to_string(FilteringProp *prop);
71
72 void prefs_filtering_clear(void);
73 void prefs_filtering_clear_folder(Folder *folder);
74 void prefs_filtering_free(GSList *prefs_filtering);
75
76 FilteringProp * filteringprop_copy(FilteringProp *src);
77
78 extern GSList * filtering_rules;
79 extern GSList * pre_global_processing;
80 extern GSList * post_global_processing;
81
82 #endif