mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-30 02:37:16 +00:00
feat(openID): second part with a lot of fixes and cleaning
This commit is contained in:
@@ -132,14 +132,24 @@
|
||||
|
||||
- (NGImap4ConnectionManager *) mailManager
|
||||
{
|
||||
return [NGImap4ConnectionManager defaultConnectionManager];
|
||||
SOGoSystemDefaults *sd;
|
||||
NSString *imapAuthMech, *domain;
|
||||
|
||||
domain = [[[self context] activeUser] loginDomain];
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
if([sd doesLoginTypeByDomain])
|
||||
imapAuthMech = [sd getImapAuthMechForDomain: domain];
|
||||
else
|
||||
imapAuthMech = nil;
|
||||
|
||||
return [NGImap4ConnectionManager defaultConnectionManager: imapAuthMech];
|
||||
}
|
||||
|
||||
- (NGImap4Connection *) _createIMAP4Connection
|
||||
{
|
||||
NGImap4ConnectionManager *manager;
|
||||
NGImap4Connection *newConnection;
|
||||
NSString *password;
|
||||
NSString *password, *domain;
|
||||
NGInternetSocketAddress *host;
|
||||
SOGoSystemDefaults *sd;
|
||||
BOOL usesSSO;
|
||||
@@ -152,12 +162,15 @@
|
||||
host = [NGInternetSocketAddress addressWithPort:0 onHost:[[self imap4URL] host]];
|
||||
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
usesSSO = [sd isSsoUsed];
|
||||
|
||||
domain = [[[self context] activeUser] loginDomain];
|
||||
usesSSO = [sd isSsoUsed: domain];
|
||||
|
||||
if (![[[self mailAccountFolder] nameInContainer] isEqualToString: @"0"] &&
|
||||
usesSSO &&
|
||||
[host isLocalhost])
|
||||
{
|
||||
//
|
||||
[self errorWithFormat: @"Trying to use localhost for additional IMAP account - aborting."];
|
||||
return nil;
|
||||
}
|
||||
@@ -227,19 +240,17 @@
|
||||
login = [[[self context] activeUser] login];
|
||||
|
||||
if (!login)
|
||||
login = [[[[self container] context] activeUser] login];
|
||||
login = [[[[self container] context] activeUser] login];
|
||||
|
||||
cacheKey = [NSString stringWithFormat: @"%@+%@",
|
||||
login,
|
||||
[[self mailAccountFolder] nameInContainer]];
|
||||
cacheKey = [NSString stringWithFormat: @"%@+%@", login, [[self mailAccountFolder] nameInContainer]];
|
||||
imap4 = [sogoCache imap4ConnectionForKey: cacheKey];
|
||||
if (!imap4)
|
||||
{
|
||||
imap4 = [self _createIMAP4Connection];
|
||||
[sogoCache registerIMAP4Connection: imap4
|
||||
forKey: cacheKey];
|
||||
}
|
||||
[imap4 retain];
|
||||
{
|
||||
imap4 = [self _createIMAP4Connection];
|
||||
[sogoCache registerIMAP4Connection: imap4
|
||||
forKey: cacheKey];
|
||||
}
|
||||
[imap4 retain];
|
||||
}
|
||||
|
||||
// Connection broken, try to reconnect
|
||||
|
||||
Reference in New Issue
Block a user