static void ComputeDefaultValues (string host, ref int port, ref SecureSocketOptions options, out Uri uri, out bool starttls)
{
switch (options) {
default:
if (port == 0)
port = 143;
break;
case SecureSocketOptions.Auto:
switch (port) {
case 0: port = 143; goto default;
case 993: options = SecureSocketOptions.SslOnConnect; break;
default: options = SecureSocketOptions.StartTlsWhenAvailable; break;
}
break;
case SecureSocketOptions.SslOnConnect:
if (port == 0)
port = 993;
break;
}
switch (options) {
case SecureSocketOptions.StartTlsWhenAvailable:
uri = new Uri ("imap://" + host + ":" + port + "/?starttls=when-available");
starttls = true;
break;
case SecureSocketOptions.StartTls:
uri = new Uri ("imap://" + host + ":" + port + "/?starttls=always");
starttls = true;
break;
case SecureSocketOptions.SslOnConnect:
uri = new Uri ("imaps://" + host + ":" + port);
starttls = false;
break;
default:
uri = new Uri ("imap://" + host + ":" + port);
starttls = false;
break;
}
}