From 8d1e70773feff7e0b8e2b35d34632372df5fd794 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Wed, 31 Oct 2007 15:57:07 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1207 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 30 +++++++++++ Scripts/sogo-init.d-redhat | 7 ++- SoObjects/Mailer/GNUmakefile | 6 +-- SoObjects/Mailer/SOGoDraftsFolder.h | 2 +- SoObjects/Mailer/SOGoMailAccount.m | 58 ++++++++++++++------- SoObjects/Mailer/SOGoMailBaseObject.h | 1 + SoObjects/Mailer/SOGoMailBaseObject.m | 10 ++++ SoObjects/Mailer/SOGoMailFolder.h | 8 +++ SoObjects/Mailer/SOGoMailFolder.m | 28 ++++++++++ SoObjects/Mailer/SOGoSentFolder.h | 30 +++++++++++ SoObjects/Mailer/SOGoSentFolder.m | 34 ++++++++++++ SoObjects/Mailer/SOGoTrashFolder.h | 2 +- SoObjects/SOGo/SOGoUser.m | 4 +- UI/Common/English.lproj/Localizable.strings | 2 +- UI/Common/French.lproj/Localizable.strings | 2 +- UI/MailPartViewers/UIxMailPartTextViewer.m | 2 + UI/MainUI/English.lproj/Localizable.strings | 2 +- UI/MainUI/French.lproj/Localizable.strings | 2 +- UI/Templates/MainUI/SOGoRootPage.wox | 2 +- UI/Templates/UIxPageFrame.wox | 2 +- 20 files changed, 200 insertions(+), 34 deletions(-) create mode 100644 SoObjects/Mailer/SOGoSentFolder.h create mode 100644 SoObjects/Mailer/SOGoSentFolder.m diff --git a/ChangeLog b/ChangeLog index d47cf7cb..a2ec7f33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2007-10-31 Wolfgang Sourdeau + + * SoObjects/Mailer/SOGoMailFolder.[hm]: added a new subclass of + SOGoMailFolder: SOGoMailSpecialFolder. + + * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount + -traversalFromMailAccount]): overridden method that returns the + initialized mutable string. + ([SOGoMailAccount -allFolderPaths]): take the special folder paths + with -traversalFromMailAccount and reposition them at the + beginning of the list. By creating the special folders during that + request, we also make sure that the folder exists thanks to the + new initialisation method of the new "SOGoSpecialMailFolder" + class. + ([SOGoMailAccount -lookupSentFolder:_keyinContext:_ctx]): new + method. + ([SOGoMailAccount -lookupTrashFolder:_keyinContext:_ctx]): new + method. + ([SOGoMailAccount -lookupName:_keyinContext:acquire:_flag]): no + longer use lookupImap4Folder. + ([SOGoMailAccount -lookupImap4Folder:_keyinContext:_ctx]): removed + method. + + * SoObjects/Mailer/SOGoMailBaseObject.m ([SOGoMailBaseObject + -traversalFromMailAccount]): new method that returns the full + IMAP4 path to the object. + + * SoObjects/SOGo/SOGoUser.m ([SOGoUser +initialize]): retain + "superUsernames" after fetching it from the ud. + 2007-10-30 Wolfgang Sourdeau * UI/Scheduler/UIxCalListingActions.m ([UIxCalListingActions diff --git a/Scripts/sogo-init.d-redhat b/Scripts/sogo-init.d-redhat index e2182e65..def0f10d 100755 --- a/Scripts/sogo-init.d-redhat +++ b/Scripts/sogo-init.d-redhat @@ -77,13 +77,16 @@ fi case "$1" in start) echo -n $"Starting $DESC: " - daemon su - sogo -c $DAEMON + for ((a=1; a <= PREFORK ; a++)) + do + daemon su - sogo -c "$DAEMON $a" + done # daemon --user sogo --pidfile $PIDFILE $DAEMON echo "$NAME." ;; stop) echo -n $"Stopping $DESC: " - killproc `basename $REAL_DAEMON` && rm -f $PIDFILE + killproc `basename $REAL_DAEMON` && rm -f ${PIDFILE}* # killproc -p $PIDFILE $REAL_DAEMON && rm -f $PIDFILE echo "$NAME." ;; diff --git a/SoObjects/Mailer/GNUmakefile b/SoObjects/Mailer/GNUmakefile index bd94d2e0..82e9dfb1 100644 --- a/SoObjects/Mailer/GNUmakefile +++ b/SoObjects/Mailer/GNUmakefile @@ -18,7 +18,10 @@ Mailer_OBJC_FILES += \ SOGoMailFolder.m \ SOGoSharedInboxFolder.m \ SOGoMailObject.m \ + SOGoDraftObject.m \ SOGoMailObject+Draft.m \ + SOGoSentFolder.m \ + SOGoDraftsFolder.m \ SOGoTrashFolder.m \ \ SOGoMailBodyPart.m \ @@ -27,9 +30,6 @@ Mailer_OBJC_FILES += \ SOGoCalendarMailBodyPart.m \ SOGoVCardMailBodyPart.m \ \ - SOGoDraftsFolder.m \ - SOGoDraftObject.m \ - \ SOGoMailForward.m \ \ NSData+Mail.m \ diff --git a/SoObjects/Mailer/SOGoDraftsFolder.h b/SoObjects/Mailer/SOGoDraftsFolder.h index ea97a6f6..4c260d12 100644 --- a/SoObjects/Mailer/SOGoDraftsFolder.h +++ b/SoObjects/Mailer/SOGoDraftsFolder.h @@ -24,7 +24,7 @@ @class SOGoDraftObject; -@interface SOGoDraftsFolder : SOGoMailFolder +@interface SOGoDraftsFolder : SOGoSpecialMailFolder - (SOGoDraftObject *) newDraft; - (BOOL) isInDraftsFolder; diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index aa2f1d05..25b99b70 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -32,6 +32,7 @@ #import #import +#import #import #import "SOGoMailFolder.h" @@ -163,7 +164,7 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default [folders removeObjectsInArray: additionalFolders]; [folders addObjectsFromArray: additionalFolders]; } - + return folders; } @@ -178,13 +179,21 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default { NSMutableArray *newFolders; NSArray *rawFolders, *mainFolders; + NSString *realDraftsFolderName, *realSentFolderName, *realTrashFolderName; - rawFolders = [[self imap4Connection] - allFoldersForURL: [self imap4URL]]; + rawFolders = [[self imap4Connection] allFoldersForURL: [self imap4URL]]; -#warning FIXME: the folder names should be prefixed - mainFolders = [NSArray arrayWithObjects: inboxFolderName, draftsFolderName, - sentFolder, trashFolder, nil]; + realDraftsFolderName + = [[self draftsFolderInContext: context] traversalFromMailAccount]; + realSentFolderName + = [[self sentFolderInContext: context] traversalFromMailAccount]; + realTrashFolderName + = [[self trashFolderInContext: context] traversalFromMailAccount]; + + mainFolders = [NSArray arrayWithObjects: inboxFolderName, + realDraftsFolderName, + realSentFolderName, + realTrashFolderName, nil]; newFolders = [NSMutableArray arrayWithArray: rawFolders]; [newFolders removeObjectsInArray: mainFolders]; [newFolders sortUsingSelector: @selector (caseInsensitiveCompare:)]; @@ -247,6 +256,11 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default return urlString; } +- (NSMutableString *) traversalFromMailAccount +{ + return [NSMutableString string]; +} + - (NSString *) imap4Login { return [[self imap4URL] user]; @@ -274,15 +288,11 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default return folder; } -- (id) lookupImap4Folder: (NSString *) _key - inContext: (id) _cx +- (id) lookupSentFolder: (NSString *) _key + inContext: (id) _ctx { - NSString *s; - - s = [_key isEqualToString: [self trashFolderNameInContext:_cx]] - ? @"SOGoTrashFolder" : @"SOGoMailFolder"; - - return [self lookupFolder:_key ofClassNamed:s inContext:_cx]; + return [self lookupFolder: _key ofClassNamed: @"SOGoSentFolder" + inContext: _ctx]; } - (id) lookupDraftsFolder: (NSString *) _key @@ -292,6 +302,13 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default inContext: _ctx]; } +- (id) lookupTrashFolder: (NSString *) _key + inContext: (id) _ctx +{ + return [self lookupFolder: _key ofClassNamed: @"SOGoTrashFolder" + inContext: _ctx]; +} + - (id) lookupFiltersFolder: (NSString *) _key inContext: (id) _ctx { return [self lookupFolder:_key ofClassNamed:@"SOGoSieveScriptsFolder" @@ -308,12 +325,17 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default { // TODO: those should be product.plist bindings? (can't be class bindings // though because they are 'per-account') - if ([_key isEqualToString: [self draftsFolderNameInContext: _ctx]]) + if ([_key isEqualToString: [self sentFolderNameInContext: _ctx]]) + obj = [self lookupSentFolder: _key inContext: _ctx]; + else if ([_key isEqualToString: [self draftsFolderNameInContext: _ctx]]) obj = [self lookupDraftsFolder: _key inContext: _ctx]; - else if ([_key isEqualToString: [self sieveFolderNameInContext: _ctx]]) - obj = [self lookupFiltersFolder: _key inContext: _ctx]; + else if ([_key isEqualToString: [self trashFolderNameInContext: _ctx]]) + obj = [self lookupTrashFolder: _key inContext: _ctx]; +// else if ([_key isEqualToString: [self sieveFolderNameInContext: _ctx]]) +// obj = [self lookupFiltersFolder: _key inContext: _ctx]; else - obj = [self lookupImap4Folder: _key inContext: _ctx]; + obj = [self lookupFolder: _key ofClassNamed: @"SOGoMailFolder" + inContext: _ctx]; } else obj = [super lookupName: _key inContext: _ctx acquire: NO]; diff --git a/SoObjects/Mailer/SOGoMailBaseObject.h b/SoObjects/Mailer/SOGoMailBaseObject.h index ec2d8baa..1faecb77 100644 --- a/SoObjects/Mailer/SOGoMailBaseObject.h +++ b/SoObjects/Mailer/SOGoMailBaseObject.h @@ -64,6 +64,7 @@ - (NSString *) relativeImap4Name; - (NSMutableString *) imap4URLString; +- (NSMutableString *) traversalFromMailAccount; - (NSURL *) imap4URL; - (NSString *) imap4Login; diff --git a/SoObjects/Mailer/SOGoMailBaseObject.m b/SoObjects/Mailer/SOGoMailBaseObject.m index e6c2260d..60d6c22a 100644 --- a/SoObjects/Mailer/SOGoMailBaseObject.m +++ b/SoObjects/Mailer/SOGoMailBaseObject.m @@ -186,6 +186,16 @@ static BOOL debugOn = YES; return [[self authenticatorInContext: context] passwordInContext: context]; } +- (NSMutableString *) traversalFromMailAccount +{ + NSMutableString *currentTraversal; + + currentTraversal = [container traversalFromMailAccount]; + [currentTraversal appendFormat: @"/%@", [self relativeImap4Name]]; + + return currentTraversal; +} + - (void)flushMailCaches { [[self mailManager] flushCachesForURL:[self imap4URL]]; } diff --git a/SoObjects/Mailer/SOGoMailFolder.h b/SoObjects/Mailer/SOGoMailFolder.h index 3de6f3ee..6ad7defa 100644 --- a/SoObjects/Mailer/SOGoMailFolder.h +++ b/SoObjects/Mailer/SOGoMailFolder.h @@ -67,9 +67,17 @@ - (NSArray *) subfolders; +- (BOOL) isSpecialFolder; + - (NSArray *) allFolderPaths; - (NSArray *) allFolderURLs; @end +@interface SOGoSpecialMailFolder : SOGoMailFolder + +- (BOOL) isSpecialFolder; + +@end + #endif /* __Mailer_SOGoMailFolder_H__ */ diff --git a/SoObjects/Mailer/SOGoMailFolder.m b/SoObjects/Mailer/SOGoMailFolder.m index ec66e366..15f5b660 100644 --- a/SoObjects/Mailer/SOGoMailFolder.m +++ b/SoObjects/Mailer/SOGoMailFolder.m @@ -133,6 +133,11 @@ static NSString *defaultUserID = @"anyone"; return [[self imap4Connection] subfoldersForURL: [self imap4URL]]; } +- (BOOL) isSpecialFolder +{ + return NO; +} + - (NSArray *) allFolderPaths { NSMutableArray *deepSubfolders; @@ -688,3 +693,26 @@ static NSString *defaultUserID = @"anyone"; } @end /* SOGoMailFolder */ + +@implementation SOGoSpecialMailFolder + +- (id) initWithName: (NSString *) newName + inContainer: (id) newContainer +{ + if ((self = [super initWithName: newName + inContainer: newContainer])) + { + if (![[self imap4Connection] doesMailboxExistAtURL: [self imap4URL]]) + [imap4 createMailbox: [self relativeImap4Name] + atURL: [newContainer imap4URL]]; + } + + return self; +} + +- (BOOL) isSpecialFolder +{ + return YES; +} + +@end diff --git a/SoObjects/Mailer/SOGoSentFolder.h b/SoObjects/Mailer/SOGoSentFolder.h new file mode 100644 index 00000000..18c360fe --- /dev/null +++ b/SoObjects/Mailer/SOGoSentFolder.h @@ -0,0 +1,30 @@ +/* + 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_SOGoSentFolder_H__ +#define __Mailer_SOGoSentFolder_H__ + +#import "SOGoMailFolder.h" + +@interface SOGoSentFolder : SOGoSpecialMailFolder +@end + +#endif /* __Mailer_SOGoSentFolder_H__ */ diff --git a/SoObjects/Mailer/SOGoSentFolder.m b/SoObjects/Mailer/SOGoSentFolder.m new file mode 100644 index 00000000..92648a79 --- /dev/null +++ b/SoObjects/Mailer/SOGoSentFolder.m @@ -0,0 +1,34 @@ +/* + 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 "SOGoSentFolder.h" + +@implementation SOGoSentFolder + +/* folder type */ + +- (NSString *)outlookFolderClass { + return @"IPF.Sent"; +} + +@end /* SOGoSentFolder */ diff --git a/SoObjects/Mailer/SOGoTrashFolder.h b/SoObjects/Mailer/SOGoTrashFolder.h index d097490a..5d14947f 100644 --- a/SoObjects/Mailer/SOGoTrashFolder.h +++ b/SoObjects/Mailer/SOGoTrashFolder.h @@ -24,7 +24,7 @@ #import "SOGoMailFolder.h" -@interface SOGoTrashFolder : SOGoMailFolder +@interface SOGoTrashFolder : SOGoSpecialMailFolder @end #endif /* __Mailer_SOGoTrashFolder_H__ */ diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index f3a0633a..708ed4f9 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -98,9 +98,7 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; ASSIGN (defaultLanguage, @"English"); } if (!superUsernames) - { - superUsernames = [ud arrayForKey: @"SOGoSuperUsernames"]; - } + ASSIGN (superUsernames, [ud arrayForKey: @"SOGoSuperUsernames"]); acceptAnyUser = ([[ud stringForKey: @"SOGoAuthentificationMethod"] isEqualToString: @"bypass"]); diff --git a/UI/Common/English.lproj/Localizable.strings b/UI/Common/English.lproj/Localizable.strings index 1ae7857e..d7c1eb9b 100644 --- a/UI/Common/English.lproj/Localizable.strings +++ b/UI/Common/English.lproj/Localizable.strings @@ -10,7 +10,7 @@ "Address Book" = "Address Book"; "Mail" = "Mail"; "Preferences" = "Preferences"; -"Sign Out" = "Sign Out"; +"Disconnect" = "Disconnect"; "Right Administration" = "Right Administration"; "Log Console (dev.)" = "Log Console (dev.)"; diff --git a/UI/Common/French.lproj/Localizable.strings b/UI/Common/French.lproj/Localizable.strings index 2de07b5c..257db60d 100644 --- a/UI/Common/French.lproj/Localizable.strings +++ b/UI/Common/French.lproj/Localizable.strings @@ -8,7 +8,7 @@ "Address Book" = "Carnet d'adresses"; "Mail" = "Courrier"; "Preferences" = "Préférences"; -"Sign Out" = "Quitter"; +"Disconnect" = "Quitter"; "Right Administration" = "Partage"; "Log Console (dev.)" = "Journal (dév.)"; diff --git a/UI/MailPartViewers/UIxMailPartTextViewer.m b/UI/MailPartViewers/UIxMailPartTextViewer.m index 22d41a38..450c1421 100644 --- a/UI/MailPartViewers/UIxMailPartTextViewer.m +++ b/UI/MailPartViewers/UIxMailPartTextViewer.m @@ -44,6 +44,8 @@ content = [NSMutableString string]; superContent = [[super flatContentAsString] stringByEscapingHTMLString]; [content appendString: [superContent stringByDetectingURLs]]; + [content replaceString: @"\r\n" withString: @"
"]; + [content replaceString: @"\n" withString: @"
"]; return content; } diff --git a/UI/MainUI/English.lproj/Localizable.strings b/UI/MainUI/English.lproj/Localizable.strings index 9cc6c319..534d91a0 100644 --- a/UI/MainUI/English.lproj/Localizable.strings +++ b/UI/MainUI/English.lproj/Localizable.strings @@ -2,7 +2,7 @@ "title" = "SOGo"; -"Login:" = "Login:"; +"Username:" = "Username:"; "Password:" = "Password:"; "Connect" = "Connect"; diff --git a/UI/MainUI/French.lproj/Localizable.strings b/UI/MainUI/French.lproj/Localizable.strings index 2cd2ec06..b22b0c9e 100644 --- a/UI/MainUI/French.lproj/Localizable.strings +++ b/UI/MainUI/French.lproj/Localizable.strings @@ -2,7 +2,7 @@ "title" = "SOGo"; -"Login:" = "Nom d'utilisateur :"; +"Username:" = "Nom d'utilisateur :"; "Password:" = "Mot de passe :"; "Connect" = "Connexion"; diff --git a/UI/Templates/MainUI/SOGoRootPage.wox b/UI/Templates/MainUI/SOGoRootPage.wox index 78353a75..3eaf672a 100644 --- a/UI/Templates/MainUI/SOGoRootPage.wox +++ b/UI/Templates/MainUI/SOGoRootPage.wox @@ -13,7 +13,7 @@

-