From 0d1e5117b278853337618f2c46e53591d16b0283 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Thu, 7 Feb 2008 20:27:37 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1358 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 47 +++++++- SoObjects/Mailer/GNUmakefile | 2 - SoObjects/Mailer/SOGoMailAccount.m | 4 +- SoObjects/Mailer/SOGoMailAccounts.m | 96 +++++++--------- SoObjects/Mailer/SOGoMailBaseObject.m | 2 +- SoObjects/Mailer/SOGoSharedInboxFolder.h | 44 ------- SoObjects/Mailer/SOGoSharedInboxFolder.m | 42 ------- SoObjects/Mailer/SOGoSharedMailAccount.h | 56 --------- SoObjects/Mailer/SOGoSharedMailAccount.m | 139 ----------------------- SoObjects/Mailer/product.plist | 8 +- SoObjects/SOGo/LDAPUserManager.h | 2 + SoObjects/SOGo/LDAPUserManager.m | 15 +++ SoObjects/SOGo/SOGoContentObject.m | 2 +- SoObjects/SOGo/SOGoGCSFolder.m | 10 +- SoObjects/SOGo/SOGoUser.h | 6 + SoObjects/SOGo/SOGoUser.m | 57 ++++++++++ SoObjects/SOGo/SOGoUserFolder.h | 4 - SoObjects/SOGo/SOGoUserFolder.m | 38 ++++--- UI/PreferencesUI/UIxPreferences.m | 23 +--- UI/WebServerResources/MailerUI.js | 8 +- UI/WebServerResources/generic.js | 2 +- 21 files changed, 215 insertions(+), 392 deletions(-) delete mode 100644 SoObjects/Mailer/SOGoSharedInboxFolder.h delete mode 100644 SoObjects/Mailer/SOGoSharedInboxFolder.m delete mode 100644 SoObjects/Mailer/SOGoSharedMailAccount.h delete mode 100644 SoObjects/Mailer/SOGoSharedMailAccount.m diff --git a/ChangeLog b/ChangeLog index 4cb6edd3..20676529 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,51 @@ +2008-02-07 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoUserFolder.m ([-login]): removed useless + method. + ([SOGoUserFolder -ownerInContext:_ctx]): compute the owner name + from a SOGoUser instance initialized with the nameInContainer as + initial login name. This way, all the objects belonging to the + corresponding user will be accessible with all the fields + mentionned in the "bindFields" LDAP settings value. + ([SOGoUserFolder -privateCalendars:keyinContext:localContext]) + ([SOGoUserFolder -privateContacts:_keyinContext:_ctx]): use -[self + ownerInContext:] to determine the OCS path. + + * SoObjects/Mailer/SOGoSharedMailAccount.[hm]: removed useless + module. + + * SoObjects/Mailer/SOGoSharedInboxFolder.[hm]: removed useless + module. + + * UI/PreferencesUI/UIxPreferences.m ([UIxPreferences + -setSignature:newSignature]): invoke -[SOGoUser saveMailAccounts] + + * SoObjects/SOGo/SOGoUser.m ([SOGoUser -defaultIdentity]): method + moved from UIxPreferences.m. + ([SOGoUser -saveMailAccounts]): new methods that save the + "MailAccounts" preference in the user settings. + + * SoObjects/SOGo/LDAPUserManager.m ([LDAPUserManager + +initialize]): issue a warning whenever "SOGoDefaultMailDomain" + is not configured in the user defaults, setting it to "localhost" + by default. + ([LDAPUserManager +defaultMailDomainIsConfigured]): new method + that returns whether "SOGoDefaultMailDomain" is configured. + +2008-02-06 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder -ocsFolder]): + send an email only when not in a dav request. + ([SOGoGCSFolder -delete]): same as above. + + * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount + -supportsQuotas]): test quota support by querying the server + capability. + 2008-02-05 Wolfgang Sourdeau - * UI/MailPartViewers/UIxMailPartICalActions.m ([UIxMailPartICalActions -acceptAction]) + * UI/MailPartViewers/UIxMailPartICalActions.m + ([UIxMailPartICalActions -acceptAction]) ([UIxMailPartICalActions -declineAction]): define the organizer of the event as one of the reply-to or from addresses whenever the organizer is not specified in those Outlook invitations. diff --git a/SoObjects/Mailer/GNUmakefile b/SoObjects/Mailer/GNUmakefile index 907df787..0b20dafc 100644 --- a/SoObjects/Mailer/GNUmakefile +++ b/SoObjects/Mailer/GNUmakefile @@ -14,9 +14,7 @@ Mailer_OBJC_FILES += \ SOGoMailBaseObject.m \ SOGoMailAccounts.m \ SOGoMailAccount.m \ - SOGoSharedMailAccount.m \ SOGoMailFolder.m \ - SOGoSharedInboxFolder.m \ SOGoMailObject.m \ SOGoDraftObject.m \ SOGoMailObject+Draft.m \ diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index 8b355986..4a64431b 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -175,10 +175,12 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default - (BOOL) supportsQuotas { NGImap4Client *imapClient; + NSArray *capability; imapClient = [[self imap4Connection] client]; + capability = [[imapClient capability] objectForKey: @"capability"]; - return [[imapClient context] canQuota]; + return [capability containsObject: @"quota"]; } /* hierarchy */ diff --git a/SoObjects/Mailer/SOGoMailAccounts.m b/SoObjects/Mailer/SOGoMailAccounts.m index 3188052c..8a2cde7b 100644 --- a/SoObjects/Mailer/SOGoMailAccounts.m +++ b/SoObjects/Mailer/SOGoMailAccounts.m @@ -28,19 +28,18 @@ #import "../SOGo/NSArray+Utilities.h" #import "../SOGo/SOGoUser.h" +#import "SOGoMailAccount.h" #import "SOGoMailAccounts.h" @implementation SOGoMailAccounts -static NSString *AgenorShareLoginMarker = @".-."; - /* listing the available mailboxes */ -- (BOOL) isInHomeFolderBranchOfLoggedInAccount: (NSString *) userLogin -{ - return [[container nameInContainer] isEqualToString: userLogin]; -} +// - (BOOL) isInHomeFolderBranchOfLoggedInAccount: (NSString *) userLogin +// { +// return [[container nameInContainer] isEqualToString: userLogin]; +// } - (NSArray *) toManyRelationshipKeys { @@ -62,70 +61,53 @@ static NSString *AgenorShareLoginMarker = @".-."; return [[accounts objectsForKey: @"name"] containsObject: _key]; } -- (id) mailAccountWithName: (NSString *) _key - inContext: (id) _ctx -{ - static Class ctClass = Nil; - id ct; +// - (id) mailAccountWithName: (NSString *) _key +// inContext: (id) _ctx +// { +// static Class ctClass = Nil; +// id ct; - if (ctClass == Nil) - ctClass = NSClassFromString(@"SOGoMailAccount"); - if (ctClass == Nil) { - [self errorWithFormat:@"missing SOGoMailAccount class!"]; - return nil; - } +// if (ctClass == Nil) +// ctClass = NSClassFromString(@"SOGoMailAccount"); +// if (ctClass == Nil) { +// [self errorWithFormat:@"missing SOGoMailAccount class!"]; +// return nil; +// } - ct = [[ctClass alloc] initWithName:_key inContainer:self]; - - return [ct autorelease]; -} - -- (id) sharedMailAccountWithName: (NSString *) _key - inContext: (id) _ctx -{ - static Class ctClass = Nil; +// ct = [[ctClass alloc] initWithName:_key inContainer:self]; - if (ctClass == Nil) - ctClass = NSClassFromString (@"SOGoSharedMailAccount"); - if (ctClass == Nil) - [self errorWithFormat:@"missing SOGoSharedMailAccount class!"]; - - return [ctClass objectWithName: _key inContainer: self]; -} +// return [ct autorelease]; +// } - (id) lookupName: (NSString *) _key inContext: (id) _ctx acquire: (BOOL) _flag { id obj; - NSString *userLogin; - - userLogin = [[context activeUser] login]; - - /* first check attributes directly bound to the application */ - if ((obj = [super lookupName:_key inContext:_ctx acquire:NO])) - return obj; +// NSString *userLogin; - if (![self isInHomeFolderBranchOfLoggedInAccount: userLogin]) { - [self warnWithFormat:@ "User %@ tried to access mail hierarchy of %@", - userLogin, [container nameInContainer]]; - - return [NSException exceptionWithHTTPStatus:403 /* Forbidden */ - reason:@"Tried to access the mail of another user"]; - } +// userLogin = [[context activeUser] login]; - if ([self isValidMailAccountName:_key]) { - BOOL isSharedKey; +// if (![self isInHomeFolderBranchOfLoggedInAccount: userLogin]) { +// [self warnWithFormat:@ "User %@ tried to access mail hierarchy of %@", +// userLogin, [container nameInContainer]]; - isSharedKey = [_key rangeOfString:AgenorShareLoginMarker].length > 0; - - return isSharedKey - ? [self sharedMailAccountWithName:_key inContext:_ctx] - : [self mailAccountWithName:_key inContext:_ctx]; - } +// return [NSException exceptionWithHTTPStatus:403 /* Forbidden */ +// reason:@"Tried to access the mail of another user"]; +// } + - /* return 404 to stop acquisition */ - return [NSException exceptionWithHTTPStatus:404 /* Not Found */]; + /* first check attributes directly bound to the application */ + obj = [super lookupName:_key inContext:_ctx acquire:NO]; + if (!obj) + { + if ([self isValidMailAccountName: _key]) + obj = [SOGoMailAccount objectWithName: _key inContainer: self]; + else + obj = [NSException exceptionWithHTTPStatus: 404 /* Not Found */]; + } + + return obj; } @end /* SOGoMailAccounts */ diff --git a/SoObjects/Mailer/SOGoMailBaseObject.m b/SoObjects/Mailer/SOGoMailBaseObject.m index d4387d52..ebe59462 100644 --- a/SoObjects/Mailer/SOGoMailBaseObject.m +++ b/SoObjects/Mailer/SOGoMailBaseObject.m @@ -132,7 +132,7 @@ static BOOL debugOn = YES; { NSURL *url; - if ([container respondsToSelector:@selector(imap4URL)]) + if ([container respondsToSelector: @selector(imap4URL)]) url = [container imap4URL]; else { diff --git a/SoObjects/Mailer/SOGoSharedInboxFolder.h b/SoObjects/Mailer/SOGoSharedInboxFolder.h deleted file mode 100644 index 8fc1f417..00000000 --- a/SoObjects/Mailer/SOGoSharedInboxFolder.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2004-2005 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __Mailer_SOGoSharedInboxFolder_H__ -#define __Mailer_SOGoSharedInboxFolder_H__ - -#import - -/* - SOGoSharedInboxFolder - Parent object: the SOGoSharedMailAccount - Child objects: SOGoMailObject or SOGoMailFolder - - The SOGoSharedInboxFolder is a special SOGoMailFolder for use as the INBOX - og SOGoSharedMailAccounts. This is necessary because the INBOX location in - the IMAP4 server is different for shared boxes (its the shared user folder, - not a mapped subfolder). -*/ - -@interface SOGoSharedInboxFolder : SOGoMailFolder -{ -} - -@end - -#endif /* __Mailer_SOGoSharedInboxFolder_H__ */ diff --git a/SoObjects/Mailer/SOGoSharedInboxFolder.m b/SoObjects/Mailer/SOGoSharedInboxFolder.m deleted file mode 100644 index 5399b751..00000000 --- a/SoObjects/Mailer/SOGoSharedInboxFolder.m +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2004-2005 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import "SOGoSharedInboxFolder.h" - -@implementation SOGoSharedInboxFolder - -/* listing available folders */ - -- (NSArray *)toManyRelationshipKeys { - /* - A shared INBOX has no subfolders because those are already shown as - subfolders of the account. - */ - return nil; -} - -/* IMAP4 locator */ - -- (NSURL *)imap4URL { - return [[self container] imap4URL]; -} - -@end /* SOGoSharedInboxFolder */ diff --git a/SoObjects/Mailer/SOGoSharedMailAccount.h b/SoObjects/Mailer/SOGoSharedMailAccount.h deleted file mode 100644 index 35dbbd48..00000000 --- a/SoObjects/Mailer/SOGoSharedMailAccount.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2005 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __Mailer_SOGoSharedMailAccount_H__ -#define __Mailer_SOGoSharedMailAccount_H__ - -#include - -/* - SOGoSharedMailAccount - Parent object: SOGoMailAccounts - Child objects: SOGoMailFolder - - The SOGoSharedMailAccount represents an IMAP4 mail account which is shared - by multiple users using the ".-." login trick. - - Eg: - beatrix.b.-.evariste.e@amelie-01.ac.melanie2.i2 - - The mailbox of 'evariste.e' will be accessed using as user 'beatrix.b'. The - Cyrus server will deliver a special kind of mailbox hierarchy in this case. - - An advantage is that either Cyrus or LDAP seems to know about the ".-." - separator. -*/ - -@class NSString; - -@interface SOGoSharedMailAccount : SOGoMailAccount -{ -} - -- (BOOL)isSharedAccount; -- (NSString *)sharedAccountName; - -@end - -#endif /* __Mailer_SOGoSharedMailAccount_H__ */ diff --git a/SoObjects/Mailer/SOGoSharedMailAccount.m b/SoObjects/Mailer/SOGoSharedMailAccount.m deleted file mode 100644 index 86922604..00000000 --- a/SoObjects/Mailer/SOGoSharedMailAccount.m +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) 2005 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import -#import -#import - -#import - -#import "SOGoSharedMailAccount.h" - -@interface SOGoMailAccount(UsedPrivates) - -- (NSString *)imap4URLString; - -- (id)lookupFolder:(NSString *)_key ofClassNamed:(NSString *)_cn - inContext:(id)_cx; - -@end - -@implementation SOGoSharedMailAccount - -static NSString *otherUsersFolderName = @""; // TODO: add English default - -+ (void) initialize -{ - NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; - - otherUsersFolderName = [ud stringForKey:@"SOGoOtherUsersFolderName"]; - NSLog(@"Note: using other-users-folders name: '%@'", otherUsersFolderName); -} - -/* shared accounts */ - -- (BOOL)isSharedAccount { - return YES; -} - -- (NSString *)sharedAccountName { - NSString *s; - NSRange r; - - s = [self nameInContainer]; - r = [s rangeOfString:@"@"]; - if (r.length == 0) /* regular HTTP logins are never a shared mailbox */ - return nil; - - s = [s substringToIndex:r.location]; - r = [s rangeOfString:@".-."]; - if (r.length == 0) /* no shared mailbox marker */ - return nil; - - return [s substringFromIndex:(r.location + r.length)]; -} - -/* listing the available folders */ - -- (NSArray *)additionalRootFolderNames { - /* do not show Drafts folder in shared mailboxes (#1452) */ - /* Note: this also disables the Sieve folder */ - return nil; -} - -- (NSArray *)toManyRelationshipKeys { - NSMutableArray *m; - NSArray *b; - - m = [NSMutableArray arrayWithCapacity:16]; - - [m addObject:@"INBOX"]; /* special for shared, see -lookupInboxFolder:.. */ - - if ((b = [[self imap4Connection] subfoldersForURL:[self imap4URL]]) != nil) - [m addObjectsFromArray:b]; - - if ((b = [self additionalRootFolderNames]) != nil) - [m addObjectsFromArray:b]; - return m; -} - -/* IMAP4 locator */ - -- (NSString *)imap4URLString { - /* we jump in the hierarchy directly to the shared user folder */ - NSString *s; - - s = [super imap4URLString]; - s = [s stringByAppendingString:otherUsersFolderName]; - s = [s stringByAppendingString:@"/"]; - s = [s stringByAppendingString:[self sharedAccountName]]; - return s; -} - -/* lookup */ - -- (id)lookupInboxFolder:(NSString *)_key inContext:(id)_ctx { - /* - Note: We have a choice: Cyrus does both, it gives the user an own - INBOX folder, but it also provides access to the mailbox INBOX - folder. - However the mailbox INBOX folder is NOT returned as an "INBOX" - subcollection as usual, but is the primary mailbox name. - Eg: - 2 list "*" "*" - * LIST (\Noinferiors) "/" "INBOX" - * LIST (\HasChildren) "/" "Boite partag&AOk-e/alienor.a" - - The first INBOX is auto-assigned for the user by Cyrus, the second entry - is actually the INBOX of the mailbox itself (alienor.a). - */ - return [self lookupFolder:_key ofClassNamed:@"SOGoSharedInboxFolder" - inContext:_ctx]; -} - -- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag { - if ([_key isEqualToString:@"INBOX"]) - return [self lookupInboxFolder:_key inContext:_ctx]; - - return [super lookupName:_key inContext:_ctx acquire:_flag]; -} - -@end /* SOGoSharedMailAccount */ diff --git a/SoObjects/Mailer/product.plist b/SoObjects/Mailer/product.plist index dccd8726..b97c93e9 100644 --- a/SoObjects/Mailer/product.plist +++ b/SoObjects/Mailer/product.plist @@ -31,9 +31,9 @@ "WebDAV Access" = ( "Owner", "AuthorizedSubscriber" ); }; }; - SOGoSharedMailAccount = { +/* SOGoSharedMailAccount = { superclass = "SOGoMailAccount"; - }; + }; */ SOGoMailFolder = { superclass = "SOGoMailBaseObject"; defaultRoles = { @@ -46,9 +46,9 @@ "SaveAcls" = ( "Owner", "MailAdministrator" ); }; }; - SOGoSharedInboxFolder = { +/* SOGoSharedInboxFolder = { superclass = "SOGoMailFolder"; - }; + }; */ SOGoTrashFolder = { superclass = "SOGoMailFolder"; }; diff --git a/SoObjects/SOGo/LDAPUserManager.h b/SoObjects/SOGo/LDAPUserManager.h index 5ab95c92..319f6ca1 100644 --- a/SoObjects/SOGo/LDAPUserManager.h +++ b/SoObjects/SOGo/LDAPUserManager.h @@ -43,6 +43,8 @@ + (id) sharedUserManager; ++ (BOOL) defaultMailDomainIsConfigured; + - (NSArray *) sourceIDs; - (NSDictionary *) metadataForSourceID: (NSString *) sourceID; - (NSArray *) authenticationSourceIDs; diff --git a/SoObjects/SOGo/LDAPUserManager.m b/SoObjects/SOGo/LDAPUserManager.m index 0e116885..c7161990 100644 --- a/SoObjects/SOGo/LDAPUserManager.m +++ b/SoObjects/SOGo/LDAPUserManager.m @@ -26,12 +26,14 @@ #import #import #import +#import #import "NSArray+Utilities.h" #import "LDAPSource.h" #import "LDAPUserManager.h" static NSString *defaultMailDomain = nil; +static BOOL defaultMailDomainIsConfigured = NO; @implementation LDAPUserManager @@ -44,7 +46,20 @@ static NSString *defaultMailDomain = nil; { defaultMailDomain = [ud stringForKey: @"SOGoDefaultMailDomain"]; [defaultMailDomain retain]; + defaultMailDomainIsConfigured = YES; } + if (!defaultMailDomain) + { + [self warnWithFormat: + @"no domain specified for SOGoDefaultMailDomain," + @" value set to 'localhost'"]; + defaultMailDomain = @"localhost"; + } +} + ++ (BOOL) defaultMailDomainIsConfigured +{ + return defaultMailDomainIsConfigured; } + (id) sharedUserManager diff --git a/SoObjects/SOGo/SOGoContentObject.m b/SoObjects/SOGo/SOGoContentObject.m index 4aa48503..ac27122b 100644 --- a/SoObjects/SOGo/SOGoContentObject.m +++ b/SoObjects/SOGo/SOGoContentObject.m @@ -391,7 +391,7 @@ - (NSArray *) aclsForUser: (NSString *) uid { NSMutableArray *acls; - NSArray *ownAcls, *containerAcls; + NSArray *containerAcls; acls = [NSMutableArray array]; /* this is unused... */ diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 7b873239..f8b4136a 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -53,6 +53,7 @@ #import "SOGoParentFolder.h" #import "SOGoPermissions.h" #import "SOGoUser.h" +#import "WORequest+SOGo.h" #import "SOGoGCSFolder.h" @@ -273,7 +274,10 @@ static BOOL sendFolderAdvisories = NO; withName: displayName atPath: ocsPath]; - if (!result && sendFolderAdvisories) [self sendFolderAdvisoryTemplate: @"Addition"]; + if (!result + && [[context request] handledByDefaultHandler] + && sendFolderAdvisories) + [self sendFolderAdvisoryTemplate: @"Addition"]; return (result == nil); } @@ -291,7 +295,9 @@ static BOOL sendFolderAdvisories = NO; else error = [[self folderManager] deleteFolderAtPath: ocsPath]; - if (!error && sendFolderAdvisories) [self sendFolderAdvisoryTemplate: @"Removal"]; + if (!error && sendFolderAdvisories + && [[context request] handledByDefaultHandler]) + [self sendFolderAdvisoryTemplate: @"Removal"]; return error; } diff --git a/SoObjects/SOGo/SOGoUser.h b/SoObjects/SOGo/SOGoUser.h index bc051398..1c580e57 100644 --- a/SoObjects/SOGo/SOGoUser.h +++ b/SoObjects/SOGo/SOGoUser.h @@ -77,6 +77,9 @@ extern NSString *SOGoWeekStartFirstFullWeek; + (SOGoUser *) userWithLogin: (NSString *) login roles: (NSArray *) roles; + +- (void) setPrimaryRoles: (NSArray *) newRoles; + - (void) setCurrentPassword: (NSString *) newPassword; - (NSString *) currentPassword; @@ -117,11 +120,14 @@ extern NSString *SOGoWeekStartFirstFullWeek; - (NSArray *) mailAccounts; - (NSArray *) allIdentities; - (NSDictionary *) primaryIdentity; +- (NSMutableDictionary *) defaultIdentity; - (NSString *) messageForwarding; - (NSString *) messageCheck; - (NSString *) signature; +- (void) saveMailAccounts; + - (BOOL) isSuperUser; /* module access */ diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index b0f1c6b7..81187c6d 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -29,6 +29,7 @@ #import #import #import +#import #import "AgenorUserDefaults.h" #import "LDAPUserManager.h" @@ -42,6 +43,7 @@ static NSTimeZone *serverTimeZone = nil; static NSString *fallbackIMAP4Server = nil; +static BOOL fallbackIsConfigured = NO; static NSString *defaultLanguage = nil; static NSArray *superUsernames = nil; static NSURL *AgenorProfileURL = nil; @@ -92,6 +94,16 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; if (!fallbackIMAP4Server) ASSIGN (fallbackIMAP4Server, [ud stringForKey: @"SOGoFallbackIMAP4Server"]); + if (fallbackIMAP4Server) + fallbackIsConfigured = YES; + else + { + [self warnWithFormat: + @"no server specified for SOGoFallbackIMAP4Server," + @" value set to 'localhost'"]; + fallbackIMAP4Server = @"localhost"; + } + if (!defaultLanguage) { ASSIGN (defaultLanguage, [ud stringForKey: @"SOGoDefaultLanguage"]); @@ -122,6 +134,11 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; return lng; } ++ (NSString *) fallbackIMAP4Server +{ + return fallbackIMAP4Server; +} + + (SOGoUser *) userWithLogin: (NSString *) newLogin roles: (NSArray *) newRoles { @@ -176,6 +193,7 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; realUID = [[um contactInfosForUserWithUIDorEmail: newLogin] objectForKey: @"c_uid"]; } + if (realUID) self = [super initWithLogin: realUID roles: newRoles]; else @@ -284,6 +302,45 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; return cn; } +- (NSMutableDictionary *) defaultIdentity +{ + NSMutableDictionary *currentIdentity, *defaultIdentity; + NSEnumerator *identities; + + defaultIdentity = nil; + + identities = [[self allIdentities] objectEnumerator]; + while (!defaultIdentity + && (currentIdentity = [identities nextObject])) + if ([[currentIdentity objectForKey: @"isDefault"] boolValue]) + defaultIdentity = currentIdentity; + + return defaultIdentity; +} + +- (void) saveMailAccounts +{ + BOOL doSave; + + doSave = YES; + if (!fallbackIsConfigured) + { + [self logWithFormat: @"'SOGoFallbackIMAP4Server' is not set"]; + doSave = NO; + } + if (![LDAPUserManager defaultMailDomainIsConfigured]) + { + [self logWithFormat: @"'SOGoDefaultMailDomain' is not set"]; + doSave = NO; + } + if (doSave) + [userDefaults setObject: [self mailAccounts] + forKey: @"MailAccounts"]; + else + [self logWithFormat: @"saving mail accounts is disabled until the" + @" variable(s) mentionned above are configured"]; +} + // - (NSString *) primaryMailServer // { // return [[self userManager] getServerForUID: [self login]]; diff --git a/SoObjects/SOGo/SOGoUserFolder.h b/SoObjects/SOGo/SOGoUserFolder.h index ccb30545..d2bd564a 100644 --- a/SoObjects/SOGo/SOGoUserFolder.h +++ b/SoObjects/SOGo/SOGoUserFolder.h @@ -43,10 +43,6 @@ @interface SOGoUserFolder : SOGoFolder -/* accessors */ - -- (NSString *) login; - /* ownership */ - (NSString *) ownerInContext: (WOContext *) _ctx; diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index d8a475db..efd551e7 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -66,13 +66,6 @@ // [sInfo declareRoles: basicRoles asDefaultForPermission: SoPerm_WebDAVAccess]; // } -/* accessors */ - -- (NSString *) login -{ - return nameInContainer; -} - /* hierarchy */ - (NSArray *) toManyRelationshipKeys @@ -97,7 +90,15 @@ - (NSString *) ownerInContext: (WOContext *) _ctx { - return nameInContainer; + SOGoUser *ownerUser; + + if (!owner) + { + ownerUser = [SOGoUser userWithLogin: nameInContainer roles: nil]; + owner = [ownerUser login]; + } + + return owner; } /* looking up shared objects */ @@ -327,14 +328,17 @@ // : [super permissionForKey: key]); // } -- (SOGoAppointmentFolders *) privateCalendars: (NSString *) _key - inContext: (WOContext *) _ctx +- (SOGoAppointmentFolders *) privateCalendars: (NSString *) key + inContext: (WOContext *) localContext { SOGoAppointmentFolders *calendars; - - calendars = [$(@"SOGoAppointmentFolders") objectWithName: _key inContainer: self]; - [calendars setBaseOCSPath: [NSString stringWithFormat: @"/Users/%@/Calendar", - nameInContainer]]; + NSString *baseOCSPath; + + calendars = [$(@"SOGoAppointmentFolders") objectWithName: key + inContainer: self]; + baseOCSPath = [NSString stringWithFormat: @"/Users/%@/Calendar", + [self ownerInContext: nil]]; + [calendars setBaseOCSPath: baseOCSPath]; return calendars; } @@ -343,10 +347,12 @@ inContext: (WOContext *) _ctx { SOGoContactFolders *contacts; + NSString *baseOCSPath; contacts = [$(@"SOGoContactFolders") objectWithName:_key inContainer: self]; - [contacts setBaseOCSPath: [NSString stringWithFormat: @"/Users/%@/Contacts", - nameInContainer]]; + baseOCSPath = [NSString stringWithFormat: @"/Users/%@/Contacts", + [self ownerInContext: nil]]; + [contacts setBaseOCSPath: baseOCSPath]; return contacts; } diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index c5f5bac4..37af5acb 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -486,33 +486,16 @@ static BOOL shouldDisplayPasswordChange = NO; return [(NSDictionary *) item keysWithFormat: @"%{fullName} <%{email}>"]; } -- (NSMutableDictionary *) defaultIdentity -{ - NSMutableDictionary *currentIdentity, *defaultIdentity; - NSEnumerator *identities; - - defaultIdentity = nil; - - identities = [[user allIdentities] objectEnumerator]; - while (!defaultIdentity - && (currentIdentity = [identities nextObject])) - if ([[currentIdentity objectForKey: @"isDefault"] boolValue]) - defaultIdentity = currentIdentity; - - return defaultIdentity; -} - - (NSString *) signature { - return [[self defaultIdentity] objectForKey: @"signature"]; + return [[user defaultIdentity] objectForKey: @"signature"]; } - (void) setSignature: (NSString *) newSignature { - [[self defaultIdentity] setObject: newSignature + [[user defaultIdentity] setObject: newSignature forKey: @"signature"]; - [userDefaults setObject: [user mailAccounts] - forKey: @"MailAccounts"]; + [user saveMailAccounts]; } - (id ) defaultAction diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index c4b8b453..649ad6b2 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -494,7 +494,11 @@ function openMailbox(mailbox, reload, idx) { var account = Mailer.currentMailbox.split("/")[1]; if (accounts[account].supportsQuotas) { var quotasUrl = ApplicationBaseURL + mailbox + "/quotas"; - triggerAjaxRequest(quotasUrl, quotasCallback); + if (document.quotaAjaxRequest) { + document.quotaAjaxRequest.aborted = true; + document.quotaAjaxRequest.abort(); + } + document.quotaAjaxRequest = triggerAjaxRequest(quotasUrl, quotasCallback); } } } @@ -601,6 +605,8 @@ function quotasCallback(http) { window.status = text; } } + + document.quotaAjaxRequest = null; } function onMessageContextMenu(event) { diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index c5ef30a0..0888d79a 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -322,7 +322,7 @@ function onAjaxRequestStateChange(http) { http.callbackData = null; } } - catch (e) { + catch(e) { activeAjaxRequests--; checkAjaxRequestsState(); http.onreadystatechange = Prototype.emptyFunction; -- 2.39.5