mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-15 05:14:53 +00:00
Added isDomainDefined
To check whether a domain is supported by our defined sources
This commit is contained in:
committed by
Carlos Pérez-Aradros Herce
parent
9d3f3c619d
commit
bf4a581d0f
@@ -305,6 +305,35 @@ static Class NSNullK;
|
||||
return sourceIDs;
|
||||
}
|
||||
|
||||
- (BOOL) isDomainDefined: (NSString *) domain
|
||||
{
|
||||
NSEnumerator *allIDs;
|
||||
NSArray *ids;
|
||||
NSString *currentID, *sourceDomain;
|
||||
SOGoSystemDefaults *sd;
|
||||
|
||||
if (!domain) return NO;
|
||||
|
||||
ids = [_sources allKeys];
|
||||
if ([ids containsObject: domain])
|
||||
// FIXME check SOGoMailDomain?
|
||||
// Now source id is being considered as the domain
|
||||
return YES;
|
||||
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
if ([sd enableDomainBasedUID])
|
||||
{
|
||||
allIDs = [ids objectEnumerator];
|
||||
while ((currentID = [allIDs nextObject]))
|
||||
{
|
||||
sourceDomain = [[_sources objectForKey: currentID] domain];
|
||||
if (!sourceDomain) // source that can identify any domain
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
- (NSString *) displayNameForSourceWithID: (NSString *) sourceID
|
||||
{
|
||||
NSDictionary *metadata;
|
||||
@@ -932,7 +961,7 @@ static Class NSNullK;
|
||||
// The domain is probably appended to the username;
|
||||
// make sure it is a defined domain in the configuration.
|
||||
domain = [uid substringFromIndex: (r.location + r.length)];
|
||||
if ([[sd domainIds] containsObject: domain])
|
||||
if ([self isDomainDefined: domain])
|
||||
username = [uid substringToIndex: r.location];
|
||||
else
|
||||
domain = nil;
|
||||
|
||||
Reference in New Issue
Block a user