From 321d8eb2e755f516b31ec1a182fa365f310c182f Mon Sep 17 00:00:00 2001 From: helge Date: Wed, 30 Jun 2004 07:48:53 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/trunk@91 d1b88da0-ebda-0310-925b-ed51d893ca5b --- OGoContentStore/OCSFolder.m | 2 +- SOGo/GNUmakefile | 8 +++ SOGo/Main/GNUmakefile | 18 ++++++ SOGo/Main/GNUmakefile.preamble | 7 +++ SOGo/Main/Version | 3 + SOGo/Main/common.h | 34 +++++++++++ SOGo/Main/product.plist | 18 ++++++ SOGo/Main/sogod.m | 108 +++++++++++++++++++++++++++++++++ 8 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 SOGo/GNUmakefile create mode 100644 SOGo/Main/GNUmakefile create mode 100644 SOGo/Main/GNUmakefile.preamble create mode 100644 SOGo/Main/Version create mode 100644 SOGo/Main/common.h create mode 100644 SOGo/Main/product.plist create mode 100644 SOGo/Main/sogod.m diff --git a/OGoContentStore/OCSFolder.m b/OGoContentStore/OCSFolder.m index cdf7e505..d906925b 100644 --- a/OGoContentStore/OCSFolder.m +++ b/OGoContentStore/OCSFolder.m @@ -214,7 +214,7 @@ static BOOL debugOn = YES; return nil; } - // TODO + // TODO: gen SQL, execute in transactions [self releaseChannel:storeChannel]; [self releaseChannel:quickChannel]; diff --git a/SOGo/GNUmakefile b/SOGo/GNUmakefile new file mode 100644 index 00000000..9f9e51c8 --- /dev/null +++ b/SOGo/GNUmakefile @@ -0,0 +1,8 @@ +# $Id$ + +include $(GNUSTEP_MAKEFILES)/common.make + +SUBPROJECTS = \ + Main + +include $(GNUSTEP_MAKEFILES)/aggregate.make diff --git a/SOGo/Main/GNUmakefile b/SOGo/Main/GNUmakefile new file mode 100644 index 00000000..f376df0a --- /dev/null +++ b/SOGo/Main/GNUmakefile @@ -0,0 +1,18 @@ +# $Id: GNUmakefile,v 1.13 2004/06/08 11:41:13 helge Exp $ + +include $(GNUSTEP_MAKEFILES)/common.make + +WOAPP_NAME = sogod + +sogod_OBJC_FILES += \ + sogod.m + +sogod_RESOURCE_FILES += \ + Version \ + product.plist \ + +sogod_WEBSERVER_RESOURCE_FILES += + +-include GNUmakefile.preamble +include $(GNUSTEP_MAKEFILES)/woapp.make +-include GNUmakefile.postamble diff --git a/SOGo/Main/GNUmakefile.preamble b/SOGo/Main/GNUmakefile.preamble new file mode 100644 index 00000000..f842ddcc --- /dev/null +++ b/SOGo/Main/GNUmakefile.preamble @@ -0,0 +1,7 @@ +# $Id$ + +ADDITIONAL_TOOL_LIBS += \ + -lSOGoLogic \ + -lOGoContentStore \ + -lGDLAccess \ + -ljs diff --git a/SOGo/Main/Version b/SOGo/Main/Version new file mode 100644 index 00000000..1b77c541 --- /dev/null +++ b/SOGo/Main/Version @@ -0,0 +1,3 @@ +# $Id: Version,v 1.1 2003/11/24 01:24:40 helge Exp $ + +SUBMINOR_VERSION:=1 diff --git a/SOGo/Main/common.h b/SOGo/Main/common.h new file mode 100644 index 00000000..ea6a4dbf --- /dev/null +++ b/SOGo/Main/common.h @@ -0,0 +1,34 @@ +/* + 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$ + +#import + +#if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY +# include +# include +#endif + +#include +#include +#include + +#include diff --git a/SOGo/Main/product.plist b/SOGo/Main/product.plist new file mode 100644 index 00000000..f8c27189 --- /dev/null +++ b/SOGo/Main/product.plist @@ -0,0 +1,18 @@ +{ + publicResources = ( + ); + + classes = { + SOGo = { + superclass = "SoApplication"; + protectedBy = "View"; + defaultAccess = "allow"; + defaultRoles = { + "View" = "Anonymous"; + "WebDAV Access" = "Authenticated"; + }; + methods = { + }; + }; + }; +} diff --git a/SOGo/Main/sogod.m b/SOGo/Main/sogod.m new file mode 100644 index 00000000..d48fda25 --- /dev/null +++ b/SOGo/Main/sogod.m @@ -0,0 +1,108 @@ +/* + 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. +*/ +// $Id$ + +#include + +@interface SOGo : SoApplication +{ +} + +@end + +#include "common.h" + +@implementation SOGo + +- (id)init { + if ((self = [super init])) { + } + return self; +} + +/* name lookup */ + +- (BOOL)isUserName:(NSString *)_key inContext:(id)_ctx { + if ([_key length] < 1) + return NO; + + if (isdigit([_key characterAtIndex:0])) + return NO; + + return YES; +} + +- (id)lookupUser:(NSString *)_key inContext:(id)_ctx { + //return [DSoUser dUserWithName:hostName port:port]; + return nil; +} + +- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag { + id obj; + + /* first check attributes directly bound to the application */ + if ((obj = [super lookupName:_key inContext:_ctx acquire:_flag])) + return obj; + + /* + The problem is, that at this point we still get request for resources, + eg 'favicon.ico'. + The hack here is to check for a dot in the key, but we should find a way + to catch that in a more sensible way. + + One way to check for a valid key would be to check whether the key is a + valid hostname, but I would like to avoid that for performance reasons. + + Addition: we also get queries for various other methods, like "GET" if + no method was provided in the query path. + */ + if ([self isUserName:_key inContext:_ctx]) + return [self lookupUser:_key inContext:_ctx]; + + return nil; +} + +/* exception handling */ + +- (WOResponse *)handleException:(NSException *)_exc + inContext:(WOContext *)_ctx +{ + printf("EXCEPTION: %s\n", [[_exc description] cString]); + abort(); +} + +@end /* SOGo */ + + +int main(int argc, char **argv, char **env) { + NSAutoreleasePool *pool; + + pool = [[NSAutoreleasePool alloc] init]; +#if LIB_FOUNDATION_LIBRARY + [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; +#endif + [NGBundleManager defaultBundleManager]; + + WOWatchDogApplicationMain(@"SOGo", argc, (void*)argv); + + [pool release]; + return 0; +} -- 2.39.5