From 8328374042e19599f2e3647ad2294f2706dc7062 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 3 Sep 2010 12:21:48 +0000 Subject: [PATCH] Fixed the handling of TLS/SSL sockets, again. Monotone-Parent: 09f0f8877795f3a345aa7c98083aa8c1a62ad06f Monotone-Revision: 3041774927e7490f413c502580f789b26a0e693d Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2010-09-03T12:21:48 Monotone-Branch: ca.inverse.sogo --- SoObjects/Mailer/SOGoMailAccount.m | 13 +++++++++---- SoObjects/SOGo/SOGoUser.m | 5 +++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index 08ef11d39..b0ed7714f 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -522,12 +522,17 @@ static NSString *sieveScriptName = @"sogo"; mailAccount = [self _mailAccount]; encryption = [mailAccount objectForKey: @"encryption"]; defaultPort = 143; - protocol = @"imaps"; + protocol = @"imap"; if ([encryption isEqualToString: @"ssl"]) - defaultPort = 993; - else if (![encryption isEqualToString: @"tls"]) - protocol = @"imap"; + { + protocol = @"imaps"; + defaultPort = 993; + } + else if ([encryption isEqualToString: @"tls"]) + { + protocol = @"imaps"; + } username = [mailAccount objectForKey: @"userName"]; escUsername diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index cc903dd05..451672f30 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -531,14 +531,15 @@ url = [NSURL URLWithString: imapServer]; scheme = [url scheme]; - port = [url port]; + port = ([url port] ? [url port] : @"143"); encryption = @"none"; if ([url query] && [[url query] caseInsensitiveCompare: @"tls=YES"] == NSOrderedSame) encryption = @"tls"; - if ([scheme caseInsensitiveCompare: @"imaps"] == NSOrderedSame && + if (scheme && + [scheme caseInsensitiveCompare: @"imaps"] == NSOrderedSame && ![encryption isEqualToString: @"tls"]) { encryption = @"ssl";