From 06b0001d31c6db855806390c1fea8582c39418e8 Mon Sep 17 00:00:00 2001 From: helge Date: Sat, 27 Nov 2004 17:29:30 +0000 Subject: [PATCH] started Sieve scripts bundle git-svn-id: http://svn.opengroupware.org/SOGo/trunk@455 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SoObjects/Mailer/ChangeLog | 5 ++ SOGo/SoObjects/Mailer/GNUmakefile | 2 +- SOGo/SoObjects/Mailer/SOGoMailAccount.m | 39 ++++++++-- SOGo/SoObjects/Mailer/SOGoMailBaseObject.h | 1 - SOGo/SoObjects/Mailer/SOGoMailFolder.h | 1 - SOGo/SoObjects/Mailer/Version | 10 +-- SOGo/SoObjects/Sieve/ChangeLog | 3 + SOGo/SoObjects/Sieve/GNUmakefile | 21 ++++++ SOGo/SoObjects/Sieve/GNUmakefile.preamble | 3 + SOGo/SoObjects/Sieve/Product.m | 32 +++++++++ SOGo/SoObjects/Sieve/README | 8 +++ SOGo/SoObjects/Sieve/SOGoSieveBaseObject.h | 56 +++++++++++++++ SOGo/SoObjects/Sieve/SOGoSieveBaseObject.m | 72 +++++++++++++++++++ SOGo/SoObjects/Sieve/SOGoSieveScriptObject.h | 43 +++++++++++ SOGo/SoObjects/Sieve/SOGoSieveScriptObject.m | 27 +++++++ SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.h | 44 ++++++++++++ SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.m | 27 +++++++ SOGo/SoObjects/Sieve/Version | 5 ++ SOGo/SoObjects/Sieve/common.h | 37 ++++++++++ SOGo/SoObjects/Sieve/product.plist | 23 ++++++ 20 files changed, 445 insertions(+), 14 deletions(-) create mode 100644 SOGo/SoObjects/Sieve/ChangeLog create mode 100644 SOGo/SoObjects/Sieve/GNUmakefile create mode 100644 SOGo/SoObjects/Sieve/GNUmakefile.preamble create mode 100644 SOGo/SoObjects/Sieve/Product.m create mode 100644 SOGo/SoObjects/Sieve/README create mode 100644 SOGo/SoObjects/Sieve/SOGoSieveBaseObject.h create mode 100644 SOGo/SoObjects/Sieve/SOGoSieveBaseObject.m create mode 100644 SOGo/SoObjects/Sieve/SOGoSieveScriptObject.h create mode 100644 SOGo/SoObjects/Sieve/SOGoSieveScriptObject.m create mode 100644 SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.h create mode 100644 SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.m create mode 100644 SOGo/SoObjects/Sieve/Version create mode 100644 SOGo/SoObjects/Sieve/common.h create mode 100644 SOGo/SoObjects/Sieve/product.plist diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index f8130ddd..d1941028 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,3 +1,8 @@ +2004-11-27 Helge Hess + + * SOGoMailAccount.m: added 'Filters' key and lookup of Sieve filters + (v0.9.54) + 2004-11-11 Helge Hess * v0.9.53 diff --git a/SOGo/SoObjects/Mailer/GNUmakefile b/SOGo/SoObjects/Mailer/GNUmakefile index ef4c0b92..c594750f 100644 --- a/SOGo/SoObjects/Mailer/GNUmakefile +++ b/SOGo/SoObjects/Mailer/GNUmakefile @@ -1,4 +1,4 @@ -# $Id$ +# GNUstep makefile include ../common.make diff --git a/SOGo/SoObjects/Mailer/SOGoMailAccount.m b/SOGo/SoObjects/Mailer/SOGoMailAccount.m index f038287d..5a6b4b0f 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailAccount.m +++ b/SOGo/SoObjects/Mailer/SOGoMailAccount.m @@ -32,7 +32,12 @@ - (NSArray *)toManyRelationshipKeys { // TODO: hardcoded, if we want to support shared fldrs, this needs to change - return [NSArray arrayWithObjects:@"INBOX", @"Drafts", nil]; + static NSArray *accFolderNames = nil; + if (accFolderNames == nil) { + accFolderNames = [[NSArray alloc] initWithObjects: + @"INBOX", @"Drafts", @"Filters", nil]; + } + return accFolderNames; } /* hierarchy */ @@ -80,14 +85,30 @@ /* name lookup */ -- (id)lookupImap4Folder:(NSString *)_key inContext:(id)_ctx { - return [[[SOGoMailFolder alloc] initWithName:_key - inContainer:self] autorelease]; +- (id)lookupFolder:(NSString *)_key ofClassNamed:(NSString *)_cn + inContext:(id)_cx +{ + Class clazz; + + if ((clazz = NSClassFromString(_cn)) == Nil) { + [self logWithFormat:@"ERROR: did not find class '%@' for key: '%@'", + _cn, _key]; + return [NSException exceptionWithHTTPStatus:500 /* server error */ + reason:@"did not find mail folder class!"]; + } + return [[[clazz alloc] initWithName:_key inContainer:self] autorelease]; } +- (id)lookupImap4Folder:(NSString *)_key inContext:(id)_cx { + return [self lookupFolder:_key ofClassNamed:@"SOGoMailFolder" inContext:_cx]; +} - (id)lookupDraftsFolder:(NSString *)_key inContext:(id)_ctx { - return [[[SOGoDraftsFolder alloc] initWithName:_key - inContainer:self] autorelease]; + return [self lookupFolder:_key ofClassNamed:@"SOGoDraftsFolder" + inContext:_ctx]; +} +- (id)lookupFiltersFolder:(NSString *)_key inContext:(id)_ctx { + return [self lookupFolder:_key ofClassNamed:@"SOGoSieveScriptsFolder" + inContext:_ctx]; } - (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag { @@ -97,10 +118,16 @@ if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]) != nil) return obj; + // TODO: those should be product.plist bindings? (can't be class bindings + // though because they are 'per-account') if ([_key isEqualToString:@"Drafts"]) { if ((obj = [self lookupDraftsFolder:_key inContext:_ctx]) != nil) return obj; } + if ([_key isEqualToString:@"Filters"]) { + if ((obj = [self lookupFiltersFolder:_key inContext:_ctx]) != nil) + return obj; + } if ((obj = [self lookupImap4Folder:_key inContext:_ctx]) != nil) return obj; diff --git a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h index 5b861500..b98e4445 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h +++ b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #ifndef __Mailer_SOGoMailBaseObject_H__ #define __Mailer_SOGoMailBaseObject_H__ diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.h b/SOGo/SoObjects/Mailer/SOGoMailFolder.h index 3ec7f5df..321dbf9e 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.h +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.h @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #ifndef __Mailer_SOGoMailFolder_H__ #define __Mailer_SOGoMailFolder_H__ diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index 2f8d1724..c396f936 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,8 +1,8 @@ # Version file -SUBMINOR_VERSION:=53 +SUBMINOR_VERSION:=54 -# v0.9.44 requires NGMime v4.3.194 -# v0.9.41 requires NGMime v4.3.190 -# v0.9.35 requires SOGoLogic v0.9.24 -# v0.9.34 requires SOGoLogic v0.9.22 +# v0.9.44 requires libNGMime v4.3.194 +# v0.9.41 requires libNGMime v4.3.190 +# v0.9.35 requires libSOGoLogic v0.9.24 +# v0.9.34 requires libSOGoLogic v0.9.22 diff --git a/SOGo/SoObjects/Sieve/ChangeLog b/SOGo/SoObjects/Sieve/ChangeLog new file mode 100644 index 00000000..8b164704 --- /dev/null +++ b/SOGo/SoObjects/Sieve/ChangeLog @@ -0,0 +1,3 @@ +2004-11-27 Helge Hess + + * started Sieve product diff --git a/SOGo/SoObjects/Sieve/GNUmakefile b/SOGo/SoObjects/Sieve/GNUmakefile new file mode 100644 index 00000000..9921fefd --- /dev/null +++ b/SOGo/SoObjects/Sieve/GNUmakefile @@ -0,0 +1,21 @@ +# GNUstep makefile + +include ../common.make + +BUNDLE_NAME = Sieve + +Sieve_PRINCIPAL_CLASS = SOGoSieveProduct + +Sieve_OBJC_FILES += \ + Product.m \ + SOGoSieveBaseObject.m \ + SOGoSieveScriptsFolder.m\ + SOGoSieveScriptObject.m \ + +Sieve_RESOURCE_FILES += \ + Version \ + product.plist \ + +-include GNUmakefile.preamble +include $(GNUSTEP_MAKEFILES)/bundle.make +-include GNUmakefile.postamble diff --git a/SOGo/SoObjects/Sieve/GNUmakefile.preamble b/SOGo/SoObjects/Sieve/GNUmakefile.preamble new file mode 100644 index 00000000..df82baa0 --- /dev/null +++ b/SOGo/SoObjects/Sieve/GNUmakefile.preamble @@ -0,0 +1,3 @@ +# compilation settings + +ADDITIONAL_INCLUDE_DIRS += -I../Mailer diff --git a/SOGo/SoObjects/Sieve/Product.m b/SOGo/SoObjects/Sieve/Product.m new file mode 100644 index 00000000..eef605e7 --- /dev/null +++ b/SOGo/SoObjects/Sieve/Product.m @@ -0,0 +1,32 @@ +/* + Copyright (C) 2004 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 + +@interface SOGoSieveProduct : NSObject +{ +} + +@end + +@implementation SOGoSieveProduct + +@end /* SOGoSieveProduct */ diff --git a/SOGo/SoObjects/Sieve/README b/SOGo/SoObjects/Sieve/README new file mode 100644 index 00000000..61e34766 --- /dev/null +++ b/SOGo/SoObjects/Sieve/README @@ -0,0 +1,8 @@ +# README for Sieve SoObjects + +Class Overview +============== + + +Defaults +======== diff --git a/SOGo/SoObjects/Sieve/SOGoSieveBaseObject.h b/SOGo/SoObjects/Sieve/SOGoSieveBaseObject.h new file mode 100644 index 00000000..97761d83 --- /dev/null +++ b/SOGo/SoObjects/Sieve/SOGoSieveBaseObject.h @@ -0,0 +1,56 @@ +/* + Copyright (C) 2004 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 __Sieve_SOGoSieveBaseObject_H__ +#define __Sieve_SOGoSieveBaseObject_H__ + +#include + +/* + SOGoSieveBaseObject + + Common base class for Sieve SoObjects. +*/ + +@class NSString, NSArray, NSURL; +@class NGImap4Client; +@class SOGoMailManager; +@class SOGoMailAccount; + +@interface SOGoSieveBaseObject : SOGoObject +{ +} + +/* hierarchy */ + +- (SOGoMailAccount *)mailAccountFolder; + +/* IMAP4 */ + +- (SOGoMailManager *)mailManager; +- (NSURL *)imap4URL; +- (NSString *)imap4Password; +- (NGImap4Client *)imap4Client; +- (void)flushMailCaches; + +@end + +#endif /* __Sieve_SOGoSieveBaseObject_H__ */ diff --git a/SOGo/SoObjects/Sieve/SOGoSieveBaseObject.m b/SOGo/SoObjects/Sieve/SOGoSieveBaseObject.m new file mode 100644 index 00000000..80b97ac6 --- /dev/null +++ b/SOGo/SoObjects/Sieve/SOGoSieveBaseObject.m @@ -0,0 +1,72 @@ +/* + Copyright (C) 2004 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. +*/ + +#include "SOGoSieveBaseObject.h" +#include +#include +#include "common.h" +#include +#include +#include + +@implementation SOGoSieveBaseObject + +/* hierarchy */ + +- (SOGoMailAccount *)mailAccountFolder { + if (![[self container] respondsToSelector:_cmd]) { + [self logWithFormat:@"WARNING: weird container of mailfolder: %@", + [self container]]; + return nil; + } + + return [[self container] mailAccountFolder]; +} + +/* IMAP4 */ + +- (SOGoMailManager *)mailManager { + return [[self mailAccountFolder] mailManager]; +} +- (NSURL *)imap4URL { + return [[self mailAccountFolder] imap4URL]; +} + +- (NSString *)imap4Password { + return [[self mailAccountFolder] imap4Password]; +} + +- (NGImap4Client *)imap4Client { + return [[self mailAccountFolder] imap4Client]; +} + +- (void)flushMailCaches { +} + +/* debugging */ + +- (NSString *)loggingPrefix { + /* improve perf ... */ + return [NSString stringWithFormat:@"<0x%08X[%@]:%@>", + self, NSStringFromClass([self class]), + [self nameInContainer]]; +} +@end /* SOGoSieveBaseObject */ diff --git a/SOGo/SoObjects/Sieve/SOGoSieveScriptObject.h b/SOGo/SoObjects/Sieve/SOGoSieveScriptObject.h new file mode 100644 index 00000000..7f8fcf8f --- /dev/null +++ b/SOGo/SoObjects/Sieve/SOGoSieveScriptObject.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2004 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 __Sieve_SOGoSieveScriptObject_H__ +#define __Sieve_SOGoSieveScriptObject_H__ + +#include "SOGoSieveBaseObject.h" + +/* + SOGoSieveScriptObject + + Parent object: SOGoSieveScriptsFolder + Child objects: none + + The SOGoSieveScriptObject represents a single sieve script on a Cyrus folder. +*/ + +@interface SOGoSieveScriptObject : SOGoSieveBaseObject +{ +} + + +@end + +#endif /* __Sieve_SOGoSieveScriptObject_H__ */ diff --git a/SOGo/SoObjects/Sieve/SOGoSieveScriptObject.m b/SOGo/SoObjects/Sieve/SOGoSieveScriptObject.m new file mode 100644 index 00000000..301d79b7 --- /dev/null +++ b/SOGo/SoObjects/Sieve/SOGoSieveScriptObject.m @@ -0,0 +1,27 @@ +/* + Copyright (C) 2004 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. +*/ + +#include "SOGoSieveScriptObject.h" +#include "common.h" + +@implementation SOGoSieveScriptObject + +@end /* SOGoSieveScriptObject */ diff --git a/SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.h b/SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.h new file mode 100644 index 00000000..008ec217 --- /dev/null +++ b/SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2004 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 __Sieve_SOGoSieveScriptsFolder_H__ +#define __Sieve_SOGoSieveScriptsFolder_H__ + +#include "SOGoSieveBaseObject.h" + +/* + SOGoSieveScriptsFolder + + Parent object: the SOGoMailAccount + Child objects: SOGoSieveScriptObject + + The SOGoSieveScriptsFolder represents a list of sieve scripts on a Cyrus + server. +*/ + +@interface SOGoSieveScriptsFolder : SOGoSieveBaseObject +{ +} + + +@end + +#endif /* __Sieve_SOGoSieveScriptsFolder_H__ */ diff --git a/SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.m b/SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.m new file mode 100644 index 00000000..1165641e --- /dev/null +++ b/SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.m @@ -0,0 +1,27 @@ +/* + Copyright (C) 2004 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. +*/ + +#include "SOGoSieveScriptsFolder.h" +#include "common.h" + +@implementation SOGoSieveScriptsFolder + +@end /* SOGoSieveScriptsFolder */ diff --git a/SOGo/SoObjects/Sieve/Version b/SOGo/SoObjects/Sieve/Version new file mode 100644 index 00000000..e2e93a0f --- /dev/null +++ b/SOGo/SoObjects/Sieve/Version @@ -0,0 +1,5 @@ +# Version file + +SUBMINOR_VERSION:=1 + +# v0.9.1 requires libNGMime v4.3.194 diff --git a/SOGo/SoObjects/Sieve/common.h b/SOGo/SoObjects/Sieve/common.h new file mode 100644 index 00000000..a33aeedc --- /dev/null +++ b/SOGo/SoObjects/Sieve/common.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2004 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. +*/ +// $Id: common.h 335 2004-09-29 23:24:45Z helge $ + +#import +#import + +#if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY +# include +# include +#endif + +#include +#include +#include + +#include + +#include diff --git a/SOGo/SoObjects/Sieve/product.plist b/SOGo/SoObjects/Sieve/product.plist new file mode 100644 index 00000000..83ed3e0d --- /dev/null +++ b/SOGo/SoObjects/Sieve/product.plist @@ -0,0 +1,23 @@ +{ + requires = ( MAIN, Mailer ); + + publicResources = ( + ); + + factories = { + }; + + classes = { + SOGoSieveBaseObject = { + superclass = "SOGoObject"; + }; + + SOGoSieveScriptsFolder = { + superclass = "SOGoSieveBaseObject"; + }; + + SOGoSieveScriptObject = { + superclass = "SOGoSieveBaseObject"; + }; + }; +} -- 2.39.5