ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/IMAPHandler/Tester.cpp
Revision: 114
Committed: 2003-03-31T23:08:58-08:00 (19 years, 10 months ago) by douglas
File size: 1333 byte(s)
Log Message:
More, more!

File Contents

# User Rev Content
1 douglas 108 // IMAP Handler
2     //
3     // Douglas Thrift
4     //
5     // Tester.cpp
6    
7     #include "IMAPHandler.h"
8    
9     string program;
10     bool debug = true;
11    
12     int main(int argc, char* argv[])
13     {
14     program = argv[0];
15    
16 douglas 113 IMAPHandler tester("imap.myrealbox.com", false);
17 douglas 108
18 douglas 113 tester.capability();
19     tester.starttls();
20     tester.capability();
21 douglas 114 // tester.noop();
22 douglas 113
23     char* login = new char[32 + 1];
24     char* password = new char[32 + 1];
25    
26     cout << "login: " << flush;
27     cin.getline(login, 32);
28     cout << "password: " << flush;
29     cin.getline(password, 32);
30    
31     tester.login(string(login) + ' ' + password);
32    
33     memset(login, 0, strlen(login));
34     memset(password, 0, strlen(password));
35    
36     delete [] login;
37     delete [] password;
38    
39     cout << tester.list("\"\" *");
40 douglas 114 tester.status_("INBOX (MESSAGES UNSEEN)");
41     tester.examine("INBOX");
42 douglas 113
43 douglas 114 string message = string("Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)\r\n")
44     + "From: Fred Foobar <foobar@Blurdybloop.COM>\r\n"
45     + "Subject: afternoon meeting\r\n"
46     + "To: mooch@owatagu.siam.edu\r\n"
47     + "Message-Id: <B27397-0100000@Blurdybloop.COM>\r\n"
48     + "MIME-Version: 1.0\r\n"
49     + "Content-Type: TEXT/PLAIN; CHARSET=US-ASCII\r\n\r\n"
50     + "Hello Joe, do you think we can meet at 3:30 tomorrow?\r\n";
51    
52     char length[4];
53     sprintf(length, "%u", message.length());
54    
55     tester.append("INBOX {" + string(length) + "}", message);
56 douglas 113 tester.noop();
57     tester.logout();
58    
59 douglas 108 return 0;
60     }