-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathkeywsync.hh
94 lines (73 loc) · 1.88 KB
/
keywsync.hh
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# pragma once
# include <vector>
# include <string>
# include <glibmm.h>
# include <boost/filesystem.hpp>
# include <boost/date_time/posix_time/posix_time.hpp>
using namespace std;
using namespace boost::filesystem;
using namespace boost::posix_time;
# include <notmuch.h>
# define ustring Glib::ustring
notmuch_database_t * setup_db (const char *);
/* tags to ignore from syncing (_must_ be sorted!)
*
* these are either internal notmuch tags or tags handled
* by maildirflags.
*
*/
const vector<ustring> ignore_tags = {
"attachment",
"draft",
"encrypted",
"flagged",
"important",
"new",
"passed",
"replied",
"signed",
"unread",
};
/* map keyword to tag, done before ignore_tags */
const list<pair<ustring,ustring>> map_tags {
{ "\\Draft", "draft" },
{ "\\Important", "important" },
{ "\\Inbox", "inbox" },
{ "\\Junk", "spam" },
{ "\\Muted", "muted" },
{ "\\Sent", "sent" },
{ "\\Starred", "flagged" },
{ "\\Trash", "deleted" },
};
/* replace chars, done before map keyword to tag */
bool enable_replace_chars = false;
const list<pair<char,char>> replace_chars {
{ '/', '.' },
};
bool keywords_consistency_check (vector<ustring> &, vector<ustring> &);
vector<ustring> get_keywords (ustring p, bool);
void split_string (vector<ustring> &, ustring, ustring);
void write_tags (ustring p, vector<ustring> tags);
template<class T> bool has (vector<T>, T);
enum Direction {
NONE,
TAG_TO_KEYWORD,
KEYWORD_TO_TAG,
};
Direction direction;
ustring inputquery;
bool mtime_set = false;
ptime only_after_mtime;
bool verbose = false;
bool more_verbose = false;
bool dryrun = false;
bool paranoid = false;
bool only_add = false;
bool only_remove = false;
bool maildir_flags = false;
bool enable_add_x_keywords_header = false;
path add_x_keyw_path;
bool remove_double_x_keywords_header = true;
int skipped_messages = 0;
ustring db_path;
notmuch_database_t * nm_db;