From: helge Date: Fri, 20 Aug 2004 18:51:49 +0000 (+0000) Subject: deleted moved files (not sure what went wrong before ...) X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3b6028a37c0ea5ed149622b1ae7985d68666c2e;p=sope deleted moved files (not sure what went wrong before ...) git-svn-id: http://svn.opengroupware.org/SOPE/trunk@10 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-core/samples/ImapListTool.h b/sope-core/samples/ImapListTool.h deleted file mode 100644 index 4c37d8bb..00000000 --- a/sope-core/samples/ImapListTool.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2000-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$ - -#ifndef __ImapListTool_H__ -#define __ImapListTool_H__ - -#import "ImapTool.h" - -@class NSArray; - -/* - Supported Args: - -statistics YES|NO (print statistics, parsing time, memory) - -datasource YES|NO (use datasource or directoryContentsAtPath:) - -preloops (loop n-times before running the actual fetch) -*/ - -@interface ImapListTool : ImapTool -{ - BOOL useDataSource; - int preloops; - BOOL stats; -} - -- (int)runWithArguments:(NSArray *)_args; - -@end - -#endif /* __ImapListTool_H__ */ diff --git a/sope-core/samples/ImapListTool.m b/sope-core/samples/ImapListTool.m deleted file mode 100644 index ad2b7b6a..00000000 --- a/sope-core/samples/ImapListTool.m +++ /dev/null @@ -1,341 +0,0 @@ -/* - Copyright (C) 2000-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 "ImapListTool.h" -#include "common.h" -#include -#include -#include -#include - -@implementation ImapListTool - -/* output */ - -- (BOOL)outputResultsAsList:(NSArray *)dirContents - fileManager:(NGImap4FileManager *)fm part:(NSString *)_part -{ - unsigned i, count; - NSString *path = [fm currentDirectoryPath]; - - for (i = 0, count = [dirContents count]; i < count; i++) { - NSString *cpath, *apath; - NSDictionary *info; - NSString *mid; - - if (!self->useDataSource) { - cpath = [dirContents objectAtIndex:i]; - apath = [path stringByAppendingPathComponent:cpath]; - - info = [fm fileAttributesAtPath:apath - traverseLink:NO]; - } - else { - info = [dirContents objectAtIndex:i]; - cpath = [NSString stringWithFormat:@"%u", [(id)info uid]]; - apath = [path stringByAppendingPathComponent:cpath]; - //cpath = [info valueForKey:@"NSFileName"]; - //apath = [info valueForKey:@"NSFilePath"]; - } - - mid = [[info valueForKey:@"NSFileIdentifier"] description]; - if ([mid length] > 39) { - mid = [mid substringToIndex:37]; - mid = [mid stringByAppendingString:@"..."]; - } - - /* id uid date name */ - if (_part) { - printf("%10d ", - [[fm contentsAtPath:[info valueForKey:@"NSFilePath"] - part:_part] length]); - } - printf("%-40s %8s %8i %-32s %s", - [mid cString], - [[info valueForKey:NSFileOwnerAccountName] cString], - [[info valueForKey:NSFileSize] intValue], - [[[info valueForKey:NSFileModificationDate] - description] cString], - [apath cString]); - - if ([[info valueForKey:NSFileType] - isEqualToString:NSFileTypeDirectory]) - printf("/\n"); - else - printf("\n"); - - - } - return YES; -} - -- (BOOL)outputResultsAsXML:(NSArray *)_dirContents - fileManager:(NGFileManager *)_fm -{ - NSLog(@"XML output not implemented ..."); - return NO; -} - -- (BOOL)outputResults:(NSArray *)dirContents - fileManager:(NGImap4FileManager *)fm part:(NSString *)_part -{ - NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; - NSAutoreleasePool *pool; - NSString *out; - BOOL result; - - pool = [[NSAutoreleasePool alloc] init]; - - out = [ud stringForKey:@"out"]; - if ([out length] == 0) - result = YES; - else if ([out isEqualToString:@"xml"]) - result = [self outputResultsAsXML:dirContents fileManager:fm]; - else if ([out isEqualToString:@"ls"]) - result = [self outputResultsAsList:dirContents fileManager:fm part:_part]; - else { - NSLog(@"unknown output module: %@", out); - result = NO; - } - [pool release]; - return result; -} - -/* ops */ - -- (void)processFile:(NSString *)path fileManager:(NGImap4FileManager *)fm - part:(NSString *)_part -{ - /* a file */ - NSData *contents; - NSString *s; - - if (_part) { - if ((contents = [fm contentsAtPath:path part:_part]) == nil) { - NSLog(@"could not get content of message: '%@'", path); - } - else { - s = [[NSString alloc] initWithData:contents - encoding:[NSString defaultCStringEncoding]]; - printf("%s\n", [s cString]); - [s release]; - } - } - else { - NGImap4Message *contents; - - if ((contents = [fm messageAtPath:path]) == nil) { - NSLog(@"could not get message at path: '%@'", path); - } - else { -#if 0 - s = [[NSString alloc] initWithData:contents - encoding:[NSString defaultCStringEncoding]]; - printf("%s\n", [s cString]); - [s release]; -#else - printf("%s\n", [[contents description] cString]); - printf("%s\n", [[[contents bodyStructure] description] cString]); - -#endif - } - } -} - -- (void)processFolder:(NSString *)path fileManager:(NGImap4FileManager *)fm - part:(NSString *)_part -{ - NSAutoreleasePool *pool; - NSTimeInterval startTime, endTime; - unsigned int startSize, endSize; - NSProcessInfo *pi = [NSProcessInfo processInfo]; - NSArray *dirContents; - unsigned i; - EODataSource *ds; - - if (![fm changeCurrentDirectoryPath:path]) { - NSLog(@"%s: could not change to directory: '%@'", path); - } - - ds = self->useDataSource - ? [(id)fm dataSourceAtPath:path] - : nil; - - /* pre fetches */ - - for (i = 0; i < self->preloops; i++ ) { - NSAutoreleasePool *pool; - - startTime = [[NSDate date] timeIntervalSince1970]; - startSize = [pi virtualMemorySize]; - - /* fetch */ - - pool = [[NSAutoreleasePool alloc] init]; - { - ds = self->useDataSource - ? [(id)fm dataSourceAtPath:path] - : nil; - - dirContents = (!self->useDataSource) - ? [fm directoryContentsAtPath:path] - : [ds fetchObjects]; - } - [pool release]; - - /* statistics */ - - endSize = [pi virtualMemorySize]; - endTime = [[NSDate date] timeIntervalSince1970]; - - if (self->stats) { - fprintf(stderr, - "parsing time [%2i]: %.3fs, " - "vmem-diff: %8i (%4iK,%4iM), vmem: %8i (%4iK,%4iM))\n", - i, (endTime-startTime), - (endSize - startSize), - (endSize - startSize) / 1024, - (endSize - startSize) / 1024 / 1024, - endSize, endSize/1024, endSize/1024/1024); - } - } - - /* actual fetch */ - - startTime = [[NSDate date] timeIntervalSince1970]; - startSize = [pi virtualMemorySize]; - - pool = [[NSAutoreleasePool alloc] init]; - - ds = self->useDataSource - ? [(id)fm dataSourceAtPath:path] - : nil; - - dirContents = (!self->useDataSource) - ? [fm directoryContentsAtPath:path] - : [ds fetchObjects]; - - dirContents = [dirContents retain]; - [pool release]; - dirContents = [dirContents autorelease]; - - /* statistics */ - - endSize = [pi virtualMemorySize]; - endTime = [[NSDate date] timeIntervalSince1970]; - - if (self->stats) { - fprintf(stderr, - "parsing time: %.3fs, " - "vmem-diff: %8i (%4iK,%4iM), vmem: %8i (%4iK,%4iM))\n", - (endTime-startTime), - (endSize - startSize), - (endSize - startSize) / 1024, - (endSize - startSize) / 1024 / 1024, - endSize, endSize/1024, endSize/1024/1024); - } - - /* output */ - [self outputResults:dirContents fileManager:fm part:_part]; -} - -/* - path /INBOX/1233?part=1.2 -*/ - - -- (void)processPath:(NSString *)path fileManager:(NGImap4FileManager *)fm { - BOOL isDir; - NSArray *array; - NSString *part; - - array = [path componentsSeparatedByString:@"?"]; - - if ([array count] > 1) { - path = [array objectAtIndex:0]; - part = [[[array objectAtIndex:1] componentsSeparatedByString:@"="] - lastObject]; - } - else - part = nil; - - if (![fm fileExistsAtPath:path isDirectory:&isDir]) { - NSLog(@"file/directory does not exist: %@", path); - return; - } - - if (isDir) { - [self processFolder:path fileManager:fm part:part]; - } - else { - [self processFile:path fileManager:fm part:part]; - } -} - -/* tool operation */ - -- (int)usage { - fprintf(stderr, "usage: imapls ?part=\n"); - fprintf(stderr, "usage: imapls \n"); - fprintf(stderr, " -url \n"); - fprintf(stderr, " -user \n"); - fprintf(stderr, " -password \n"); - fprintf(stderr, " -host \n"); - fprintf(stderr, " -datasource YES|NO\n"); - fprintf(stderr, " -out ls|xml\n"); - fprintf(stderr, " -statistics YES|NO\n"); - fprintf(stderr, " -preloops \n"); - return 1; -} - -- (int)runWithArguments:(NSArray *)_args { - NGImap4FileManager *fm; - NSUserDefaults *ud; - int i; - - _args = [_args subarrayWithRange:NSMakeRange(1, [_args count] - 1)]; - if ([_args count] == 0) - return [self usage]; - - ud = [NSUserDefaults standardUserDefaults]; - - self->useDataSource = [ud boolForKey:@"datasource"]; - self->stats = [ud boolForKey:@"statistics"]; - self->preloops = [ud integerForKey:@"preloops"]; - - if ((fm = [self fileManager]) == nil) { - NSLog(@"could not open IMAP connection (got no filemanager)"); - return 2; - } - -#if 1 - NSLog(@"IMAP: %@", fm); -#endif - - for (i = 0; i < [_args count]; i++) { - [self processPath:[_args objectAtIndex:i] fileManager:fm]; - } - - return 0; -} - -@end /* ImapListTool */ diff --git a/sope-core/samples/ImapQuotaTool.h b/sope-core/samples/ImapQuotaTool.h deleted file mode 100644 index ad9025d9..00000000 --- a/sope-core/samples/ImapQuotaTool.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2000-2003 SKYRIX Software AG - - This file is part of OGo - - 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 "ImapTool.h" - -@class NSString, NSDictionary; - -@interface ImapQuotaTool : ImapTool -{ -} - -- (NSDictionary *)getQuotaRoot:(NSString *)_folder; - -@end diff --git a/sope-core/samples/ImapQuotaTool.m b/sope-core/samples/ImapQuotaTool.m deleted file mode 100644 index cfcf6089..00000000 --- a/sope-core/samples/ImapQuotaTool.m +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2000-2003 SKYRIX Software AG - - This file is part of OGo - - 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 -#include -#include -#include "common.h" -#include "ImapQuotaTool.h" - -@implementation ImapQuotaTool - -- (NSDictionary *)getQuotaRoot:(NSString *)_folder { - NGImap4FileManager *fm; - NGImap4Client *client; - - fm = [self fileManager]; - client = [[fm imapContext] client]; - - return [[client getQuotaRoot:_folder] objectForKey:@"quotas"]; - -} - -@end /* ImapQuotaTool */ diff --git a/sope-core/samples/ImapTool.h b/sope-core/samples/ImapTool.h deleted file mode 100644 index 33b86c3c..00000000 --- a/sope-core/samples/ImapTool.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (C) 2000-2003 SKYRIX Software AG - - This file is part of OGo - - 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$ - -#ifndef __ImapTool_H__ -#define __ImapTool_H__ - -#import - -@class NGImap4FileManager; - -@interface ImapTool : NSObject -{ - NGImap4FileManager *fileManager; -} -- (void)flush; -- (NGImap4FileManager *)fileManager; - -@end - -#endif /* __ImapTool_H__ */ diff --git a/sope-core/samples/ImapTool.m b/sope-core/samples/ImapTool.m deleted file mode 100644 index df974cea..00000000 --- a/sope-core/samples/ImapTool.m +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2000-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 "ImapTool.h" -#include -#include "common.h" - -@implementation ImapTool - -- (void)flush { - [self->fileManager release]; self->fileManager = nil; -} - -- (NGImap4FileManager *)fileManager { - NSUserDefaults *ud; - NSString *pwd, *user, *host; - id url; - - if (self->fileManager) - return self->fileManager; - - ud = [NSUserDefaults standardUserDefaults]; - - if ((url = [ud stringForKey:@"url"])) - url = [NSURL URLWithString:url]; - - if ((user = [ud stringForKey:@"user"]) == nil) - user = [url user]; - if ((pwd = [ud stringForKey:@"password"]) == nil) - pwd = [url password]; - if ((host = [ud stringForKey:@"host"]) == nil) - host = [(NSURL *)url host]; - - self->fileManager = [[NGImap4FileManager alloc] initWithUser:user - password:pwd - host:host]; - if (self->fileManager == nil) { - if (user == nil) NSLog(@"missing login."); - if (pwd == nil) NSLog(@"missing password."); - if (host == nil) NSLog(@"missing host."); - } - - return self->fileManager; -} - -@end /* ImapTool */ diff --git a/sope-core/samples/ical2.m b/sope-core/samples/ical2.m deleted file mode 100644 index e7c66dd9..00000000 --- a/sope-core/samples/ical2.m +++ /dev/null @@ -1,155 +0,0 @@ -/* - Copyright (C) 2000-2003 SKYRIX Software AG - - This file is part of OGo - - 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 -#include - -@interface iCal2Tool : NSObject -{ - id parser; - SaxObjectDecoder *sax; -} - -- (int)runWithArguments:(NSArray *)_args; - -@end - -@implementation iCal2Tool - -- (id)init { - if ((self = [super init])) { - self->parser = - [[[SaxXMLReaderFactory standardXMLReaderFactory] - createXMLReaderForMimeType:@"text/calendar"] - retain]; - if (self->parser == nil) { - NSLog(@"%s: did not find a parser for text/calendar !", - __PRETTY_FUNCTION__); - [self release]; - return nil; - } - - /* ensure that NGiCal.xmap can be found ! (Library/SaxMappings) */ - self->sax = [[SaxObjectDecoder alloc] initWithMappingNamed:@"NGiCal"]; - if (self->sax == nil) { - NSLog(@"could not create the iCal SAX handler !"); - [self release]; - return nil; - } - - [self->parser setContentHandler:self->sax]; - [self->parser setErrorHandler:self->sax]; - } - return self; -} -- (void)dealloc { - [self->sax release]; - [self->parser release]; - [super dealloc]; -} - -/* parsing */ - -- (id)parseFile:(NSString *)_path { - if ([_path length] == 0) return nil; - - _path = [@"file://" stringByAppendingString:_path]; - - [self->parser parseFromSystemId:_path]; - - return [self->sax rootObject]; -} - -- (void)printParsedObject:(id)_object { - NSLog(@"component: %@", _object); -#if 0 - NSLog(@" subcomponents: %@", [_object subComponents]); - - printf("%s", [[_object icalString] cString]); -#endif -} - -/* run */ - -- (int)runWithArguments:(NSArray *)_args { - NSEnumerator *args; - NSString *arg; - - args = [_args objectEnumerator]; - [args nextObject]; // process name ... - - while ((arg = [args nextObject])) { - NSAutoreleasePool *pool2; - - if ([arg hasPrefix:@"-"]) { /* consume defaults */ - [args nextObject]; - continue; - } - - pool2 = [[NSAutoreleasePool alloc] init]; - { - id component; - - NS_DURING - component = [self parseFile:arg]; - NS_HANDLER - abort(); - NS_ENDHANDLER; - - if (component == nil) - NSLog(@"could not parse file: '%@'", arg); - else - [self printParsedObject:component]; - } - [pool2 release]; - } - return 0; -} - -@end /* iCal2Tool */ - -int main(int argc, char **argv, char **env) { - NSAutoreleasePool *pool; - iCal2Tool *tool; - int rc; - -#if LIB_FOUNDATION_LIBRARY - [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; -#endif - - pool = [[NSAutoreleasePool alloc] init]; - - if ((tool = [[iCal2Tool alloc] init])) { - NS_DURING - rc = [tool runWithArguments:[[NSProcessInfo processInfo] arguments]]; - NS_HANDLER - abort(); - NS_ENDHANDLER; - - [tool release]; - } - else - rc = 1; - - [pool release]; - return rc; -} diff --git a/sope-core/samples/ical3.m b/sope-core/samples/ical3.m deleted file mode 100644 index deccf791..00000000 --- a/sope-core/samples/ical3.m +++ /dev/null @@ -1,165 +0,0 @@ -/* - Copyright (C) 2000-2003 SKYRIX Software AG - - This file is part of OGo - - 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 - -@class EOQualifier, NSString, EOSortOrdering; - -@interface iCal3Tool : NSObject -{ - EOQualifier *qualifier; - NSString *entityName; - NSArray *sortOrderings; -} - -- (int)runWithArguments:(NSArray *)_args; - -@end - -#include -#include -#include -#include -#include "common.h" - -@implementation iCal3Tool - -- (id)init { - if ((self = [super init])) { - NSUserDefaults *ud; - id tmp; - - /* collect options */ - ud = [NSUserDefaults standardUserDefaults]; - - self->entityName = [[ud stringForKey:@"entity"] copy]; - - if ((tmp = [ud objectForKey:@"qualifier"])) - self->qualifier = [[EOQualifier alloc] initWithPropertyList:tmp]; - - if ((tmp = [ud objectForKey:@"sort"])) { - if ((tmp = [[EOSortOrdering alloc] initWithPropertyList:tmp])) { - self->sortOrderings = [[NSArray alloc] initWithObjects:tmp,nil]; - [tmp release]; - } - } - } - return self; -} -- (void)dealloc { - [self->sortOrderings release]; - [self->qualifier release]; - [self->entityName release]; - [super dealloc]; -} - -/* run */ - -- (void)printObject:(id)_object { - printf("object: %s\n", [[_object description] cString]); -} - -- (int)runWithArguments:(NSArray *)_args { - NSEnumerator *args; - NSString *arg; - - /* begin processing */ - - args = [_args objectEnumerator]; - [args nextObject]; // process name ... - - while ((arg = [args nextObject])) { - NSAutoreleasePool *pool2; - - if ([arg hasPrefix:@"-"]) { /* consume defaults */ - [args nextObject]; - continue; - } - - pool2 = [[NSAutoreleasePool alloc] init]; - { - iCalDataSource *ds; - EOFetchSpecification *fspec; - NSArray *objs; - iCalObject *obj; - - /* setup fetch specification */ - - fspec = [[[EOFetchSpecification alloc] init] autorelease]; - [fspec setEntityName:self->entityName]; - [fspec setQualifier:self->qualifier]; - - /* setup datasource */ - - ds = [[[iCalDataSource alloc] initWithPath:arg] autorelease]; - [ds setFetchSpecification:fspec]; - - /* perform fetch */ - - if ((objs = [ds fetchObjects]) == nil) { - /* fetch failed */ - - NSLog(@"fetch on ical file failed: %@", arg); - } - else { - /* process results */ - NSEnumerator *e; - - e = [objs objectEnumerator]; - while ((obj = [e nextObject])) { - [self printObject:obj]; - } - } - } - [pool2 release]; - } - return 0; -} - -@end /* iCal3Tool */ - -int main(int argc, char **argv, char **env) { - NSAutoreleasePool *pool; - iCal3Tool *tool; - int rc; - -#if LIB_FOUNDATION_LIBRARY - [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; -#endif - - pool = [[NSAutoreleasePool alloc] init]; - - if ((tool = [[iCal3Tool alloc] init])) { - NS_DURING - rc = [tool runWithArguments:[[NSProcessInfo processInfo] arguments]]; - NS_HANDLER - abort(); - NS_ENDHANDLER; - - [tool release]; - } - else - rc = 1; - - [pool release]; - return rc; -} diff --git a/sope-core/samples/imap_tool.m b/sope-core/samples/imap_tool.m deleted file mode 100644 index 397bf3ab..00000000 --- a/sope-core/samples/imap_tool.m +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (C) 2000-2003 SKYRIX Software AG - - This file is part of OGo - - 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 "common.h" -#include "NGImap4.h" - - -int main(int argc, char **argv, char **env) { - NSAutoreleasePool *pool; - -#if LIB_FOUNDATION_LIBRARY - [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; -#endif - - pool = [[NSAutoreleasePool alloc] init]; - - { - NSString *login, *pwd, *host; - NSUserDefaults *ud; - NGImap4Client *client; - - ud = [NSUserDefaults standardUserDefaults]; - - if (!(login = [ud stringForKey:@"login"])) { - login = @"j"; - } - if (!(pwd = [ud stringForKey:@"pwd"])) { - pwd = @"system"; - } - if (!(host = [ud stringForKey:@"host"])) { - host = @"defiant"; - } - - client = [NGImap4Client clientWithHost:host]; - - [client login:login password:pwd]; - NSLog(@"client %@", client); - - { - int cnt = 0; - - while (1) { - NSString *action; - NSString *arg; - id result; - - action = [ud stringForKey: - [NSString stringWithFormat:@"action_%d", cnt]]; - arg = [ud stringForKey: - [NSString stringWithFormat:@"arg_%d", cnt]]; - - if (![action length]) - break; - - if ([action isEqualToString:@"select"]) { - result = [client select:arg]; - } - else if ([action isEqualToString:@"thread"]) { - result = [client threadBySubject:[arg boolValue] charset:nil]; - } - else if ([action isEqualToString:@"list"]) { - result = [client list:arg pattern:@"*"]; - } - else if ([action isEqualToString:@"fetch"]) { - NSArray *args; - - args = [arg componentsSeparatedByString:@":"]; - result = [client fetchFrom:[[args objectAtIndex:0] intValue] - to:[[args objectAtIndex:1] intValue] - parts:[args subarrayWithRange: - NSMakeRange(2,[args count] - 2)]]; - } - NSLog(@"action %d: %@:%@ : %@", cnt, action, arg, - result); - cnt++; - } - } - } - [pool release]; - return 0; -} - diff --git a/sope-core/samples/imapls.m b/sope-core/samples/imapls.m deleted file mode 100644 index 5e6e6f26..00000000 --- a/sope-core/samples/imapls.m +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2000-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$ - -/* - scan through imap folders/messages using the NGImap4FileManager -*/ - -#include "ImapListTool.h" -#include "common.h" - -int main(int argc, char **argv, char **env) { - NSAutoreleasePool *pool; - ImapListTool *tool; - int res; - - pool = [NSAutoreleasePool new]; -#if LIB_FOUNDATION_LIBRARY - [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; -#endif - - tool = [[ImapListTool alloc] init]; - res = [tool runWithArguments: - [[NSProcessInfo processInfo] argumentsWithoutDefaults]]; - [tool release]; - - [pool release]; - exit(0); - /* static linking */ - [NGExtensions class]; - return 0; -} diff --git a/sope-core/samples/imapquota.m b/sope-core/samples/imapquota.m deleted file mode 100644 index 6c036733..00000000 --- a/sope-core/samples/imapquota.m +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2000-2003 SKYRIX Software AG - - This file is part of OGo - - 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 "ImapQuotaTool.h" -#include "common.h" - -int main(int argc, char **argv, char **env) { - NSAutoreleasePool *pool; - ImapTool *tool; - int res = 0; - - pool = [NSAutoreleasePool new]; - -#if LIB_FOUNDATION_LIBRARY - [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; -#endif - - tool = [[ImapQuotaTool alloc] init]; - - { - NSString *str; - - str = [[NSUserDefaults standardUserDefaults] objectForKey:@"path"]; - NSLog(@"quota for path: %@", str); - NSLog(@"result %@", [tool getQuotaRoot:str]); - } - [tool release]; - - [pool release]; - exit(res); - /* static linking */ - [NGExtensions class]; - return res; -} diff --git a/sope-core/samples/ldap2dsml.m b/sope-core/samples/ldap2dsml.m deleted file mode 100644 index 7733220b..00000000 --- a/sope-core/samples/ldap2dsml.m +++ /dev/null @@ -1,366 +0,0 @@ -/* - Copyright (C) 2000-2003 SKYRIX Software AG - - This file is part of OGo - - 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 -#import -#import -#import -#import -#include "common.h" - -@interface DSMLSaxProducer : NSObject -{ - id contentHandler; - id errorHandler; -} - -- (void)setContentHandler:(id)_handler; -- (void)setErrorHandler:(id)_handler; - -- (void)produceOnConnection:(NGLdapConnection *)_con dn:(NSString *)_dn; - -@end - -static NSString *XMLNS_DSML = @"http://wwww.dsml.org/DSML"; - -@implementation DSMLSaxProducer - -- (void)dealloc { - [self->errorHandler release]; - [self->contentHandler release]; - [super dealloc]; -} - -- (void)setContentHandler:(id)_handler { - ASSIGN(self->contentHandler, _handler); -} -- (void)setErrorHandler:(id)_handler { - ASSIGN(self->errorHandler, _handler); -} - -- (void)_produceAttribute:(NGLdapAttribute *)_attribute - ofEntry:(NGLdapEntry *)_entry -{ - SaxAttributes *attrs; - - attrs = [[SaxAttributes alloc] init]; - - [attrs addAttribute:@"name" uri:XMLNS_DSML rawName:@"name" - type:@"CDATA" - value:[_attribute attributeName]]; - - [self->contentHandler - startElement:@"attr" - namespace:XMLNS_DSML - rawName:@"attr" - attributes:attrs]; - - [attrs release]; attrs = nil; - - /* encode values */ - { - NSEnumerator *values; - NSString *value; - - values = [_attribute stringValueEnumerator]; - while ((value = [values nextObject])) { - unsigned len; - unichar *chars; - - if ((len = [value length]) == 0) - continue; - - chars = calloc(len + 1, sizeof(unichar)); - [value getCharacters:chars]; - - [self->contentHandler - startElement:@"value" - namespace:XMLNS_DSML - rawName:@"value" - attributes:nil]; - - [self->contentHandler characters:chars length:len]; - - if (chars) free(chars); - - [self->contentHandler - endElement:@"value" - namespace:XMLNS_DSML - rawName:@"value"]; - } - } - - [self->contentHandler - endElement:@"attr" - namespace:XMLNS_DSML - rawName:@"attr"]; -} - -- (void)_produceObjectClassOfEntry:(NGLdapEntry *)_entry { - NGLdapAttribute *attr; - - if ((attr = [_entry attributeWithName:@"objectclass"]) == nil) - return; - - [self->contentHandler - startElement:@"objectclass" - namespace:XMLNS_DSML - rawName:@"objectclass" - attributes:nil]; - - /* encode values */ - { - NSEnumerator *values; - NSString *value; - - values = [attr stringValueEnumerator]; - while ((value = [values nextObject])) { - unsigned len; - unichar *chars; - - if ((len = [value length]) == 0) - continue; - - chars = calloc(len + 1, sizeof(unichar)); - [value getCharacters:chars]; - - [self->contentHandler - startElement:@"objectclass" - namespace:XMLNS_DSML - rawName:@"objectclass" - attributes:nil]; - - [self->contentHandler characters:chars length:len]; - - if (chars) free(chars); - - [self->contentHandler - endElement:@"objectclass" - namespace:XMLNS_DSML - rawName:@"objectclass"]; - } - } - - [self->contentHandler - endElement:@"objectclass" - namespace:XMLNS_DSML - rawName:@"objectclass"]; -} - -- (void)_produceEntry:(NGLdapEntry *)_entry { - SaxAttributes *attrs; - NSEnumerator *names; - NSString *cname; - - attrs = [[SaxAttributes alloc] init]; - - [attrs addAttribute:@"dn" uri:XMLNS_DSML rawName:@"dn" - type:@"CDATA" - value:[_entry dn]]; - - [self->contentHandler - startElement:@"entry" - namespace:XMLNS_DSML - rawName:@"entry" - attributes:attrs]; - - [attrs release]; attrs = nil; - - /* attributes */ - - [self _produceObjectClassOfEntry:_entry]; - - names = [[_entry attributeNames] objectEnumerator]; - while ((cname = [names nextObject])) { - NGLdapAttribute *attr; - - if ([cname isEqualToString:@"objectclass"]) - continue; - - if ((attr = [_entry attributeWithName:cname])) - [self _produceAttribute:attr ofEntry:_entry]; - } - - [self->contentHandler - endElement:@"entry" - namespace:XMLNS_DSML - rawName:@"entry"]; -} - -- (void)_produceEntries:(NSEnumerator *)_entries { - NGLdapEntry *entry; - - [self->contentHandler - startElement:@"directory-entries" - namespace:XMLNS_DSML - rawName:@"directory-entries" - attributes:nil]; - - while ((entry = [_entries nextObject])) - [self _produceEntry:entry]; - - [self->contentHandler - endElement:@"directory-entries" - namespace:XMLNS_DSML - rawName:@"directory-entries"]; -} - -- (void)produceOnConnection:(NGLdapConnection *)_con dn:(NSString *)_dn { - [self->contentHandler startDocument]; - [self->contentHandler startPrefixMapping:@"" uri:XMLNS_DSML]; - - [self->contentHandler - startElement:@"dsml" - namespace:XMLNS_DSML - rawName:@"dsml" - attributes:nil]; - - [self _produceEntries:[_con flatSearchAtBaseDN:_dn - qualifier:nil - attributes:nil]]; - - [self->contentHandler endElement:@"dsml" namespace:XMLNS_DSML rawName:@"dsml"]; - - [self->contentHandler endPrefixMapping:@""]; - [self->contentHandler endDocument]; -} - -@end /* DSMLSaxProducer */ - -#import - -@interface DSMLSaxOutputter : SaxDefaultHandler -{ - int level; -} -@end - -@implementation DSMLSaxOutputter - -- (void)startElement:(NSString *)_localName - namespace:(NSString *)_ns - rawName:(NSString *)_rawName - attributes:(id)_attrs -{ - int i, count; - - level++; - for (i = 0; i < level; i++) - printf(" "); - printf("\n"); -} - -- (void)endElement:(NSString *)_localName - namespace:(NSString *)_ns - rawName:(NSString *)_rawName -{ - int i; - for (i = 0; i < level; i++) - printf(" "); - printf("\n", [_localName cString]); - level--; -} - -- (void)characters:(unichar *)_chars length:(int)_len { - int i; - NSString *s; - - for (i = 0; i < level + 1; i++) - printf(" "); - - s = [[NSString alloc] initWithCharacters:_chars length:_len]; - printf("%s\n", [s cString]); - [s release]; -} - -@end /* DSMLSaxOutputter */ - -#import - -int main(int argc, char **argv, char **env) { - NSAutoreleasePool *pool; - NSUserDefaults *ud; - NSArray *args; - DSMLSaxProducer *cpu; - DSMLSaxOutputter *out; - - pool = [[NSAutoreleasePool alloc] init]; -#if LIB_FOUNDATION_LIBRARY - [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; -#endif - - args = [[NSProcessInfo processInfo] arguments]; - if ([args count] < 1) { - NSLog(@"usage: %@ ", [args objectAtIndex:0]); - exit(1); - } - else if ([args count] == 1) - args = [args arrayByAddingObject:@"."]; - - ud = [NSUserDefaults standardUserDefaults]; - - cpu = [[DSMLSaxProducer alloc] init]; - out = [[DSMLSaxOutputter alloc] init]; - [cpu setContentHandler:out]; - [cpu setErrorHandler:out]; - -#if 0 - fm = [[NGLdapFileManager alloc] - initWithHostName:[ud stringForKey:@"LDAPHost"] - port:0 - bindDN:[ud stringForKey:@"LDAPBindDN"] - credentials:[ud stringForKey:@"LDAPPassword"] - rootDN:[ud stringForKey:@"LDAPRootDN"]]; - fm = [fm autorelease]; -#endif - - { - NGLdapConnection *con; - - con = [[NGLdapConnection alloc] - initWithHostName:[ud stringForKey:@"LDAPHost"] - port:0]; - [con bindWithMethod:@"simple" - binddn:[ud stringForKey:@"LDAPBindDN"] - credentials:[ud stringForKey:@"LDAPPassword"]]; - - [cpu produceOnConnection:con - dn:[ud stringForKey:@"LDAPRootDN"]]; - - [con release]; - } - [pool release]; - exit(0); - return 0; -} diff --git a/sope-core/samples/ldapchkpwd.m b/sope-core/samples/ldapchkpwd.m deleted file mode 100644 index feaaa7ca..00000000 --- a/sope-core/samples/ldapchkpwd.m +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2000-2003 SKYRIX Software AG - - This file is part of OGo - - 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 -#import -#include "common.h" - -int main(int argc, char **argv, char **env) { - NSAutoreleasePool *pool; - NSUserDefaults *ud; - NSArray *args; - BOOL ok = NO; - -#if LIB_FOUNDATION_LIBRARY - [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; -#endif - - pool = [[NSAutoreleasePool alloc] init]; - - args = [[NSProcessInfo processInfo] arguments]; - if ([args count] < 3) { - NSLog(@"usage: %@ ", [args objectAtIndex:0]); - exit(1); - } - - ud = [NSUserDefaults standardUserDefaults]; - - ok = [NGLdapConnection checkPassword:[args objectAtIndex:2] - ofLogin:[args objectAtIndex:1] - atBaseDN:[ud stringForKey:@"LDAPRootDN"] - onHost:[ud stringForKey:@"LDAPHost"] - port:0]; - if (ok) - printf("authenticated successfully.\n"); - else - printf("did not authenticate !\n"); - - [pool release]; - - exit(0); - return 0; -} diff --git a/sope-core/samples/ldapls.m b/sope-core/samples/ldapls.m deleted file mode 100644 index 9ae1ce64..00000000 --- a/sope-core/samples/ldapls.m +++ /dev/null @@ -1,156 +0,0 @@ -/* - Copyright (C) 2000-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 -#include -#include "common.h" - -int main(int argc, char **argv, char **env) { - NSAutoreleasePool *pool; - NSUserDefaults *ud; - NSArray *args; - NSFileManager *fm; - unsigned i; - BOOL doDeep = NO; - - pool = [[NSAutoreleasePool alloc] init]; -#if LIB_FOUNDATION_LIBRARY - [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; -#endif - - args = [[NSProcessInfo processInfo] arguments]; - if ([args count] < 1) { - NSLog(@"usage: %@ ", [args objectAtIndex:0]); - exit(1); - } - else if ([args count] == 1) - args = [args arrayByAddingObject:@"."]; - - ud = [NSUserDefaults standardUserDefaults]; - - fm = [[NGLdapFileManager alloc] - initWithHostName:[ud stringForKey:@"LDAPHost"] - port:0 - bindDN:[ud stringForKey:@"LDAPBindDN"] - credentials:[ud stringForKey:@"LDAPPassword"] - rootDN:[ud stringForKey:@"LDAPRootDN"]]; - fm = [fm autorelease]; - - if (fm == nil) { - NSLog(@"could not open LDAP connection (got no filemanager)."); - exit(2); - } - - // NSLog(@"LDAP: %@", fm); - - for (i = 1; i < [args count]; i++) { - NSString *path; - BOOL isDir; - - path = [args objectAtIndex:i]; - - if ([path hasPrefix:@"-r"]) { - doDeep = YES; - continue; - } - - if ([path hasPrefix:@"-"]) { - i++; - continue; - } - - if (![fm fileExistsAtPath:path isDirectory:&isDir]) { - NSLog(@"file/directory does not exist: %@", path); - continue; - } - - if (isDir) { - NSArray *dirContents; - unsigned i, count; - NSString *mid; - - dirContents = doDeep - ? [fm subpathsAtPath:path] - : [fm directoryContentsAtPath:path]; - - for (i = 0, count = [dirContents count]; i < count; i++) { - NSString *cpath, *apath; - NSDictionary *info; - NSString *owner; - NSString *date; - - cpath = [dirContents objectAtIndex:i]; - apath = [path stringByAppendingPathComponent:cpath]; - - info = [fm fileAttributesAtPath:apath - traverseLink:NO]; - - mid = [[info objectForKey:@"NSFileIdentifier"] description]; - if ([mid length] > 39) { - mid = [mid substringToIndex:37]; - mid = [mid stringByAppendingString:@"..."]; - } - - owner = [info objectForKey:NSFileOwnerAccountName]; - date = [[info objectForKey:NSFileModificationDate] description]; - - if (owner == nil) - owner = @"-"; - if (date == nil) - date = @"-"; - - /* id uid date name */ - printf("%-34s %20s %-32s %s", - [mid cString], - [owner cString], - [date cString], - [apath cString]); - - if ([[info objectForKey:NSFileType] - isEqualToString:NSFileTypeDirectory]) - printf("/\n"); - else - printf("\n"); - } - } - else { - /* a file */ - NSData *contents; - NSString *s; - - if ((contents = [fm contentsAtPath:path]) == nil) { - NSLog(@"could not get content of record: '%@'", path); - } - else { - s = [[NSString alloc] initWithData:contents - encoding:[NSString defaultCStringEncoding]]; - printf("%s\n", [s cString]); - [s release]; - } - } - } - - [pool release]; - - exit(0); - return 0; -}