11 |
|
|
12 |
|
|
13 |
int options; /* Program options. */ |
int options; /* Program options. */ |
14 |
|
char logfile[PATH_MAX]; /* Log file. */ |
15 |
extern int sock; |
extern int sock; |
16 |
extern account_data account; |
int curacc; /* Current account being proccessed. */ |
17 |
|
extern int acccnt; |
18 |
|
|
19 |
/* |
/* |
20 |
* In the begining there was main()... |
* In the begining there was main()... |
25 |
int c; |
int c; |
26 |
|
|
27 |
options = OPTION_DETAILS_NORMAL; |
options = OPTION_DETAILS_NORMAL; |
28 |
|
logfile[0] = 0; |
|
prepare_account(); |
|
29 |
|
|
30 |
while ((c = getopt(argc, argv, "c:hl:qstv")) != -1) { |
while ((c = getopt(argc, argv, "c:hl:qstv")) != -1) { |
31 |
switch (c) { |
switch (c) { |
37 |
exit(1); |
exit(1); |
38 |
break; |
break; |
39 |
case 'l': |
case 'l': |
40 |
strncpy(account.logfile, optarg, FILENAME_MAX); |
strncpy(logfile, optarg, FILENAME_MAX); |
41 |
break; |
break; |
42 |
case 'q': |
case 'q': |
43 |
options &= OPTION_DETAILS_CLEAR; |
options &= OPTION_DETAILS_CLEAR; |
63 |
if (read_config(config) || open_logfile()) |
if (read_config(config) || open_logfile()) |
64 |
exit(2); |
exit(2); |
65 |
|
|
66 |
if (establish_connection()) { |
for (curacc = 0; curacc <= acccnt; curacc++) { |
67 |
close_logfile(); |
if (establish_connection()) { |
68 |
exit(3); |
close_logfile(); |
69 |
} |
exit(3); |
70 |
|
} |
71 |
|
|
72 |
clear_stream(); |
clear_stream(); |
73 |
|
|
74 |
#ifdef DEBUG |
#ifdef DEBUG |
75 |
imap_noop(); |
imap_noop(); |
76 |
#endif |
#endif |
77 |
|
|
78 |
imap_login(); |
imap_login(); |
79 |
imap_select(); |
imap_select(); |
80 |
|
|
81 |
apply_filters(); |
apply_filters(); |
82 |
|
|
83 |
imap_logout(); |
imap_logout(); |
84 |
|
|
85 |
close_connection(); |
close_connection(); |
86 |
|
} |
87 |
|
|
88 |
close_logfile(); |
close_logfile(); |
89 |
|
|