// IMAP Handler // // Douglas Thrift // // Tester.cpp #include "IMAPHandler.h" string program; bool debug = false; int main(int argc, char* argv[]) { program = argv[0]; bool tls = false; for (unsigned index = 1; index < argc; index++) { string arg = argv[index]; if (arg == "-D") { debug = true; } else if (arg == "-tls") { tls = true; } } IMAPHandler tester("imap.myrealbox.com", tls); string abilities = tester.capability(); if (abilities.find(" LOGINDISABLED") != string::npos) { if (abilities.find(" STARTTLS") != string::npos) { tester.starttls(); if (!tester.successful()) { cerr << program << ": Starting TLS didn't work.\n"; return 1; } tester.capability(); } else { cerr << program << ": Login disabled and TLS not available.\n"; return 1; } } // tester.noop(); char* login = new char[32 + 1]; char* password = new char[32 + 1]; cout << "login: " << flush; cin.getline(login, 32); cout << "password: " << flush; cin.getline(password, 32); tester.login(string(login) + ' ' + password); memset(login, 0, strlen(login)); memset(password, 0, strlen(password)); delete [] login; delete [] password; cout << tester.list("\"\" *"); // tester.create("FRED"); // tester.rename("FRED MARTHA"); // tester.delete_("MARTHA"); // tester.status_("INBOX (MESSAGES UNSEEN)"); // tester.examine("INBOX"); /* string message = string("Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)\n") + "From: Fred Foobar \n" + "Subject: afternoon meeting\n" + "To: mooch@owatagu.siam.edu\n" + "Message-Id: \n" + "MIME-Version: 1.0\n" + "Content-Type: TEXT/PLAIN; CHARSET=US-ASCII\n\n" + "Hello Joe, do you think we can meet at 3:30 tomorrow?\n"; char length[4]; sprintf(length, "%u", message.length() + 8); tester.append("Test {" + string(length) + "}", message);*/ // tester.select("\"Program Testing\""); // tester.noop(); tester.logout(); return 0; }