Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 170 lines (138 sloc) 4.703 kb
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
1 /*
2 ** Copyright (C) 2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
3 **
4 ** This program is free software; you can redistribute it and/or modify it
5 ** under the terms of the GNU General Public License as published by the
6 ** Free Software Foundation; either version 3, or (at your option) any
7 ** later version.
8 **
9 ** This program is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ** GNU General Public License for more details.
13 **
14 ** You should have received a copy of the GNU General Public License
15 ** along with this program; if not, write to the Free Software Foundation,
16 ** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 **
18 */
19
20
21 #ifndef __MU_FLAGS_H__
22 #define __MU_FLAGS_H__
23
24 #include <glib.h>
25
26 G_BEGIN_DECLS
27
28 enum _MuFlags {
29 MU_FLAG_NONE = 0,
675b897 Dirk-Jan C. Binnema * restore flag:unread and some optimization
authored
30
31 /* next 6 are seen in the file-info part of maildir message
32 * file names, ie., in a name like "1234345346:2,<fileinfo>",
33 * <fileinfo> consists of zero or more of the following
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
34 * characters (in ascii order) */
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
35 MU_FLAG_DRAFT = 1 << 0,
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
36 MU_FLAG_FLAGGED = 1 << 1,
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
37 MU_FLAG_PASSED = 1 << 2,
38 MU_FLAG_REPLIED = 1 << 3,
39 MU_FLAG_SEEN = 1 << 4,
40 MU_FLAG_TRASHED = 1 << 5,
675b897 Dirk-Jan C. Binnema * restore flag:unread and some optimization
authored
41
42 /* decides on cur/ or new/ in the maildir */
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
43 MU_FLAG_NEW = 1 << 6,
675b897 Dirk-Jan C. Binnema * restore flag:unread and some optimization
authored
44
45 /* content flags -- not visible in the filename, but used for
46 * searching */
2bdfb11 Dirk-Jan C. Binnema * mu-flags.[ch]: small updates
authored
47 MU_FLAG_SIGNED = 1 << 7,
48 MU_FLAG_ENCRYPTED = 1 << 8,
675b897 Dirk-Jan C. Binnema * restore flag:unread and some optimization
authored
49 MU_FLAG_HAS_ATTACH = 1 << 9,
50
51 /* pseudo-flag, only for queries, so we can search for
52 * flag:unread, which is equivalent to 'flag:new OR NOT
53 * flag:seen' */
54 MU_FLAG_UNREAD = 1 << 10
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
55 };
56 typedef enum _MuFlags MuFlags;
57
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
58 #define MU_FLAG_INVALID ((MuFlags)-1)
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
59
60 enum _MuFlagType {
61 MU_FLAG_TYPE_MAILFILE = 1 << 0,
62 MU_FLAG_TYPE_MAILDIR = 1 << 1,
675b897 Dirk-Jan C. Binnema * restore flag:unread and some optimization
authored
63 MU_FLAG_TYPE_CONTENT = 1 << 2,
64 MU_FLAG_TYPE_PSEUDO = 1 << 3
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
65 };
66 typedef enum _MuFlagType MuFlagType;
67
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
68 #define MU_FLAG_TYPE_ANY ((MuFlagType)-1)
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
69 #define MU_FLAG_TYPE_INVALID ((MuFlagType)-1)
70
71
72 /**
73 * Get the type of flag (mailfile, maildir, pseudo or content)
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
74 *
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
75 * @param flag a MuFlag
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
76 *
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
77 * @return the flag type or MU_FLAG_TYPE_INVALID in case of error
78 */
675b897 Dirk-Jan C. Binnema * restore flag:unread and some optimization
authored
79 MuFlagType mu_flag_type (MuFlags flag) G_GNUC_CONST;
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
80
81
82 /**
83 * Get the flag character
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
84 *
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
85 * @param flag a MuFlag (single)
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
86 *
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
87 * @return the character, or 0 in case of error
88 */
675b897 Dirk-Jan C. Binnema * restore flag:unread and some optimization
authored
89 char mu_flag_char (MuFlags flag) G_GNUC_CONST;
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
90
91
92 /**
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
93 * Get the flag name
94 *
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
95 * @param flag a single MuFlag
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
96 *
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
97 * @return the name (don't free) as string or NULL in case of error
98 */
675b897 Dirk-Jan C. Binnema * restore flag:unread and some optimization
authored
99 const char* mu_flag_name (MuFlags flag) G_GNUC_CONST;
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
100
101
102 /**
103 * Get the string representation of an OR'ed set of flags
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
104 *
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
105 * @param flags MuFlag (OR'ed)
106 * @param types allowable types (OR'ed) for the result; the rest is ignored
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
107 *
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
108 * @return The string representation (static, don't free), or NULL in
109 * case of error
110 */
111 const char* mu_flags_to_str_s (MuFlags flags, MuFlagType types);
112
113
114 /**
115 * Get the (OR'ed) flags corresponding to a string representation
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
116 *
d497bfe Dirk-Jan C. Binnema * add mu_flags_custom_from_str, to get the custom flags in a message fil...
authored
117 * @param str the file info string
895ab10 Dirk-Jan C. Binnema * optionally ignore invalid (unknown) message flag letters, update calle...
authored
118 * @param types the flag types to accept (other will be ignored)
119 * @param ignore invalid if TRUE, ignore invalid flags, otherwise return
120 * MU_FLAG_INVALID if an invalid flag is encountered
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
121 *
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
122 * @return the (OR'ed) flags
123 */
895ab10 Dirk-Jan C. Binnema * optionally ignore invalid (unknown) message flag letters, update calle...
authored
124 MuFlags mu_flags_from_str (const char *str, MuFlagType types,
125 gboolean ignore_invalid);
557a5e2 Dirk-Jan C. Binnema * mu mv updates:
authored
126
d497bfe Dirk-Jan C. Binnema * add mu_flags_custom_from_str, to get the custom flags in a message fil...
authored
127
128 /**
129 * return the concatenation of all non-standard file flags in str
130 * (ie., characters other than DFPRST) as a newly allocated string.
131 *
132 * @param str the file info string
133 *
134 * @return concatenation of all non-standard flags, as a string; free
135 * with g_free when done. If there are no such flags, return NULL.
136 */
137 char* mu_flags_custom_from_str (const char *str) G_GNUC_WARN_UNUSED_RESULT;
138
139
557a5e2 Dirk-Jan C. Binnema * mu mv updates:
authored
140 /**
141 * Update #oldflags with the flags in #str, where #str consists of the
142 * the normal flag characters, but prefixed with either '+' or '-',
143 * which means resp. "add this flag" or "remove this flag" from
144 * oldflags. So, e.g. "-N+S" would unset the NEW flag and set the
145 * SEEN flag, without affecting other flags.
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
146 *
557a5e2 Dirk-Jan C. Binnema * mu mv updates:
authored
147 * @param str the string representation
148 * @param old flags to update
149 * @param types the flag types to accept (other will be ignored)
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
150 *
151 * @return
557a5e2 Dirk-Jan C. Binnema * mu mv updates:
authored
152 */
153 MuFlags mu_flags_from_str_delta (const char *str, MuFlags oldflags,
154 MuFlagType types);
155
156
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
157 typedef void (*MuFlagsForeachFunc) (MuFlags flag, gpointer user_data);
158
159 /**
160 * call a function for each available flag
f02bb34 Dirk-Jan C. Binnema * make mu compile warning-free with clang/clang++
authored
161 *
a571a3f Dirk-Jan C. Binnema * MuMsgFlags => MuFlags
authored
162 * @param func a function to call
163 * @param user_data a user pointer to pass to the function
164 */
165 void mu_flags_foreach (MuFlagsForeachFunc func, gpointer user_data);
166
167 G_END_DECLS
168
169 #endif /*__MU_FLAGS_H__*/
Something went wrong with that request. Please try again.