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