mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-31 11:02:44 +00:00
Monotone-Parent: ed0087920f7016ffe9d167eede15e8f77e91413f
Monotone-Revision: 57cb13b050b46962a5b75e6eb9b8c15eddd51ef1 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-09-28T15:29:05 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
2010-09-28 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoUser.m (-_appendSystemMailAccount): cleaned
|
||||
up method by using NSNumber as class for port and removing useless
|
||||
tests on nil values.
|
||||
|
||||
* UI/MailerUI/UIxMailFolderActions.m (-createFolderAction):
|
||||
modified to make use of -[SOGoMailFolder create].
|
||||
|
||||
|
||||
@@ -502,24 +502,26 @@
|
||||
|
||||
- (void) _appendSystemMailAccount
|
||||
{
|
||||
NSString *fullName, *imapLogin, *imapServer, *signature, *encryption, *port,
|
||||
NSString *fullName, *imapLogin, *imapServer, *signature, *encryption,
|
||||
*scheme, *action;
|
||||
NSMutableDictionary *mailAccount, *identity, *mailboxes, *receipts;
|
||||
NSNumber *port;
|
||||
NSMutableArray *identities;
|
||||
NSArray *mails;
|
||||
NSURL *url;
|
||||
unsigned int count, max;
|
||||
NSInteger defaultPort;
|
||||
|
||||
[self userDefaults];
|
||||
|
||||
mailAccount = [NSMutableDictionary new];
|
||||
|
||||
// 1. login
|
||||
imapLogin = [[SOGoUserManager sharedUserManager]
|
||||
getImapLoginForUID: login];
|
||||
imapServer = [self _fetchFieldForUser: @"c_imaphostname"];
|
||||
if (!imapServer)
|
||||
imapServer = [[self domainDefaults] imapServer];
|
||||
[mailAccount setObject: imapLogin forKey: @"userName"];
|
||||
|
||||
// 2. server
|
||||
// imapServer might have the following format
|
||||
// localhost
|
||||
// localhost:143
|
||||
@@ -528,31 +530,33 @@
|
||||
// imaps://localhost:993
|
||||
// imaps://localhost:143/?tls=YES
|
||||
// imaps://localhost/?tls=YES
|
||||
|
||||
imapServer = [self _fetchFieldForUser: @"c_imaphostname"];
|
||||
if (!imapServer)
|
||||
imapServer = [[self domainDefaults] imapServer];
|
||||
url = [NSURL URLWithString: imapServer];
|
||||
|
||||
scheme = [url scheme];
|
||||
port = ([url port] ? [url port] : @"143");
|
||||
|
||||
encryption = @"none";
|
||||
|
||||
if ([url query] && [[url query] caseInsensitiveCompare: @"tls=YES"] == NSOrderedSame)
|
||||
encryption = @"tls";
|
||||
|
||||
if (scheme &&
|
||||
[scheme caseInsensitiveCompare: @"imaps"] == NSOrderedSame &&
|
||||
![encryption isEqualToString: @"tls"])
|
||||
{
|
||||
encryption = @"ssl";
|
||||
|
||||
if ([port intValue] == 0)
|
||||
port = @"993";
|
||||
}
|
||||
|
||||
if ([url host])
|
||||
imapServer = [url host];
|
||||
|
||||
[mailAccount setObject: imapLogin forKey: @"userName"];
|
||||
[mailAccount setObject: imapServer forKey: @"serverName"];
|
||||
|
||||
// 3. port & encryption
|
||||
scheme = [url scheme];
|
||||
if ([scheme caseInsensitiveCompare: @"imaps"] == NSOrderedSame)
|
||||
{
|
||||
encryption = @"ssl";
|
||||
defaultPort = 993;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([[url query] caseInsensitiveCompare: @"tls=YES"] == NSOrderedSame)
|
||||
encryption = @"tls";
|
||||
else
|
||||
encryption = @"none";
|
||||
defaultPort = 143;
|
||||
}
|
||||
port = [url port];
|
||||
if ([port intValue] == 0) /* port is nil or intValue == 0 */
|
||||
port = [NSNumber numberWithInt: defaultPort];
|
||||
[mailAccount setObject: port forKey: @"port"];
|
||||
[mailAccount setObject: encryption forKey: @"encryption"];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user