Monotone-Parent: d690ff1fe2dd685ce9e4e5a8773578c039ec1bf4
Monotone-Revision: be3f824ea546882828787185ebfdd086e3742f87 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-04-11T19:17:20 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
5ff3a45095
commit
48f210e151
|
@ -81,7 +81,7 @@
|
||||||
sm = [SoSecurityManager sharedSecurityManager];
|
sm = [SoSecurityManager sharedSecurityManager];
|
||||||
if (![sm validatePermission: SOGoPerm_FreeBusyLookup
|
if (![sm validatePermission: SOGoPerm_FreeBusyLookup
|
||||||
onObject: calFolder
|
onObject: calFolder
|
||||||
inContext: context]])
|
inContext: context])
|
||||||
infos = [calFolder fetchFreeBusyInfosFrom: _startDate
|
infos = [calFolder fetchFreeBusyInfosFrom: _startDate
|
||||||
to: _endDate];
|
to: _endDate];
|
||||||
else
|
else
|
||||||
|
|
|
@ -142,7 +142,7 @@ static NSString *mailTemplateDefaultLanguage = nil;
|
||||||
if (![folder isNotNull]) /* no folder was found for given UID */
|
if (![folder isNotNull]) /* no folder was found for given UID */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
task = [folder lookupName:[self nameInContainer] inContext:ctx
|
task = [folder lookupName:[self nameInContainer] inContext: context
|
||||||
acquire:NO];
|
acquire:NO];
|
||||||
if ([task isKindOfClass: [NSException class]])
|
if ([task isKindOfClass: [NSException class]])
|
||||||
{
|
{
|
||||||
|
|
|
@ -344,7 +344,6 @@ static NSString *fromInternetSuffixPattern = nil;
|
||||||
{
|
{
|
||||||
NSDictionary *lInfo;
|
NSDictionary *lInfo;
|
||||||
NGMimeMessage *message;
|
NGMimeMessage *message;
|
||||||
WOContext *ctx;
|
|
||||||
NSString *fromInternetSuffix;
|
NSString *fromInternetSuffix;
|
||||||
BOOL addSuffix;
|
BOOL addSuffix;
|
||||||
id body;
|
id body;
|
||||||
|
@ -352,12 +351,11 @@ static NSString *fromInternetSuffixPattern = nil;
|
||||||
if ((lInfo = [self fetchInfo]) == nil)
|
if ((lInfo = [self fetchInfo]) == nil)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
ctx = [[WOApplication application] context];
|
addSuffix = [context isAccessFromIntranet] ? NO : YES;
|
||||||
addSuffix = [ctx isAccessFromIntranet] ? NO : YES;
|
|
||||||
if (addSuffix) {
|
if (addSuffix) {
|
||||||
fromInternetSuffix =
|
fromInternetSuffix =
|
||||||
[fromInternetSuffixPattern stringByReplacingVariablesWithBindings:
|
[fromInternetSuffixPattern stringByReplacingVariablesWithBindings:
|
||||||
[ctx request]
|
[context request]
|
||||||
stringForUnknownBindings:@""];
|
stringForUnknownBindings:@""];
|
||||||
|
|
||||||
addSuffix = [fromInternetSuffix length] > 0 ? YES : NO;
|
addSuffix = [fromInternetSuffix length] > 0 ? YES : NO;
|
||||||
|
|
|
@ -124,15 +124,7 @@ static BOOL useAltNamespace = NO;
|
||||||
/* identity */
|
/* identity */
|
||||||
|
|
||||||
- (SOGoMailIdentity *)preferredIdentity {
|
- (SOGoMailIdentity *)preferredIdentity {
|
||||||
WOContext *ctx;
|
return [[context activeUser] primaryMailIdentityForAccount:
|
||||||
|
|
||||||
if ((ctx = [[WOApplication application] context]) == nil) {
|
|
||||||
[self logWithFormat:@"ERROR(%s): cannot procede without context!",
|
|
||||||
__PRETTY_FUNCTION__];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
return [[ctx activeUser] primaryMailIdentityForAccount:
|
|
||||||
[self nameInContainer]];
|
[self nameInContainer]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +153,7 @@ static BOOL useAltNamespace = NO;
|
||||||
NSString *s;
|
NSString *s;
|
||||||
NSArray *creds;
|
NSArray *creds;
|
||||||
|
|
||||||
rq = [[(WOApplication *)[WOApplication application] context] request];
|
rq = [context request];
|
||||||
|
|
||||||
s = [rq headerForKey:@"x-webobjects-remote-user"];
|
s = [rq headerForKey:@"x-webobjects-remote-user"];
|
||||||
if ([s length] > 0)
|
if ([s length] > 0)
|
||||||
|
|
|
@ -32,8 +32,7 @@ static NSString *AgenorShareLoginMarker = @".-.";
|
||||||
/* detect webmail being accessed from the outside */
|
/* detect webmail being accessed from the outside */
|
||||||
|
|
||||||
- (BOOL)isInternetRequest {
|
- (BOOL)isInternetRequest {
|
||||||
return [[(WOApplication *)[WOApplication application] context]
|
return ([context isAccessFromIntranet] ? NO : YES);
|
||||||
isAccessFromIntranet] ? NO : YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* listing the available mailboxes */
|
/* listing the available mailboxes */
|
||||||
|
@ -41,28 +40,15 @@ static NSString *AgenorShareLoginMarker = @".-.";
|
||||||
- (BOOL)isInHomeFolderBranchOfLoggedInAccount:(id)_ctx {
|
- (BOOL)isInHomeFolderBranchOfLoggedInAccount:(id)_ctx {
|
||||||
id user;
|
id user;
|
||||||
|
|
||||||
if (_ctx == nil) _ctx = [[WOApplication application] context];
|
|
||||||
if (_ctx == nil) {
|
|
||||||
[self errorWithFormat:@"Missing context!"];
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
user = [_ctx activeUser];
|
user = [_ctx activeUser];
|
||||||
return [[[self container] nameInContainer] isEqualToString:[user login]];
|
return [[[self container] nameInContainer] isEqualToString:[user login]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)toManyRelationshipKeys {
|
- (NSArray *)toManyRelationshipKeys {
|
||||||
WOContext *ctx;
|
|
||||||
id user;
|
id user;
|
||||||
id account;
|
id account;
|
||||||
NSArray *shares;
|
NSArray *shares;
|
||||||
|
|
||||||
if ((ctx = [[WOApplication application] context]) == nil) {
|
|
||||||
[self logWithFormat:@"ERROR(%s): cannot procede without context!",
|
|
||||||
__PRETTY_FUNCTION__];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Note: this is not strictly correct. The accounts being retrieved should be
|
Note: this is not strictly correct. The accounts being retrieved should be
|
||||||
the accounts based on the container object of this folder. Given
|
the accounts based on the container object of this folder. Given
|
||||||
|
@ -73,10 +59,10 @@ static NSString *AgenorShareLoginMarker = @".-.";
|
||||||
functionality which isn't perfect either.
|
functionality which isn't perfect either.
|
||||||
=> TODO
|
=> TODO
|
||||||
*/
|
*/
|
||||||
user = [ctx activeUser];
|
user = [context activeUser];
|
||||||
|
|
||||||
/* for now: return nothing if the home-folder does not belong to the login */
|
/* for now: return nothing if the home-folder does not belong to the login */
|
||||||
if (![self isInHomeFolderBranchOfLoggedInAccount:ctx]) {
|
if (![self isInHomeFolderBranchOfLoggedInAccount: context]) {
|
||||||
[self warnWithFormat:@"User %@ tried to access mail hierarchy of %@",
|
[self warnWithFormat:@"User %@ tried to access mail hierarchy of %@",
|
||||||
[user login], [[self container] nameInContainer]];
|
[user login], [[self container] nameInContainer]];
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -97,17 +83,11 @@ static NSString *AgenorShareLoginMarker = @".-.";
|
||||||
- (NSArray *)fetchIdentitiesWithOnlyEmitterAccess:(BOOL)_flag {
|
- (NSArray *)fetchIdentitiesWithOnlyEmitterAccess:(BOOL)_flag {
|
||||||
WOContext *ctx;
|
WOContext *ctx;
|
||||||
|
|
||||||
if ((ctx = [[WOApplication application] context]) == nil) {
|
|
||||||
[self logWithFormat:@"ERROR(%s): cannot procede without context!",
|
|
||||||
__PRETTY_FUNCTION__];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([self isInternetRequest]) { /* only show primary mailbox in Internet */
|
if ([self isInternetRequest]) { /* only show primary mailbox in Internet */
|
||||||
// just return the primary identity
|
// just return the primary identity
|
||||||
id identity;
|
id identity;
|
||||||
|
|
||||||
identity = [[ctx activeUser] primaryMailIdentity];
|
identity = [[context activeUser] primaryMailIdentity];
|
||||||
return [identity isNotNull] ? [NSArray arrayWithObject:identity] : nil;
|
return [identity isNotNull] ? [NSArray arrayWithObject:identity] : nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ static BOOL debugOn = YES;
|
||||||
NSString *auth;
|
NSString *auth;
|
||||||
NSArray *creds;
|
NSArray *creds;
|
||||||
|
|
||||||
rq = [[(WOApplication *)[WOApplication application] context] request];
|
rq = [context request];
|
||||||
if ((auth = [rq headerForKey:@"authorization"]) == nil) {
|
if ((auth = [rq headerForKey:@"authorization"]) == nil) {
|
||||||
/* no basic auth */
|
/* no basic auth */
|
||||||
return nil;
|
return nil;
|
||||||
|
|
|
@ -92,7 +92,6 @@ static NGLogger *logger = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_setupFolders {
|
- (void)_setupFolders {
|
||||||
WOContext *ctx;
|
|
||||||
NSMutableDictionary *md;
|
NSMutableDictionary *md;
|
||||||
NSMutableArray *ma;
|
NSMutableArray *ma;
|
||||||
NSArray *luids;
|
NSArray *luids;
|
||||||
|
@ -103,8 +102,6 @@ static NGLogger *logger = nil;
|
||||||
if ((luids = [self uids]) == nil)
|
if ((luids = [self uids]) == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ctx = [[WOApplication application] context];
|
|
||||||
|
|
||||||
count = [luids count];
|
count = [luids count];
|
||||||
ma = [NSMutableArray arrayWithCapacity:count + 1];
|
ma = [NSMutableArray arrayWithCapacity:count + 1];
|
||||||
md = [NSMutableDictionary dictionaryWithCapacity:count];
|
md = [NSMutableDictionary dictionaryWithCapacity:count];
|
||||||
|
@ -114,7 +111,7 @@ static NGLogger *logger = nil;
|
||||||
id folder;
|
id folder;
|
||||||
|
|
||||||
uid = [luids objectAtIndex:i];
|
uid = [luids objectAtIndex:i];
|
||||||
folder = [self _primaryLookupFolderForUID:uid inContext:ctx];
|
folder = [self _primaryLookupFolderForUID:uid inContext: context];
|
||||||
|
|
||||||
if ([folder isNotNull]) {
|
if ([folder isNotNull]) {
|
||||||
[md setObject:folder forKey:uid];
|
[md setObject:folder forKey:uid];
|
||||||
|
|
Loading…
Reference in a new issue