14 |
extern int sock; |
extern int sock; |
15 |
extern account_t *accounts; |
extern account_t *accounts; |
16 |
|
|
17 |
int options; /* Program options. */ |
unsigned int options; /* Program options. */ |
18 |
char logfile[PATH_MAX]; /* Log file. */ |
char logfile[PATH_MAX]; /* Log file. */ |
19 |
|
|
20 |
|
|
30 |
options = OPT_DETAILS_NORMAL; |
options = OPT_DETAILS_NORMAL; |
31 |
logfile[0] = 0; |
logfile[0] = 0; |
32 |
|
|
33 |
while ((c = getopt(argc, argv, "c:hl:qstv")) != -1) { |
while ((c = getopt(argc, argv, "c:hl:qtv")) != -1) { |
34 |
switch (c) { |
switch (c) { |
35 |
case 'c': |
case 'c': |
36 |
cfg = optarg; |
cfg = optarg; |
46 |
options &= OPT_DETAILS_CLEAR; |
options &= OPT_DETAILS_CLEAR; |
47 |
options |= OPT_DETAILS_QUITE; |
options |= OPT_DETAILS_QUITE; |
48 |
break; |
break; |
|
case 's': |
|
|
options |= OPT_SHOW_HEADERS; |
|
|
break; |
|
49 |
case 't': |
case 't': |
50 |
options |= OPT_TEST_MODE; |
options |= OPT_TEST_MODE; |
51 |
|
options |= OPT_TEST_MODE_STICKY; /* Override config |
52 |
|
file's TEST_MODE. */ |
53 |
break; |
break; |
54 |
case 'v': |
case 'v': |
55 |
options &= OPT_DETAILS_CLEAR; |
options &= OPT_DETAILS_CLEAR; |
105 |
char res[SEARCH_BUF]; |
char res[SEARCH_BUF]; |
106 |
|
|
107 |
if (!imap_search(res) && res[0]) { |
if (!imap_search(res) && res[0]) { |
108 |
delete_messages(res); |
del_messages(res); |
109 |
if (!(options & OPT_TEST_MODE)) |
if (!(options & OPT_TEST_MODE)) |
110 |
imap_expunge(); |
imap_expunge(); |
111 |
} |
} |
118 |
void usage(void) |
void usage(void) |
119 |
{ |
{ |
120 |
fprintf(stderr, |
fprintf(stderr, |
121 |
"usage: imapfilter [-hqstv] [-c configfile] [-l logfile]\n"); |
"usage: imapfilter [-hqtv] [-c configfile] [-l logfile]\n"); |
122 |
} |
} |