1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
| | #ifndef _TAG_UTIL_H
#define _TAG_UTIL_H
#include "notmuch-client.h"
typedef struct {
const char *tag;
notmuch_bool_t remove;
} tag_operation_t;
#define TAG_OP_LIST_INITIAL_SIZE 10
typedef struct {
tag_operation_t *ops;
int count;
int size;
} tag_op_list_t;
/* Use powers of 2 */
typedef enum { TAG_FLAG_NONE = 0,
TAG_FLAG_MAILDIR_SYNC = 1,
TAG_FLAG_REMOVE_ALL = 2 } tag_op_flag_t;
typedef int (*tag_callback_t)(void *ctx,
notmuch_database_t *notmuch,
const char *query_string,
tag_op_list_t *tag_ops,
tag_op_flag_t flags);
int
parse_tag_stream (void *ctx,
notmuch_database_t *notmuch,
FILE *input,
tag_callback_t callback,
tag_op_flag_t flags,
volatile sig_atomic_t *interrupted);
/*
* Returns: 0 for OK, 1 for skipped line, -1 for fatal(ish) error.
*/
int
parse_tag_line (void *ctx, char *line, char **query_str, tag_op_list_t *ops);
tag_op_list_t
*tag_op_list_create (void *ctx);
int
tag_op_list_append (void *ctx,
tag_op_list_t *list,
const char *tag,
notmuch_bool_t remove);
notmuch_status_t
tag_op_list_apply (notmuch_message_t *message,
tag_op_list_t *tag_ops,
tag_op_flag_t flags);
int
tag_op_list_from_string (void *ctx,
char *tag_string,
notmuch_bool_t remove,
tag_op_list_t *tag_ops);
notmuch_bool_t
tag_op_list_empty (tag_op_list_t *list);
void
tag_op_list_reset (tag_op_list_t *list);
#endif
|