(fix) simplified logic and improved code readability
parent
7692832672
commit
1c666e8ead
|
@ -71,6 +71,11 @@ Class SOGoContactSourceFolderK, SOGoGCSFolderK;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) modulePath
|
||||||
|
{
|
||||||
|
return @"Contacts";
|
||||||
|
}
|
||||||
|
|
||||||
- (void) _setupContext
|
- (void) _setupContext
|
||||||
{
|
{
|
||||||
SOGoUser *activeUser;
|
SOGoUser *activeUser;
|
||||||
|
|
|
@ -87,6 +87,11 @@
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) modulePath
|
||||||
|
{
|
||||||
|
return @"Mail";
|
||||||
|
}
|
||||||
|
|
||||||
- (void) _setupContext
|
- (void) _setupContext
|
||||||
{
|
{
|
||||||
SOGoUser *activeUser;
|
SOGoUser *activeUser;
|
||||||
|
|
|
@ -360,38 +360,19 @@ static SoProduct *commonProduct = nil;
|
||||||
|
|
||||||
- (NSString *) modulePath
|
- (NSString *) modulePath
|
||||||
{
|
{
|
||||||
SOGoObject *currentClient, *parent;
|
|
||||||
BOOL found;
|
|
||||||
NSString *hostLessURL;
|
|
||||||
Class objectClass, userFolderClass;
|
|
||||||
|
|
||||||
if ([[self parent] respondsToSelector: @selector(modulePath)])
|
if ([[self parent] respondsToSelector: @selector(modulePath)])
|
||||||
return [NSString stringWithFormat: @"%@/%@", [[self clientObject] baseURLInContext: context], [[self parent] modulePath]];
|
|
||||||
|
|
||||||
currentClient = [self clientObject];
|
|
||||||
if (currentClient
|
|
||||||
&& [currentClient isKindOfClass: [SOGoObject class]])
|
|
||||||
{
|
{
|
||||||
userFolderClass = [SOGoUserFolder class];
|
NSString *baseURL;
|
||||||
|
|
||||||
objectClass = [currentClient class];
|
baseURL = [[self clientObject] baseURLInContext: context];
|
||||||
found = (objectClass == userFolderClass);
|
|
||||||
while (!found && currentClient)
|
if ([baseURL hasSuffix: [NSString stringWithFormat: @"%@/", [[self parent] modulePath]]])
|
||||||
{
|
return baseURL;
|
||||||
parent = [currentClient container];
|
|
||||||
objectClass = [parent class];
|
return [NSString stringWithFormat: @"%@%@", baseURL, [[self parent] modulePath]];
|
||||||
if (objectClass == userFolderClass)
|
|
||||||
found = YES;
|
|
||||||
else
|
|
||||||
currentClient = parent;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
currentClient = [WOApplication application];
|
|
||||||
|
|
||||||
hostLessURL = [[currentClient baseURLInContext: context] hostlessURL];
|
|
||||||
|
|
||||||
return [hostLessURL substringToIndex: [hostLessURL length] - 1];
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) ownPath
|
- (NSString *) ownPath
|
||||||
|
|
Loading…
Reference in New Issue