include ./Version
LIBRARY_NAME = libOGoContentStore
-TOOL_NAME = ocs_ls ocs_mkdir
+TOOL_NAME = ocs_ls ocs_mkdir ocs_cat
libOGoContentStore_HEADER_FILES += \
NSURL+OCS.h \
ocs_ls_OBJC_FILES += ocs_ls.m
ocs_mkdir_OBJC_FILES += ocs_mkdir.m
+ocs_cat_OBJC_FILES += ocs_cat.m
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/library.make
ocs_ls_TOOL_LIBS += $(OCS_TOOL_LIBS)
ocs_mkdir_TOOL_LIBS += $(OCS_TOOL_LIBS)
+ocs_cat_TOOL_LIBS += $(OCS_TOOL_LIBS)
ADDITIONAL_INCLUDE_DIRS += -I. -I..
- (NSArray *)subFolderNames;
- (NSArray *)allSubFolderNames;
+- (NSString *)fetchContentWithName:(NSString *)_name;
+
@end
#endif /* __OGoContentStore_OCSFolder_H__ */
recursive:YES];
}
+- (NSString *)fetchContentWithName:(NSString *)_name {
+ EOAdaptorChannel *channel;
+ NSException *error;
+ NSDictionary *row;
+ NSArray *attrs;
+ NSString *result;
+ NSString *sql;
+
+ if ((channel = [self acquireStoreChannel]) == nil) {
+ [self logWithFormat:@"ERROR(%s): could not open storage channel!"];
+ return nil;
+ }
+
+ /* generate SQL */
+
+ sql = @"SELECT \"c_content\" FROM ";
+ sql = [sql stringByAppendingString:[self storeTableName]];
+ sql = [sql stringByAppendingString:@" WHERE \"c_name\" = '"];
+ sql = [sql stringByAppendingString:_name];
+ sql = [sql stringByAppendingString:@"'"];
+
+ /* run SQL */
+
+ if ((error = [channel evaluateExpressionX:sql]) != nil) {
+ [self logWithFormat:@"ERROR(%s): cannot execute blob-fetch SQL '%@': %@",
+ __PRETTY_FUNCTION__, sql, error];
+ [self releaseChannel:channel];
+ return nil;
+ }
+
+ /* fetch results */
+
+ result = nil;
+ attrs = [channel describeResults];
+ if ((row = [channel fetchAttributes:attrs withZone:NULL]) != nil) {
+ result = [[[row objectForKey:@"cContent"] copy] autorelease];
+ if (![result isNotNull]) result = nil;
+ [channel cancelFetch];
+ }
+
+ /* release and return result */
+
+ [self releaseChannel:channel];
+ return result;
+}
+
/* description */
- (NSString *)description {
/* run SQL */
- if ((ex = [channel evaluateExpressionX:_sql])) {
+ if ((ex = [channel evaluateExpressionX:_sql]) != nil) {
+ [self logWithFormat:@"ERROR(%s): cannot execute SQL '%@': %@",
+ __PRETTY_FUNCTION__, _sql, ex];
[self releaseChannel:channel];
return nil;
}
attrs = [channel describeResults];
rows = [NSMutableArray arrayWithCapacity:16];
- while ((row = [channel fetchAttributes:attrs withZone:NULL]))
+ while ((row = [channel fetchAttributes:attrs withZone:NULL]) != nil)
[rows addObject:row];
[self releaseChannel:channel];
--- /dev/null
+BEGIN:VEVENT\r
+DURATION:PT1H\r
+ATTENDEE;CN="Elke Bethke";DIR="addressbook://B156F3F0-9CFD-11D8-8561-000\r
+ D93C1A604:ABPerson":mailto:E.Bethke@Sachsen-Anhalt-Lotto.de\r
+ATTENDEE;CN="Erik Doernenburg";DIR="addressbook://B15FCB0F-9CFD-11D8-8561\r
+ -000D93C1A604:ABPerson":mailto:erik@x101.net\r
+ATTENDEE;CN="Christian Schnelle";DIR="addressbook://B1418D4E-9CFD-11D8-8\r
+ 561-000D93C1A604:ABPerson":mailto:cs@enervation.de\r
+ATTENDEE;CN="Chris Herrenberger";DIR="addressbook://B14A390C-9CFD-11D8-8\r
+ 561-000D93C1A604:ABPerson":invalid:nomail\r
+ATTENDEE;CN="Horst Parplies";DIR="addressbook://B19B47E5-9CFD-11D8-8561-\r
+ 000D93C1A604:ABPerson":mailto:horst.parplies@freenet.de\r
+ATTENDEE;CN="Imdat Solak";DIR="addressbook://B19EDB62-9CFD-11D8-8561-000\r
+ D93C1A604:ABPerson":mailto:imdat@solak.de\r
+ATTENDEE;CN="Jens Enders";DIR="addressbook://B1B6819F-9CFD-11D8-8561-000\r
+ D93C1A604:ABPerson":mailto:jens.enders@skyrix.com\r
+ATTENDEE;CN="Jens Muenster";DIR="addressbook://B1BBA42E-9CFD-11D8-8561-00\r
+ 0D93C1A604:ABPerson":mailto:jens.muenster@skyrix.com\r
+ATTENDEE;CN="Laurent Pierre";DIR="addressbook://9337C270-A825-11D8-B930-\r
+ 000D93C1A604:ABPerson":mailto:laurent.pierre@linagora.com\r
+ATTENDEE;CN="Marcel Weiher";DIR="addressbook://B1F9BB12-9CFD-11D8-8561-0\r
+ 00D93C1A604:ABPerson":mailto:marcel@metaobject.co\r
+DTSTAMP:20040520T140002Z\r
+UID:BD91C454-AA65-11D8-84CA-000D93C1A604\r
+SEQUENCE:3\r
+STATUS:CONFIRMED\r
+DTSTART;TZID=Europe/Berlin:20040618T160000\r
+SUMMARY:SIZE EVENT\r
+X-WR-ITIPSTATUSML:UNCLEAN\r
+END:VEVENT\r
--- /dev/null
+// $Id$
+
+#import <Foundation/NSObject.h>
+
+@class NSUserDefaults;
+@class OCSFolderManager;
+
+@interface Tool : NSObject
+{
+ NSUserDefaults *ud;
+ OCSFolderManager *folderManager;
+}
+
++ (int)run;
+
+@end
+
+#include <OGoContentStore/OCSFolder.h>
+#include <OGoContentStore/OCSFolderManager.h>
+#include "common.h"
+
+@implementation Tool
+
+- (id)init {
+ if ((self = [super init])) {
+ self->ud = [[NSUserDefaults standardUserDefaults] retain];
+ self->folderManager = [[OCSFolderManager defaultFolderManager] retain];
+ }
+ return self;
+}
+- (void)dealloc {
+ [self->ud release];
+ [self->folderManager release];
+ [super dealloc];
+}
+
+/* operation */
+
+- (int)runOnPath:(NSString *)_path {
+ OCSFolder *folder;
+ NSString *dirname, *filename;
+ NSString *content;
+
+ dirname = [_path stringByDeletingLastPathComponent];
+ filename = [_path lastPathComponent];
+
+ if ((folder = [self->folderManager folderAtPath:dirname]) == nil) {
+ [self logWithFormat:@"did not find folder for file: '%@'", dirname];
+ return 1;
+ }
+
+ if ((content = [folder fetchContentWithName:filename]) == nil) {
+ [self logWithFormat:@"did not find file: '%@'", _path];
+ return 1;
+ }
+
+ printf("%s\n", [content cString]);
+
+ return 0;
+}
+
+- (int)run {
+ NSEnumerator *e;
+ NSString *path;
+
+ [self logWithFormat:@"manager: %@", self->folderManager];
+
+ if (![self->folderManager canConnect]) {
+ [self logWithFormat:@"cannot connect folder-info database!"];
+ return 1;
+ }
+
+ e = [[[NSProcessInfo processInfo] argumentsWithoutDefaults]
+ objectEnumerator];
+ [e nextObject]; // skip tool name
+
+ while ((path = [e nextObject]))
+ [self runOnPath:path];
+
+ return 0;
+}
++ (int)run {
+ return [(Tool *)[[[self alloc] init] autorelease] run];
+}
+
+@end /* Tool */
+
+int main(int argc, char **argv, char **env) {
+ NSAutoreleasePool *pool;
+ int rc;
+
+ pool = [[NSAutoreleasePool alloc] init];
+#if LIB_FOUNDATION_LIBRARY
+ [NSProcessInfo initializeWithArguments:argv count:argc environment:env];
+#endif
+
+ rc = [Tool run];
+
+ [pool release];
+ return rc;
+}
--- /dev/null
+-- $Id$
+--
+-- (C) 2004 SKYRIX Software AG
+--
+
+DELETE FROM SOGo_helge_privcal
+ WHERE c_name = 'BD91C454-AA65-11D8-84CA-000D93C1A604';
+DELETE FROM SOGo_helge_privcal_quick
+ WHERE c_name = 'BD91C454-AA65-11D8-84CA-000D93C1A604';
+
+
+
+INSERT INTO SOGo_helge_privcal
+ ( c_name, c_creationdate, c_lastmodified, c_version, c_content )
+VALUES (
+ 'BD91C454-AA65-11D8-84CA-000D93C1A604',
+ 928383,
+ 928383,
+ 1,
+
+ 'BEGIN:VEVENT\r
+DURATION:PT1H\r
+ATTENDEE;CN="Elke Bethke";DIR="addressbook://B156F3F0-9CFD-11D8-8561-000\r
+ D93C1A604:ABPerson":mailto:E.Bethke@Sachsen-Anhalt-Lotto.de\r
+ATTENDEE;CN="Erik Doernenburg";DIR="addressbook://B15FCB0F-9CFD-11D8-8561\r
+ -000D93C1A604:ABPerson":mailto:erik@x101.net\r
+ATTENDEE;CN="Christian Schnelle";DIR="addressbook://B1418D4E-9CFD-11D8-8\r
+ 561-000D93C1A604:ABPerson":mailto:cs@enervation.de\r
+ATTENDEE;CN="Chris Herrenberger";DIR="addressbook://B14A390C-9CFD-11D8-8\r
+ 561-000D93C1A604:ABPerson":invalid:nomail\r
+ATTENDEE;CN="Horst Parplies";DIR="addressbook://B19B47E5-9CFD-11D8-8561-\r
+ 000D93C1A604:ABPerson":mailto:horst.parplies@freenet.de\r
+ATTENDEE;CN="Imdat Solak";DIR="addressbook://B19EDB62-9CFD-11D8-8561-000\r
+ D93C1A604:ABPerson":mailto:imdat@solak.de\r
+ATTENDEE;CN="Jens Enders";DIR="addressbook://B1B6819F-9CFD-11D8-8561-000\r
+ D93C1A604:ABPerson":mailto:jens.enders@skyrix.com\r
+ATTENDEE;CN="Jens Muenster";DIR="addressbook://B1BBA42E-9CFD-11D8-8561-00\r
+ 0D93C1A604:ABPerson":mailto:jens.muenster@skyrix.com\r
+ATTENDEE;CN="Laurent Pierre";DIR="addressbook://9337C270-A825-11D8-B930-\r
+ 000D93C1A604:ABPerson":mailto:laurent.pierre@linagora.com\r
+ATTENDEE;CN="Marcel Weiher";DIR="addressbook://B1F9BB12-9CFD-11D8-8561-0\r
+ 00D93C1A604:ABPerson":mailto:marcel@metaobject.co\r
+DTSTAMP:20040520T140002Z\r
+UID:BD91C454-AA65-11D8-84CA-000D93C1A604\r
+SEQUENCE:3\r
+STATUS:CONFIRMED\r
+DTSTART;TZID=Europe/Berlin:20040618T160000\r
+SUMMARY:SIZE EVENT\r
+X-WR-ITIPSTATUSML:UNCLEAN\r
+END:VEVENT\r
+'
+);
+
+INSERT INTO SOGo_helge_privcal_quick
+ ( c_name, uid, startdate, enddate, title, participants )
+VALUES (
+ 'BD91C454-AA65-11D8-84CA-000D93C1A604',
+ 'BD91C454-AA65-11D8-84CA-000D93C1A604',
+ 8928837,
+ 8929000,
+ 'SIZE EVENT',
+ 'Elke Bethke, Erik Doernenburg, Christian Schnelle, Chris Herrenberger, Horst Parplies, Imdat Solak, Jens Enders, Jens Muenster, Laurent Pierre, Marcel Weiher'
+);