sync account.c with sylpheed 0.5.3 plus button
[claws.git] / src / filter.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999,2000 Hiroyuki Yamamoto
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __FILTER_H__
21 #define __FILTER_H__
22
23 #include <glib.h>
24
25 #include "folder.h"
26
27 typedef struct _Filter  Filter;
28
29 typedef enum
30 {
31         FLT_CONTAIN     = 1 << 0,
32         FLT_CASE_SENS   = 1 << 1
33 } FilterFlag;
34
35 typedef enum
36 {
37         FLT_AND,
38         FLT_OR,
39         FLT_NOT
40 } FilterCond;
41
42 typedef enum
43 {
44         FLT_MOVE,
45         FLT_NOTRECV,
46         FLT_DELETE
47 } FilterAction;
48
49 #define FLT_IS_CONTAIN(flag)    ((flag & FLT_CONTAIN) != 0)
50 #define FLT_IS_CASE_SENS(flag)  ((flag & FLT_CASE_SENS) != 0)
51
52 struct _Filter
53 {
54         gchar *name1;
55         gchar *body1;
56
57         gchar *name2;
58         gchar *body2;
59
60         FilterFlag flag1;
61         FilterFlag flag2;
62
63         FilterCond cond;
64
65         /* destination folder */
66         gchar *dest;
67
68         FilterAction action;
69 };
70
71 #define FILTER_NOT_RECEIVE      "//NOT_RECEIVE//"
72
73 FolderItem *filter_get_dest_folder      (GSList         *fltlist,
74                                          const gchar    *file);
75 gboolean filter_match_condition         (Filter         *filter,
76                                          GSList         *hlist);
77 gchar *filter_get_str                   (Filter         *filter);
78 Filter *filter_read_str                 (const gchar    *str);
79 void filter_free                        (Filter         *filter);
80
81 #endif /* __FILTER_H__ */