From 7caa393ed8e4587736fc08fbd92bf35a798bf86c Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 1 Aug 2007 18:22:45 +0000 Subject: [PATCH] Monotone-Parent: 98f0464d1da2b872d5573c46ffb4cba64b5f1e50 Monotone-Revision: 7c7a8b7547ec7b4ed3b19f65785d05cc377b5a57 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-08-01T18:22:45 Monotone-Branch: ca.inverse.sogo --- SoObjects/Mailer/SOGoCalendarMailBodyPart.m | 7 +- SoObjects/Mailer/SOGoDraftsFolder.m | 90 ++++++++++++++------- SoObjects/Mailer/SOGoImageMailBodyPart.m | 4 +- SoObjects/Mailer/SOGoMailAccounts.m | 27 ++++--- SoObjects/Mailer/SOGoMailBodyPart.m | 23 +++++- SoObjects/Mailer/SOGoMailFolderDataSource.m | 20 +++-- SoObjects/Mailer/SOGoMailIdentity.m | 79 +++++++++--------- SoObjects/Mailer/SOGoMailManager.m | 12 ++- SoObjects/Mailer/SOGoMessageMailBodyPart.m | 7 +- SoObjects/Mailer/SOGoSharedInboxFolder.h | 2 +- SoObjects/Mailer/SOGoSharedInboxFolder.m | 3 +- SoObjects/Mailer/SOGoTrashFolder.h | 2 +- SoObjects/Mailer/SOGoTrashFolder.m | 5 +- SoObjects/Mailer/SOGoUser+Mail.m | 13 ++- SoObjects/Mailer/SOGoVCardMailBodyPart.m | 8 +- SoObjects/Mailer/common.h | 40 --------- 16 files changed, 182 insertions(+), 160 deletions(-) delete mode 100644 SoObjects/Mailer/common.h diff --git a/SoObjects/Mailer/SOGoCalendarMailBodyPart.m b/SoObjects/Mailer/SOGoCalendarMailBodyPart.m index 714c0bc45..def0dda88 100644 --- a/SoObjects/Mailer/SOGoCalendarMailBodyPart.m +++ b/SoObjects/Mailer/SOGoCalendarMailBodyPart.m @@ -19,7 +19,7 @@ 02111-1307, USA. */ -#include +#import "SOGoMailBodyPart.h" /* SOGoCalendarMailBodyPart @@ -31,13 +31,8 @@ */ @interface SOGoCalendarMailBodyPart : SOGoMailBodyPart -{ -} - @end -#include "common.h" - @implementation SOGoCalendarMailBodyPart @end /* SOGoCalendarMailBodyPart */ diff --git a/SoObjects/Mailer/SOGoDraftsFolder.m b/SoObjects/Mailer/SOGoDraftsFolder.m index 13655da0d..2509ff059 100644 --- a/SoObjects/Mailer/SOGoDraftsFolder.m +++ b/SoObjects/Mailer/SOGoDraftsFolder.m @@ -19,35 +19,51 @@ 02111-1307, USA. */ -#include "SOGoDraftsFolder.h" -#include "SOGoDraftObject.h" -#include -#include -#include "common.h" -#include +#import + +#import +#import + +#import +#import +#import +#import + +#import +#import "SOGoDraftObject.h" + +#import "SOGoDraftsFolder.h" @implementation SOGoDraftsFolder static NSString *spoolFolder = nil; -+ (void)initialize { - NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; ++ (void) initialize +{ + NSUserDefaults *ud;; - spoolFolder = [[ud stringForKey:@"SOGoMailSpoolPath"] copy]; - if ([spoolFolder length] < 3) - spoolFolder = @"/tmp/"; - - NSLog(@"Note: using SOGo mail spool folder: %@", spoolFolder); + if (!spoolFolder) + { + ud = [NSUserDefaults standardUserDefaults]; + spoolFolder = [[ud stringForKey:@"SOGoMailSpoolPath"] copy]; + if ([spoolFolder length] < 3) + spoolFolder = @"/tmp/"; + + NSLog(@"Note: using SOGo mail spool folder: %@", spoolFolder); + } } /* new objects */ -- (NSString *)makeNewObjectNameInContext:(id)_ctx { +- (NSString *) makeNewObjectNameInContext: (id) _ctx +{ static int counter = 1; // THREAD + return [NSString stringWithFormat:@"draft_%08d_%08x", getpid(), counter++]; } -- (NSString *)newObjectBaseURLInContext:(id)_ctx { +- (NSString *) newObjectBaseURLInContext: (id) _ctx +{ NSString *s, *n; n = [self makeNewObjectNameInContext:_ctx]; @@ -59,29 +75,36 @@ static NSString *spoolFolder = nil; return [s stringByAppendingString:n]; } -- (id)newObjectInContext:(id)_ctx { +- (id) newObjectInContext: (id) _ctx +{ return [self lookupName:[self makeNewObjectNameInContext:_ctx] inContext:_ctx acquire:NO]; } /* draft folder functionality */ -- (NSFileManager *)spoolFileManager { +- (NSFileManager *) spoolFileManager +{ return [NSFileManager defaultManager]; } -- (NSString *)spoolFolderPath { +- (NSString *) spoolFolderPath +{ return spoolFolder; } -- (NSString *)userSpoolFolderPath { + +- (NSString *) userSpoolFolderPath +{ NSString *p, *n; p = [self spoolFolderPath]; n = [[self lookupUserFolder] nameInContainer]; + return [p stringByAppendingPathComponent:n]; } -- (BOOL)_ensureUserSpoolFolderPath { +- (BOOL) _ensureUserSpoolFolderPath +{ NSFileManager *fm; if ((fm = [self spoolFileManager]) == nil) { @@ -92,7 +115,8 @@ static NSString *spoolFolder = nil; attributes:nil]; } -- (NSArray *)fetchMailNames { +- (NSArray *) fetchMailNames +{ NSString *p; if ((p = [self userSpoolFolderPath]) == nil) @@ -103,7 +127,9 @@ static NSString *spoolFolder = nil; /* folder methods (used by template) */ -- (NSArray *)fetchUIDsMatchingQualifier:(id)_q sortOrdering:(id)_so { +- (NSArray *) fetchUIDsMatchingQualifier: (id) _q + sortOrdering: (id) _so +{ // TODO: retrieve contained objects NSArray *allUids; @@ -117,7 +143,7 @@ static NSString *spoolFolder = nil; // TODO: should sort uids (q=%@,so=%@): %@", _q, _so, allUids]; return allUids; } -- (NSArray *)fetchUIDs:(NSArray *)_uids parts:(NSArray *)_parts { +- (NSArray *)fetchUIDs: (NSArray *)_uids parts: (NSArray *)_parts { /* FLAGS, ENVELOPE, RFC822.SIZE */ NSMutableArray *drafts; unsigned i, count; @@ -146,13 +172,18 @@ static NSString *spoolFolder = nil; /* name lookup */ -- (id)lookupDraftMessage:(NSString *)_key inContext:(id)_ctx { +- (id) lookupDraftMessage: (NSString *) _key + inContext: (id) _ctx +{ // TODO: we might want to check for existence prior controller creation return [[[SOGoDraftObject alloc] initWithName:_key inContainer:self] autorelease]; } -- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag { +- (id) lookupName: (NSString *) _key + inContext: (id) _ctx + acquire: (BOOL) _flag +{ id obj; /* first check attributes directly bound to the application */ @@ -168,17 +199,20 @@ static NSString *spoolFolder = nil; /* WebDAV */ -- (BOOL)davIsCollection { +- (BOOL) davIsCollection +{ return YES; } -- (NSArray *)toOneRelationshipKeys { +- (NSArray *) toOneRelationshipKeys +{ return [self fetchMailNames]; } /* folder type */ -- (NSString *)outlookFolderClass { +- (NSString *) outlookFolderClass +{ return @"IPF.Drafts"; } diff --git a/SoObjects/Mailer/SOGoImageMailBodyPart.m b/SoObjects/Mailer/SOGoImageMailBodyPart.m index 0319ac001..3d9679203 100644 --- a/SoObjects/Mailer/SOGoImageMailBodyPart.m +++ b/SoObjects/Mailer/SOGoImageMailBodyPart.m @@ -19,7 +19,7 @@ 02111-1307, USA. */ -#include +#import "SOGoMailBodyPart.h" /* SOGoImageMailBodyPart @@ -36,8 +36,6 @@ @end -#include "common.h" - @implementation SOGoImageMailBodyPart @end /* SOGoImageMailBodyPart */ diff --git a/SoObjects/Mailer/SOGoMailAccounts.m b/SoObjects/Mailer/SOGoMailAccounts.m index bb3ac3ba4..71d4f0b8c 100644 --- a/SoObjects/Mailer/SOGoMailAccounts.m +++ b/SoObjects/Mailer/SOGoMailAccounts.m @@ -19,10 +19,16 @@ 02111-1307, USA. */ -#include "SOGoMailAccounts.h" -#include "SOGoUser+Mail.h" -#include "common.h" -#include +#import + +#import +#import +#import +#import + +#import "SOGoUser+Mail.h" + +#import "SOGoMailAccounts.h" @implementation SOGoMailAccounts @@ -38,7 +44,7 @@ static NSString *AgenorShareLoginMarker = @".-."; - (NSArray *)toManyRelationshipKeys { SOGoUser *user; id account; - NSArray *shares; +// NSArray *shares; NSString *userLogin; /* @@ -63,11 +69,12 @@ static NSString *AgenorShareLoginMarker = @".-."; account = [user primaryIMAP4AccountString]; if ([account isNotNull]) account = [NSArray arrayWithObject:account]; - - shares = [user valueForKey:@"additionalIMAP4AccountStrings"]; - return ([shares count] == 0) - ? account - : [account arrayByAddingObjectsFromArray:shares]; + + return account; +// shares = [user valueForKey:@"additionalIMAP4AccountStrings"] +// return ([shares count] == 0) +// ? account +// : [account arrayByAddingObjectsFromArray:shares]; } - (NSArray *) fetchIdentitiesWithOnlyEmitterAccess: (BOOL) _flag diff --git a/SoObjects/Mailer/SOGoMailBodyPart.m b/SoObjects/Mailer/SOGoMailBodyPart.m index ec10200f2..15bc9dd5e 100644 --- a/SoObjects/Mailer/SOGoMailBodyPart.m +++ b/SoObjects/Mailer/SOGoMailBodyPart.m @@ -19,10 +19,25 @@ 02111-1307, USA. */ -#include "SOGoMailBodyPart.h" -#include "SOGoMailObject.h" -#include "SOGoMailManager.h" -#include "common.h" +#import +#import +#import +#import +#import + +#import +#import +#import +#import +#import +#import +#import +#import + +#import "SOGoMailObject.h" +#import "SOGoMailManager.h" + +#import "SOGoMailBodyPart.h" @implementation SOGoMailBodyPart diff --git a/SoObjects/Mailer/SOGoMailFolderDataSource.m b/SoObjects/Mailer/SOGoMailFolderDataSource.m index f9aba4878..2dbc71ee3 100644 --- a/SoObjects/Mailer/SOGoMailFolderDataSource.m +++ b/SoObjects/Mailer/SOGoMailFolderDataSource.m @@ -19,11 +19,21 @@ 02111-1307, USA. */ -#include "SOGoMailFolderDataSource.h" -#include "SOGoMailManager.h" -#include -#include -#include "common.h" +#import +#import +#import +#import + +#import +#import +#import +#import +#import +#import + +#import "SOGoMailManager.h" + +#import "SOGoMailFolderDataSource.h" @implementation SOGoMailFolderDataSource diff --git a/SoObjects/Mailer/SOGoMailIdentity.m b/SoObjects/Mailer/SOGoMailIdentity.m index a9373dfae..424d08918 100644 --- a/SoObjects/Mailer/SOGoMailIdentity.m +++ b/SoObjects/Mailer/SOGoMailIdentity.m @@ -19,101 +19,104 @@ 02111-1307, USA. */ -#include "SOGoMailIdentity.h" -#include "common.h" +#import + +#import + +#import "SOGoMailIdentity.h" @implementation SOGoMailIdentity - (void)dealloc { - [self->name release]; - [self->email release]; - [self->replyTo release]; - [self->organization release]; - [self->signature release]; - [self->vCard release]; - [self->sentFolderName release]; - [self->sentBCC release]; - [self->draftsFolderName release]; - [self->templatesFolderName release]; + [name release]; + [email release]; + [replyTo release]; + [organization release]; + [signature release]; + [vCard release]; + [sentFolderName release]; + [sentBCC release]; + [draftsFolderName release]; + [templatesFolderName release]; [super dealloc]; } /* accessors */ - (void)setName:(NSString *)_value { - ASSIGNCOPY(self->name, _value); + ASSIGNCOPY(name, _value); } - (NSString *)name { - return self->name; + return name; } - (void)setEmail:(NSString *)_value { - ASSIGNCOPY(self->email, _value); + ASSIGNCOPY(email, _value); } - (NSString *)email { - return self->email; + return email; } - (void)setReplyTo:(NSString *)_value { - ASSIGNCOPY(self->replyTo, _value); + ASSIGNCOPY(replyTo, _value); } - (NSString *)replyTo { - return self->replyTo; + return replyTo; } - (void)setOrganization:(NSString *)_value { - ASSIGNCOPY(self->organization, _value); + ASSIGNCOPY(organization, _value); } - (NSString *)organization { - return self->organization; + return organization; } - (void)setSignature:(NSString *)_value { - ASSIGNCOPY(self->signature, _value); + ASSIGNCOPY(signature, _value); } - (NSString *)signature { - return self->signature; + return signature; } - (BOOL)hasSignature { return [[self signature] isNotEmpty]; } - (void)setVCard:(NSString *)_value { - ASSIGNCOPY(self->vCard, _value); + ASSIGNCOPY(vCard, _value); } - (NSString *)vCard { - return self->vCard; + return vCard; } - (BOOL)hasVCard { return [[self vCard] isNotEmpty]; } - (void)setSentFolderName:(NSString *)_value { - ASSIGNCOPY(self->sentFolderName, _value); + ASSIGNCOPY(sentFolderName, _value); } - (NSString *)sentFolderName { - return self->sentFolderName; + return sentFolderName; } - (void)setSentBCC:(NSString *)_value { - ASSIGNCOPY(self->sentBCC, _value); + ASSIGNCOPY(sentBCC, _value); } - (NSString *)sentBCC { - return self->sentBCC; + return sentBCC; } - (void)setDraftsFolderName:(NSString *)_value { - ASSIGNCOPY(self->draftsFolderName, _value); + ASSIGNCOPY(draftsFolderName, _value); } - (NSString *)draftsFolderName { - return self->draftsFolderName; + return draftsFolderName; } - (void)setTemplatesFolderName:(NSString *)_value { - ASSIGNCOPY(self->templatesFolderName, _value); + ASSIGNCOPY(templatesFolderName, _value); } - (NSString *)templatesFolderName { - return self->templatesFolderName; + return templatesFolderName; } /* description */ @@ -124,14 +127,14 @@ ms = [NSMutableString stringWithCapacity:128]; [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; - if (self->name != nil) [ms appendFormat:@" name='%@'", self->name]; - if (self->email != nil) [ms appendFormat:@" email='%@'", self->email]; + if (name != nil) [ms appendFormat:@" name='%@'", name]; + if (email != nil) [ms appendFormat:@" email='%@'", email]; - if (self->sentFolderName != nil) - [ms appendFormat:@" sent='%@'", self->sentFolderName]; + if (sentFolderName != nil) + [ms appendFormat:@" sent='%@'", sentFolderName]; - if ([self->sentBCC length] > 0) [ms appendString:@" sent-bcc"]; - if ([self->vCard length] > 0) [ms appendString:@" vcard"]; + if ([sentBCC length] > 0) [ms appendString:@" sent-bcc"]; + if ([vCard length] > 0) [ms appendString:@" vcard"]; [ms appendString:@">"]; return ms; diff --git a/SoObjects/Mailer/SOGoMailManager.m b/SoObjects/Mailer/SOGoMailManager.m index f3e947a30..59c1f4c0b 100644 --- a/SoObjects/Mailer/SOGoMailManager.m +++ b/SoObjects/Mailer/SOGoMailManager.m @@ -19,10 +19,14 @@ 02111-1307, USA. */ -#include "SOGoMailManager.h" -#include -#include -#include "common.h" +#import + +#import +#import +#import +#import + +#import "SOGoMailManager.h" /* Could check read-write state: diff --git a/SoObjects/Mailer/SOGoMessageMailBodyPart.m b/SoObjects/Mailer/SOGoMessageMailBodyPart.m index 4932bf20c..0e5fcc5be 100644 --- a/SoObjects/Mailer/SOGoMessageMailBodyPart.m +++ b/SoObjects/Mailer/SOGoMessageMailBodyPart.m @@ -19,7 +19,7 @@ 02111-1307, USA. */ -#include +#import "SOGoMailBodyPart.h" /* SOGoMessageMailBodyPart @@ -33,13 +33,8 @@ */ @interface SOGoMessageMailBodyPart : SOGoMailBodyPart -{ -} - @end -#include "common.h" - @implementation SOGoMessageMailBodyPart @end /* SOGoMessageMailBodyPart */ diff --git a/SoObjects/Mailer/SOGoSharedInboxFolder.h b/SoObjects/Mailer/SOGoSharedInboxFolder.h index 1e597b30f..8fc1f4173 100644 --- a/SoObjects/Mailer/SOGoSharedInboxFolder.h +++ b/SoObjects/Mailer/SOGoSharedInboxFolder.h @@ -22,7 +22,7 @@ #ifndef __Mailer_SOGoSharedInboxFolder_H__ #define __Mailer_SOGoSharedInboxFolder_H__ -#include +#import /* SOGoSharedInboxFolder diff --git a/SoObjects/Mailer/SOGoSharedInboxFolder.m b/SoObjects/Mailer/SOGoSharedInboxFolder.m index d5e444bff..5399b751e 100644 --- a/SoObjects/Mailer/SOGoSharedInboxFolder.m +++ b/SoObjects/Mailer/SOGoSharedInboxFolder.m @@ -19,8 +19,7 @@ 02111-1307, USA. */ -#include "SOGoSharedInboxFolder.h" -#include "common.h" +#import "SOGoSharedInboxFolder.h" @implementation SOGoSharedInboxFolder diff --git a/SoObjects/Mailer/SOGoTrashFolder.h b/SoObjects/Mailer/SOGoTrashFolder.h index c4089a8af..d097490a4 100644 --- a/SoObjects/Mailer/SOGoTrashFolder.h +++ b/SoObjects/Mailer/SOGoTrashFolder.h @@ -22,7 +22,7 @@ #ifndef __Mailer_SOGoTrashFolder_H__ #define __Mailer_SOGoTrashFolder_H__ -#include +#import "SOGoMailFolder.h" @interface SOGoTrashFolder : SOGoMailFolder @end diff --git a/SoObjects/Mailer/SOGoTrashFolder.m b/SoObjects/Mailer/SOGoTrashFolder.m index 01cbd13d5..b034bfb16 100644 --- a/SoObjects/Mailer/SOGoTrashFolder.m +++ b/SoObjects/Mailer/SOGoTrashFolder.m @@ -19,8 +19,9 @@ 02111-1307, USA. */ -#include "SOGoTrashFolder.h" -#include "common.h" +#import + +#import "SOGoTrashFolder.h" @implementation SOGoTrashFolder diff --git a/SoObjects/Mailer/SOGoUser+Mail.m b/SoObjects/Mailer/SOGoUser+Mail.m index 00b5561ca..2cde83986 100644 --- a/SoObjects/Mailer/SOGoUser+Mail.m +++ b/SoObjects/Mailer/SOGoUser+Mail.m @@ -19,9 +19,16 @@ 02111-1307, USA. */ -#include "SOGoUser+Mail.h" -#include "SOGoMailIdentity.h" -#include "common.h" +#import +#import +#import + +#import +#import + +#import "SOGoMailIdentity.h" + +#import "SOGoUser+Mail.h" @implementation SOGoUser(Mail) diff --git a/SoObjects/Mailer/SOGoVCardMailBodyPart.m b/SoObjects/Mailer/SOGoVCardMailBodyPart.m index 3f24d21a3..6299fe542 100644 --- a/SoObjects/Mailer/SOGoVCardMailBodyPart.m +++ b/SoObjects/Mailer/SOGoVCardMailBodyPart.m @@ -19,7 +19,7 @@ 02111-1307, USA. */ -#include +#import "SOGoMailBodyPart.h" /* SOGoVCardMailBodyPart @@ -31,13 +31,7 @@ */ @interface SOGoVCardMailBodyPart : SOGoMailBodyPart -{ -} - @end -#include "common.h" - @implementation SOGoVCardMailBodyPart - @end /* SOGoVCardMailBodyPart */ diff --git a/SoObjects/Mailer/common.h b/SoObjects/Mailer/common.h deleted file mode 100644 index 634e72ebc..000000000 --- a/SoObjects/Mailer/common.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-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. -*/ - -#warning importing common is baaad - -#import -#import - -#if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY -# include -# include -#endif - -#include -#include -#include - -#include - -#include - -#warning importing common.h is baaad