7 |
|
#include "IMAPHandler.h" |
8 |
|
|
9 |
|
string program; |
10 |
< |
bool debug = true; |
10 |
> |
bool debug = false; |
11 |
|
|
12 |
|
int main(int argc, char* argv[]) |
13 |
|
{ |
14 |
|
program = argv[0]; |
15 |
|
|
16 |
< |
IMAPHandler tester("imap.myrealbox.com", false); |
16 |
> |
bool tls = false; |
17 |
> |
|
18 |
> |
for (unsigned index = 1; index < argc; index++) |
19 |
> |
{ |
20 |
> |
string arg = argv[index]; |
21 |
> |
|
22 |
> |
if (arg == "-D") |
23 |
> |
{ |
24 |
> |
debug = true; |
25 |
> |
} |
26 |
> |
else if (arg == "-tls") |
27 |
> |
{ |
28 |
> |
tls = true; |
29 |
> |
} |
30 |
> |
} |
31 |
> |
|
32 |
> |
IMAPHandler tester("imap.myrealbox.com", tls); |
33 |
> |
|
34 |
> |
string abilities = tester.capability(); |
35 |
> |
|
36 |
> |
if (abilities.find(" LOGINDISABLED") != string::npos) |
37 |
> |
{ |
38 |
> |
if (abilities.find(" STARTTLS") != string::npos) |
39 |
> |
{ |
40 |
> |
tester.starttls(); |
41 |
> |
|
42 |
> |
if (!tester.successful()) |
43 |
> |
{ |
44 |
> |
cerr << program << ": Starting TLS didn't work.\n"; |
45 |
> |
return 1; |
46 |
> |
} |
47 |
> |
|
48 |
> |
tester.capability(); |
49 |
> |
} |
50 |
> |
else |
51 |
> |
{ |
52 |
> |
cerr << program << ": Login disabled and TLS not available.\n"; |
53 |
> |
return 1; |
54 |
> |
} |
55 |
> |
} |
56 |
|
|
18 |
– |
tester.capability(); |
19 |
– |
tester.starttls(); |
20 |
– |
tester.capability(); |
57 |
|
// tester.noop(); |
58 |
|
|
59 |
|
char* login = new char[32 + 1]; |
73 |
|
delete [] password; |
74 |
|
|
75 |
|
cout << tester.list("\"\" *"); |
76 |
< |
tester.status_("INBOX (MESSAGES UNSEEN)"); |
77 |
< |
tester.examine("INBOX"); |
78 |
< |
|
79 |
< |
string message = string("Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)\r\n") |
80 |
< |
+ "From: Fred Foobar <foobar@Blurdybloop.COM>\r\n" |
81 |
< |
+ "Subject: afternoon meeting\r\n" |
82 |
< |
+ "To: mooch@owatagu.siam.edu\r\n" |
83 |
< |
+ "Message-Id: <B27397-0100000@Blurdybloop.COM>\r\n" |
76 |
> |
// tester.create("FRED"); |
77 |
> |
// tester.rename("FRED MARTHA"); |
78 |
> |
// tester.delete_("MARTHA"); |
79 |
> |
// tester.status_("INBOX (MESSAGES UNSEEN)"); |
80 |
> |
// tester.examine("INBOX"); |
81 |
> |
|
82 |
> |
/* string message = string("Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)\n") |
83 |
> |
+ "From: Fred Foobar <foobar@Blurdybloop.COM>\n" |
84 |
> |
+ "Subject: afternoon meeting\n" |
85 |
> |
+ "To: mooch@owatagu.siam.edu\n" |
86 |
> |
+ "Message-Id: <B27397-0100000@Blurdybloop.COM>\n" |
87 |
|
+ "MIME-Version: 1.0\r\n" |
88 |
< |
+ "Content-Type: TEXT/PLAIN; CHARSET=US-ASCII\r\n\r\n" |
89 |
< |
+ "Hello Joe, do you think we can meet at 3:30 tomorrow?\r\n"; |
88 |
> |
+ "Content-Type: TEXT/PLAIN; CHARSET=US-ASCII\n\n" |
89 |
> |
+ "Hello Joe, do you think we can meet at 3:30 tomorrow?\n"; |
90 |
|
|
91 |
|
char length[4]; |
92 |
|
sprintf(length, "%u", message.length()); |
93 |
|
|
94 |
< |
tester.append("INBOX {" + string(length) + "}", message); |
95 |
< |
tester.noop(); |
94 |
> |
tester.append("Test {" + string(length) + "}", message);*/ |
95 |
> |
// tester.select("\"Program Testing\""); |
96 |
> |
// tester.noop(); |
97 |
|
tester.logout(); |
98 |
|
|
99 |
|
return 0; |