Fixed SSL compilation, a compiler warning, and eliminated a crashing bug that would happen on connection timeouts or failures.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9362 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Nathan Whitehorn 2004-10-14 21:03:42 +00:00
parent 4578da13a4
commit b1cec3747c
2 changed files with 14 additions and 8 deletions

View File

@ -118,12 +118,14 @@ class NoopWorker : public BHandler {
time_t last_run;
};
IMAP4Client::IMAP4Client(BMessage *settings, BMailChainRunner *run) : BMailRemoteStorageProtocol(settings,run), commandCount(0), net(-1), selected_mb(""), noop(NULL), force_reselect(false) {
IMAP4Client::IMAP4Client(BMessage *settings, BMailChainRunner *run) : BMailRemoteStorageProtocol(settings,run), noop(NULL), commandCount(0), net(-1), selected_mb(""), force_reselect(false) {
err = B_OK;
mb_root = settings->FindString("root");
#ifdef USESSL
use_ssl = (settings->FindInt32("flavor") == 1);
ssl = NULL;
ctx = NULL;
#endif
int port = settings->FindInt32("port");
@ -270,9 +272,11 @@ IMAP4Client::IMAP4Client(BMessage *settings, BMailChainRunner *run) : BMailRemot
}
IMAP4Client::~IMAP4Client() {
if (selected_mb != "")
SendCommand("CLOSE");
SendCommand("LOGOUT");
if (net > 0) {
if (selected_mb != "")
SendCommand("CLOSE");
SendCommand("LOGOUT");
}
for (int32 i = 0; i < box_info.CountItems(); i++)
delete (struct mailbox_info *)(box_info.ItemAt(i));
@ -281,8 +285,10 @@ IMAP4Client::~IMAP4Client() {
#ifdef USESSL
if (use_ssl) {
SSL_shutdown(ssl);
SSL_CTX_free(ctx);
if (ssl)
SSL_shutdown(ssl);
if (ctx)
SSL_CTX_free(ctx);
}
#endif

View File

@ -21,11 +21,11 @@ class IMAPConfig : public BMailProtocolConfigView {
IMAPConfig::IMAPConfig(BMessage *archive)
: BMailProtocolConfigView(B_MAIL_PROTOCOL_HAS_USERNAME | B_MAIL_PROTOCOL_HAS_PASSWORD | B_MAIL_PROTOCOL_HAS_HOSTNAME | B_MAIL_PROTOCOL_CAN_LEAVE_MAIL_ON_SERVER
#ifdef IMAPSSL
#ifdef USESSL
| B_MAIL_PROTOCOL_HAS_FLAVORS)
{
AddFlavor("Unencrypted");
AddFlavor("IMAP-SSL");
AddFlavor("SSL");
#else
) {
#endif