From 1e0b9ca8d9f8a4233de644eebf37a66ec0716398 Mon Sep 17 00:00:00 2001 From: helge Date: Thu, 17 Feb 2005 14:38:57 +0000 Subject: [PATCH] removed SOGoLogic git-svn-id: http://svn.opengroupware.org/SOGo/trunk@578 d1b88da0-ebda-0310-925b-ed51d893ca5b --- GNUmakefile | 4 +- SOGoLogic/AgenorUserManager.h | 54 --- SOGoLogic/AgenorUserManager.m | 509 ------------------------ SOGoLogic/COPYING | 482 ---------------------- SOGoLogic/COPYRIGHT | 4 - SOGoLogic/ChangeLog | 4 + SOGoLogic/GNUmakefile | 28 -- SOGoLogic/GNUmakefile.preamble | 10 - SOGoLogic/NSString+iCal.h | 32 -- SOGoLogic/SOGoAppointment.h | 134 ------- SOGoLogic/SOGoAppointment.m | 443 --------------------- SOGoLogic/SOGoAppointmentICalRenderer.h | 46 --- SOGoLogic/SOGoAppointmentICalRenderer.m | 250 ------------ SOGoLogic/SOGoLRUCache.h | 44 -- SOGoLogic/SOGoLRUCache.m | 114 ------ SOGoLogic/common.h | 26 -- 16 files changed, 5 insertions(+), 2179 deletions(-) delete mode 100644 SOGoLogic/AgenorUserManager.h delete mode 100644 SOGoLogic/AgenorUserManager.m delete mode 100644 SOGoLogic/COPYING delete mode 100644 SOGoLogic/COPYRIGHT delete mode 100644 SOGoLogic/GNUmakefile delete mode 100644 SOGoLogic/GNUmakefile.preamble delete mode 100644 SOGoLogic/NSString+iCal.h delete mode 100644 SOGoLogic/SOGoAppointment.h delete mode 100644 SOGoLogic/SOGoAppointment.m delete mode 100644 SOGoLogic/SOGoAppointmentICalRenderer.h delete mode 100644 SOGoLogic/SOGoAppointmentICalRenderer.m delete mode 100644 SOGoLogic/SOGoLRUCache.h delete mode 100644 SOGoLogic/SOGoLRUCache.m delete mode 100644 SOGoLogic/common.h diff --git a/GNUmakefile b/GNUmakefile index 80992041..069122c6 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,11 +1,9 @@ -# $Id$ +# GNUstep makefile include $(GNUSTEP_MAKEFILES)/common.make SUBPROJECTS = \ OGoContentStore \ - SOGoLogic \ SOGo \ - include $(GNUSTEP_MAKEFILES)/aggregate.make diff --git a/SOGoLogic/AgenorUserManager.h b/SOGoLogic/AgenorUserManager.h deleted file mode 100644 index ce35647e..00000000 --- a/SOGoLogic/AgenorUserManager.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2000-2004 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 __AgenorUserManager_H_ -#define __AgenorUserManager_H_ - - -#import - -@class SOGoLRUCache; - -@interface AgenorUserManager : NSObject -{ - SOGoLRUCache *cnCache; - SOGoLRUCache *serverCache; - SOGoLRUCache *uidCache; - SOGoLRUCache *emailCache; -} - -+ (id)sharedUserManager; - -- (NSString *)getUIDForEmail:(NSString *)_email; -- (NSString *)getEmailForUID:(NSString *)_uid; - -/* i.e. BUTTO Hercule, CETE Lyon/DI/ET/TEST */ -- (NSString *)getCNForUID:(NSString *)_uid; -/* i.e. hercule.butto@amelie-ida01.melanie2.i2 */ -- (NSString *)getIMAPAccountStringForUID:(NSString *)_uid; -/* i.e. amelie-ida01.melanie2.i2 */ -- (NSString *)getServerForUID:(NSString *)_uid; - -@end - -#endif /* __AgenorUserManager_H_ */ diff --git a/SOGoLogic/AgenorUserManager.m b/SOGoLogic/AgenorUserManager.m deleted file mode 100644 index f44dfdea..00000000 --- a/SOGoLogic/AgenorUserManager.m +++ /dev/null @@ -1,509 +0,0 @@ -/* - Copyright (C) 2000-2004 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 "AgenorUserManager.h" -#include -#include -#include "SOGoLRUCache.h" - -@interface AgenorUserManager (PrivateAPI) -- (NGLdapConnection *)ldapConnection; - -- (void)_cacheCN:(NSString *)_cn forUID:(NSString *)_uid; -- (NSString *)_cachedCNForUID:(NSString *)_uid; -- (void)_cacheServer:(NSString *)_server forUID:(NSString *)_uid; -- (NSString *)_cachedServerForUID:(NSString *)_uid; -- (void)_cacheEmail:(NSString *)_email forUID:(NSString *)_uid; -- (NSString *)_cachedEmailForUID:(NSString *)_uid; -- (void)_cacheUID:(NSString *)_uid forEmail:(NSString *)_email; -- (NSString *)_cachedUIDForEmail:(NSString *)_email; - -@end - - -@implementation AgenorUserManager - -static BOOL debugOn = NO; -static BOOL useLDAP = NO; -static NSString *ldapHost = nil; -static NSString *ldapBaseDN = nil; - -+ (void)initialize { - static BOOL didInit = NO; - NSUserDefaults *ud; - - if(didInit) - return; - didInit = YES; - ud = [NSUserDefaults standardUserDefaults]; - debugOn = [ud boolForKey:@"SOGoUserManagerDebugEnabled"]; - useLDAP = [ud boolForKey:@"SOGoUserManagerUsesLDAP"]; - if(useLDAP) { - ldapHost = [[ud stringForKey:@"SOGoLDAPHost"] retain]; - ldapBaseDN = [[ud stringForKey:@"SOGoLDAPBaseDN"] retain]; - } -} - -+ (id)sharedUserManager { - static id mgr = nil; - if(mgr == nil) { - mgr = [[self alloc] init]; - } - return mgr; -} - -- (id)init { - self = [super init]; - if(self) { - self->serverCache = [[SOGoLRUCache alloc] initWithCacheSize:10000]; - self->cnCache = [[SOGoLRUCache alloc] initWithCacheSize:10000]; - self->uidCache = [[SOGoLRUCache alloc] initWithCacheSize:10000]; - self->emailCache = [[SOGoLRUCache alloc] initWithCacheSize:10000]; - } - return self; -} - -- (void)dealloc { - [self->serverCache release]; - [self->cnCache release]; - [self->uidCache release]; - [self->emailCache release]; - [super dealloc]; -} - -- (NGLdapConnection *)ldapConnection { - static NGLdapConnection *ldapConnection = nil; - if(!ldapConnection) { - ldapConnection = [[NGLdapConnection alloc] initWithHostName:ldapHost]; -#if 0 - [ldapConnection setUseCache:YES]; -#endif - } - return ldapConnection; -} - - -/* private cache helpers */ - -- (void)_cacheCN:(NSString *)_cn forUID:(NSString *)_uid { - [self->cnCache addObject:_cn forKey:_uid]; -} - -- (NSString *)_cachedCNForUID:(NSString *)_uid { - return [self->cnCache objectForKey:_uid]; -} - -- (void)_cacheServer:(NSString *)_server forUID:(NSString *)_uid { - [self->serverCache addObject:_server forKey:_uid]; -} - -- (NSString *)_cachedServerForUID:(NSString *)_uid { - return [self->serverCache objectForKey:_uid]; -} - -- (void)_cacheEmail:(NSString *)_email forUID:(NSString *)_uid { - [self->emailCache addObject:_email forKey:_uid]; -} - -- (NSString *)_cachedEmailForUID:(NSString *)_uid { - return [self->emailCache objectForKey:_uid]; -} - -- (void)_cacheUID:(NSString *)_uid forEmail:(NSString *)_email { - [self->uidCache addObject:_uid forKey:_email]; -} - -- (NSString *)_cachedUIDForEmail:(NSString *)_email { - return [self->uidCache objectForKey:_email]; -} - - -/* uid <-> email mapping */ - -/* - UPDATE: the email excerpt below has been marked by Maxime as being - wrong. This algorithm can not be expected to work, thus - the mapping has been replaced with an LDAP query. - - --- snip --- - The uid field is in bijection this the email adress : - this field can be construct from the email. Email are uniques. - - So, we can use email adresse from identifier. - The field is made like this : - _ if the email is equipement.gouv.fr then the login - is the part before the @ - for example : fisrtName.lastName - _ if the email is not equipement.gouv.fr then the login - is the full email adress where @ is change to . (dot) - for example : fisrtName.lastName.subDomain.domain.tld - --- snap --- - - NOTE: mapping email -> uid is easy, but can also generate uid's not known - to the system (i.e. for private addressbook entries, obvious). - The reverse mapping can work _only_ if "firstName.lastname." is - guaranteed, because the second dot would be mapped to '@'. This - is probably error prone. - Only LDAP fetches would guarantee correctness in both cases. -*/ - -- (NSString *)getUIDForEmail:(NSString *)_email { - if(useLDAP) { - static NSArray *uidAttrs = nil; - NGLdapConnection *conn; - EOQualifier *q; - NSEnumerator *resultEnum; - NGLdapEntry *entry; - NGLdapAttribute *uidAttr; - NSString *uid; - - if(!uidAttrs) { - uidAttrs = [[NSArray alloc] initWithObjects:@"uid", nil]; - } - - if((uid = [self _cachedUIDForEmail:_email])) - return uid; - - q = [EOQualifier qualifierWithQualifierFormat:@"mail = %@", _email]; - - conn = [self ldapConnection]; - resultEnum = [conn deepSearchAtBaseDN:ldapBaseDN - qualifier:q - attributes:uidAttrs]; - entry = [resultEnum nextObject]; - if(!entry) { - if(debugOn) { - [self logWithFormat:@"%s Didn't find LDAP entry for email '%@'!", - __PRETTY_FUNCTION__, - _email]; - } - return nil; - } - uidAttr = [entry attributeWithName:@"uid"]; - if (!uidAttr) - return nil; /* can happen, not unlikely */ - uid = [uidAttr stringValueAtIndex:0]; - [self _cacheUID:uid forEmail:_email]; - return uid; - } - else { - NSRange r; - NSString *domain; - - if(!_email || [_email length] == 0) - return nil; - - r = [_email rangeOfString:@"@"]; - if(r.length == 0) - return nil; - domain = [_email substringFromIndex:NSMaxRange(r)]; - if(![domain isEqualToString:@"equipement.gouv.fr"]) - return _email; - return [_email substringToIndex:r.location]; - } -} - -- (NSString *)getEmailForUID:(NSString *)_uid { - if(useLDAP) { - static NSArray *emailAttrs = nil; - NGLdapConnection *conn; - EOQualifier *q; - NSEnumerator *resultEnum; - NGLdapEntry *entry; - NGLdapAttribute *emailAttr; - NSString *email; - - if(!emailAttrs) { - emailAttrs = [[NSArray alloc] initWithObjects:@"mineqMelmailEmission", nil]; - } - - if((email = [self _cachedEmailForUID:_uid])) - return email; - - q = [EOQualifier qualifierWithQualifierFormat:@"uid = %@", _uid]; - - conn = [self ldapConnection]; - resultEnum = [conn deepSearchAtBaseDN:ldapBaseDN - qualifier:q - attributes:emailAttrs]; - entry = [resultEnum nextObject]; - if(!entry) { - if(debugOn) { - [self logWithFormat:@"%s Didn't find LDAP entry for uid '%@'!", - __PRETTY_FUNCTION__, - _uid]; - } - return nil; - } - emailAttr = [entry attributeWithName:@"mineqMelmailEmission"]; - if (!emailAttr) { - return nil; /* shit happens */ - } - else { - unsigned count; - - email = nil; - count = [emailAttr count]; -#if 0 - if (count > 1) { - unsigned i; - - /* in case there are multiple email addresses, select the first - which doesn't have '@equipement.gouv.fr' in it */ - for (i = 0; i < count; i++) { - NSString *candidate; - - candidate = [emailAttr stringValueAtIndex:i]; - if (![candidate hasSuffix:@"@equipement.gouv.fr"]) { - email = candidate; - break; - } - } - } -#endif - if (email == nil && count > 0) { - email = [emailAttr stringValueAtIndex:0]; - } - [self _cacheEmail:email forUID:_uid]; - return email; - } - } - else { - NSRange r; - - if(!_uid || [_uid length] == 0) - return nil; - r = [_uid rangeOfString:@"@"]; - if(r.length > 0) - return _uid; - return [NSString stringWithFormat:@"%@@equipement.gouv.fr", _uid]; - } -} - - -/* CN */ - -- (NSString *)getCNForUID:(NSString *)_uid { - if(useLDAP) { - static NSArray *cnAttrs = nil; - NGLdapConnection *conn; - EOQualifier *q; - NSEnumerator *resultEnum; - NGLdapEntry *entry; - NGLdapAttribute *cnAttr; - NSString *cn; - - if(!cnAttrs) { - cnAttrs = [[NSArray alloc] initWithObjects:@"cn", nil]; - } - - if((cn = [self _cachedCNForUID:_uid])) - return cn; - - q = [EOQualifier qualifierWithQualifierFormat:@"uid = %@", _uid]; - - conn = [self ldapConnection]; - resultEnum = [conn deepSearchAtBaseDN:ldapBaseDN - qualifier:q - attributes:cnAttrs]; - entry = [resultEnum nextObject]; - if(!entry) { - if(debugOn) { - [self logWithFormat:@"%s Didn't find LDAP entry for uid '%@'!", - __PRETTY_FUNCTION__, - _uid]; - } - return nil; - } - cnAttr = [entry attributeWithName:@"cn"]; - if(!cnAttr && debugOn) { - [self logWithFormat:@"%s LDAP entry for uid '%@' has no common name?", - __PRETTY_FUNCTION__, - _uid]; - return nil; /* nothing we can do about it */ - } - cn = [cnAttr stringValueAtIndex:0]; - [self _cacheCN:cn forUID:_uid]; - return cn; - } - else { - NSString *s; - NSRange r; - - s = _uid; - if ([s length] < 10) - return s; - - // TODO: algorithm might be inappropriate, depends on the actual UID - r = [s rangeOfString:@"."]; - if (r.length == 0) - return s; - - return [s substringToIndex:r.location]; - } -} - - -/* Servers, IMAP */ - -- (NSString *)getIMAPAccountStringForUID:(NSString *)_uid { - NSString *server; - - server = [self getServerForUID:_uid]; - if(!server) - return nil; - return [NSString stringWithFormat:@"%@@%@", _uid, server]; -} - -- (NSString *)getServerForUID:(NSString *)_uid { - /* - First of all : for a particular user IMAP and SMTP are served on the same - host. - - The name of the machine is determined by applying a regex on every values of - the mineqMelRoutage LDAP attribute. - The regex is : .*%.*@(.*\.melanie2\.i2$) - It extracts the substring that follows '@', ends with 'melanie2', on - adresses which have a '%' before the '@' - - Example: helge.hesse%opengroupware.org@servername1.melanie2.i2 - -> servername1.melanie2.i2 - - If only one server name is found by applying the regex on every value of the - attribute, then this name is the IMAP/SMTP server for that user. - Note that this is the case when we got a unique (well formed) value for the - attribute. - If the regex finds more than one servername when applied to the differents - values, then the IMAP/SMTP server name is to be found in the - mineqMelServeurPrincipal attribute of the user. - */ - if(useLDAP) { - static NSArray *attrs = nil; - NGLdapConnection *conn; - EOQualifier *q; - NSEnumerator *resultEnum; - NGLdapEntry *entry; - NGLdapAttribute *attr; - NSMutableArray *serverCandidates; - NSString *server; - - if(!attrs) { - attrs = [[NSArray alloc] initWithObjects:@"mineqMelRoutage", - @"mineqMelServeurPrincipal", - nil]; - } - - if((server = [self _cachedServerForUID:_uid])) - return server; - - q = [EOQualifier qualifierWithQualifierFormat:@"uid = %@", _uid]; - - conn = [self ldapConnection]; - resultEnum = [conn deepSearchAtBaseDN:ldapBaseDN - qualifier:q - attributes:attrs]; - /* we just expect one entry, thus drop the rest */ - entry = [resultEnum nextObject]; - if(!entry) { - if(debugOn) { - NSLog(@"%s Didn't find LDAP entry for uid '%@'!", - __PRETTY_FUNCTION__, - _uid); - } - return nil; - } - attr = [entry attributeWithName:@"mineqMelRoutage"]; - if(attr) { - unsigned i, count; - - count = [attr count]; - serverCandidates = [NSMutableArray arrayWithCapacity:count]; - for(i = 0; i < count; i++) { - NSRange r; - NSString *route; - - route = [attr stringValueAtIndex:i]; - r = [route rangeOfString:@".melanie2.i2" options:NSBackwardsSearch]; - if(r.length > 0) { - unsigned length; - - /* be clever */ - length = [route length]; - r = NSMakeRange(0, length - r.length); - r = [route rangeOfString:@"@" options:NSBackwardsSearch range:r]; - if(r.length > 0) { - unsigned start; - NSRange serverNameRange; - - start = NSMaxRange(r); - serverNameRange = NSMakeRange(start, length - start); - r = NSMakeRange(0, length - start); - r = [route rangeOfString:@"%" options:NSBackwardsSearch range:r]; - if(r.length > 0) { - NSString *serverName; - - serverName = [route substringWithRange:serverNameRange]; - [serverCandidates addObject:serverName]; - } - } - } - } - } - else { - if(debugOn) { - NSLog(@"%s LDAP entry for uid '%@' has no mineqMelRoutage entry?", - __PRETTY_FUNCTION__, - _uid); - } - serverCandidates = nil; - } - if([serverCandidates count] == 1) { - server = [serverCandidates objectAtIndex:0]; - } - - /* last resort */ - if(!server) { - attr = [entry attributeWithName:@"mineqMelServeurPrincipal"]; - if([attr count] > 0) - server = [attr stringValueAtIndex:0]; - } - - if(!server) { - if(debugOn) { - NSLog(@"%s no chance of getting at server info for user '%@', " - @"tried everything. Sorry.", - __PRETTY_FUNCTION__, - _uid); - } - return nil; - } - - [self _cacheServer:server forUID:_uid]; - return server; - } - else { - return @"mail.opengroupware.org"; - } -} - -@end diff --git a/SOGoLogic/COPYING b/SOGoLogic/COPYING deleted file mode 100644 index 161a3d1d..00000000 --- a/SOGoLogic/COPYING +++ /dev/null @@ -1,482 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/SOGoLogic/COPYRIGHT b/SOGoLogic/COPYRIGHT deleted file mode 100644 index 1053b2aa..00000000 --- a/SOGoLogic/COPYRIGHT +++ /dev/null @@ -1,4 +0,0 @@ -Copyright (C) 2004 SKYRIX Software AG - - -Contact: info@skyrix.com diff --git a/SOGoLogic/ChangeLog b/SOGoLogic/ChangeLog index cc20d83c..025d73f9 100644 --- a/SOGoLogic/ChangeLog +++ b/SOGoLogic/ChangeLog @@ -1,3 +1,7 @@ +2005-02-17 Helge Hess + + * moved code to libSOGo + 2005-02-12 Marcus Mueller * v0.9.37 diff --git a/SOGoLogic/GNUmakefile b/SOGoLogic/GNUmakefile deleted file mode 100644 index 71eae7f3..00000000 --- a/SOGoLogic/GNUmakefile +++ /dev/null @@ -1,28 +0,0 @@ -# GNUstep Makefile - -include $(GNUSTEP_MAKEFILES)/common.make -include ../SOGo/Version -include ./Version - -LIBRARY_NAME = libSOGoLogic - -libSOGoLogic_HEADER_FILES_DIR = . -libSOGoLogic_HEADER_FILES_INSTALL_DIR = /SOGoLogic -libSOGoLogic_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION) - -libSOGoLogic_HEADER_FILES += \ - SOGoAppointment.h \ - SOGoAppointmentICalRenderer.h \ - AgenorUserManager.h \ - SOGoLRUCache.h \ - NSString+iCal.h - -libSOGoLogic_OBJC_FILES += \ - SOGoAppointment.m \ - SOGoAppointmentICalRenderer.m \ - SOGoLRUCache.m \ - AgenorUserManager.m \ - --include GNUmakefile.preamble -include $(GNUSTEP_MAKEFILES)/library.make --include GNUmakefile.postamble diff --git a/SOGoLogic/GNUmakefile.preamble b/SOGoLogic/GNUmakefile.preamble deleted file mode 100644 index b34cafce..00000000 --- a/SOGoLogic/GNUmakefile.preamble +++ /dev/null @@ -1,10 +0,0 @@ -# $Id$ - -libSOGoLogic_LIBRARIES_DEPEND_UPON += \ - -lNGiCal \ - -lNGLdap \ - -lNGExtensions -lEOControl \ - -lDOM -lSaxObjC - -ADDITIONAL_LIB_DIRS += \ - -L/usr/local/lib -L/usr/lib diff --git a/SOGoLogic/NSString+iCal.h b/SOGoLogic/NSString+iCal.h deleted file mode 100644 index f8d29ccf..00000000 --- a/SOGoLogic/NSString+iCal.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (C) 2000-2004 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 __NSString_iCal_H_ -#define __NSString_iCal_H_ - -// DEPRECATED - -#import -#include - -#endif /* __NSString_iCal_H_ */ diff --git a/SOGoLogic/SOGoAppointment.h b/SOGoLogic/SOGoAppointment.h deleted file mode 100644 index dfdd731f..00000000 --- a/SOGoLogic/SOGoAppointment.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - 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$ - -#ifndef __SOGoAppointment_H_ -#define __SOGoAppointment_H_ - -#import -#import - -/* - SOGoAppointment - - Wrapper around the iCalendar content of appointments stored in the - OGoContentStore. -*/ - -@class NSString, NSArray, NSCalendarDate, NGCalendarDateRange; -@class iCalPerson, iCalEvent, iCalRecurrenceRule; - -@interface SOGoAppointment : NSObject -{ - id calendar; - iCalEvent *event; - id participants; -} - -- (id)initWithICalString:(NSString *)_iCal; - -- (void)setUid:(NSString *)_value; -- (NSString *)uid; - -- (void)setSummary:(NSString *)_value; -- (NSString *)summary; - -- (void)setLocation:(NSString *)_value; -- (NSString *)location; -- (BOOL)hasLocation; - -- (void)setComment:(NSString *)_value; -- (NSString *)comment; -- (BOOL)hasComment; - -- (void)setPriority:(NSString *)_value; -- (NSString *)priority; -- (BOOL)hasPriority; - -- (void)setCategories:(NSArray *)_value; -- (NSArray *)categories; -- (BOOL)hasCategories; - -- (void)setStatus:(NSString *)_value; -- (NSString *)status; - -- (void)setStartDate:(NSCalendarDate *)_date; -- (NSCalendarDate *)startDate; - -- (void)setEndDate:(NSCalendarDate *)_date; -- (NSCalendarDate *)endDate; -- (BOOL)hasEndDate; - -- (BOOL)hasDuration; -- (void)setDuration:(NSTimeInterval)_duration; -- (NSTimeInterval)duration; - -- (void)setOrganizer:(iCalPerson *)_organizer; -- (iCalPerson *)organizer; - -- (void)setAccessClass:(NSString *)_value; -- (NSString *)accessClass; -- (BOOL)isPublic; - -- (void)setTransparency:(NSString *)_value; -- (NSString *)transparency; -- (BOOL)isTransparent; - -- (void)removeAllAttendees; -- (void)addToAttendees:(iCalPerson *)_person; -- (void)appendAttendees:(NSArray *)_persons; -- (void)setAttendees:(NSArray *)_persons; -- (NSArray *)attendees; - -/* attendees -> role != NON-PART */ -- (NSArray *)participants; -/* attendees -> role == NON-PART */ -- (NSArray *)resources; - -/* simplified recurrence API */ -- (void)setRecurrenceRule:(iCalRecurrenceRule *)_rrule; -- (iCalRecurrenceRule *)recurrenceRule; -- (BOOL)hasRecurrenceRule; - -- (NSArray *)recurrenceRangesWithinCalendarDateRange:(NGCalendarDateRange *)_r; - -/* iCal generation */ - -- (NSString *)iCalString; -- (NSString *)vEventString; - -/* raw entity objects */ - -- (id)calendar; -- (id)event; - -/* checking */ - -- (BOOL)isOrganizer:(id)_email; -- (BOOL)isParticipant:(id)_email; - -/* searching */ - -- (iCalPerson *)findParticipantWithEmail:(id)_email; - -@end - -#endif /* __SOGoAppointment_H_ */ diff --git a/SOGoLogic/SOGoAppointment.m b/SOGoLogic/SOGoAppointment.m deleted file mode 100644 index b0d5504d..00000000 --- a/SOGoLogic/SOGoAppointment.m +++ /dev/null @@ -1,443 +0,0 @@ -/* - 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 "SOGoAppointment.h" -#include -#include -#include -#include "SOGoAppointmentICalRenderer.h" -#include "common.h" - -@interface SOGoAppointment (PrivateAPI) -- (NSArray *)_filteredAttendeesThinkingOfPersons:(BOOL)_persons; -@end - -@implementation SOGoAppointment - -static id parser = nil; -static SaxObjectDecoder *sax = nil; -static NGLogger *logger = nil; - -+ (void)initialize { - NGLoggerManager *lm; - SaxXMLReaderFactory *factory; - static BOOL didInit = NO; - - if (didInit) return; - didInit = YES; - - lm = [NGLoggerManager defaultLoggerManager]; - logger = [lm loggerForClass:self]; - - factory = [SaxXMLReaderFactory standardXMLReaderFactory]; - parser = [[factory createXMLReaderForMimeType:@"text/calendar"] - retain]; - if (parser == nil) - [logger fatalWithFormat:@"did not find a parser for text/calendar!"]; - sax = [[SaxObjectDecoder alloc] initWithMappingNamed:@"NGiCal"]; - if (sax == nil) - [logger fatalWithFormat:@"could not create the iCal SAX handler!"]; - - [parser setContentHandler:sax]; - [parser setErrorHandler:sax]; -} - -- (id)initWithICalRootObject:(id)_root { - if ((self = [super init])) { -#if 0 - [self logWithFormat:@"root is: %@", root]; -#endif - - if ([_root isKindOfClass:[iCalEvent class]]) { - self->event = [_root retain]; - } - else if ([_root isKindOfClass:[NSDictionary class]]) { - /* multiple vevents in the calendar */ - [self errorWithFormat: - @"(%s): tried to initialize with multiple records: %@", - __PRETTY_FUNCTION__, _root]; - [self release]; - return nil; - } - else { - self->calendar = [_root retain]; - self->event = [[[self->calendar events] lastObject] retain]; - } - } - return self; -} -- (id)initWithICalString:(NSString *)_iCal { - id root; - - if ([_iCal length] == 0) { - [self errorWithFormat:@"tried to init SOGoAppointment without iCal"]; - [self release]; - return nil; - } - if (parser == nil || sax == nil) { - [self errorWithFormat:@"iCal parser not properly set up!"]; - [self release]; - return nil; - } - - if ([_iCal length] > 0) { - [parser parseFromSource:_iCal]; - root = [[sax rootObject] retain]; /* retain to keep it around */ - [sax reset]; - } - else - root = nil; - - self = [self initWithICalRootObject:root]; - [root release]; - return self; -} - -- (void)dealloc { - [self->calendar release]; - [self->event release]; - [super dealloc]; -} - -/* accessors */ - -- (id)calendar { - return self->calendar; -} - -- (id)event { - return self->event; -} - -- (NSString *)iCalString { - return [[SOGoAppointmentICalRenderer sharedAppointmentRenderer] - stringForAppointment:self]; -} -- (NSString *)vEventString { - return [[SOGoAppointmentICalRenderer sharedAppointmentRenderer] - vEventStringForAppointment:self]; -} - -/* forwarded methods */ - -- (void)setUid:(NSString *)_value { - [self->event setUid:_value]; -} -- (NSString *)uid { - return [self->event uid]; -} - -- (void)setSummary:(NSString *)_value { - [self->event setSummary:_value]; -} -- (NSString *)summary { - return [self->event summary]; -} - -- (void)setLocation:(NSString *)_value { - [self->event setLocation:_value]; -} -- (NSString *)location { - return [self->event location]; -} -- (BOOL)hasLocation { - if (![[self location] isNotNull]) - return NO; - return [[self location] length] > 0 ? YES : NO; -} - -- (void)setComment:(NSString *)_value { - if([_value length] == 0) - _value = nil; - [self->event setComment:_value]; -} -- (NSString *)comment { - return [self->event comment]; -} -- (BOOL)hasComment { - NSString *s = [self comment]; - if(!s || [s length] == 0) - return NO; - return YES; -} - -- (void)setPriority:(NSString *)_value { - [self->event setPriority:_value]; -} -- (NSString *)priority { - return [self->event priority]; -} -- (BOOL)hasPriority { - NSString *prio = [self priority]; - NSRange r; - - if(!prio) - return NO; - - r = [prio rangeOfString:@";"]; - if(r.length > 0) { - prio = [prio substringToIndex:r.location]; - } - return [prio isEqualToString:@"0"] ? NO : YES; -} - -- (void)setCategories:(NSArray *)_value { - NSString *catString; - - if(!_value || [_value count] == 0) { - [self->event setCategories:nil]; - return; - } - _value = [_value sortedArrayUsingSelector:@selector(compareAscending:)]; - catString = [_value componentsJoinedByString:@","]; - [self->event setCategories:catString]; - [catString release]; -} -- (NSArray *)categories { - NSString *catString; - NSArray *cats; - NSRange r; - - catString = [self->event categories]; - if (![catString isNotNull]) - return [NSArray array]; - - r = [[catString stringValue] rangeOfString:@";"]; - if(r.length > 0) { - catString = [catString substringToIndex:r.location]; - } - cats = [catString componentsSeparatedByString:@","]; - return cats; -} -- (BOOL)hasCategories { - return [self->event categories] != nil ? YES : NO; -} - -- (void)setStatus:(NSString *)_value { - [self->event setStatus:_value]; -} -- (NSString *)status { - return [self->event status]; -} - -- (void)setStartDate:(NSCalendarDate *)_date { - [self->event setStartDate:_date]; -} -- (NSCalendarDate *)startDate { - return [self->event startDate]; -} - -- (void)setEndDate:(NSCalendarDate *)_date { - [self->event setEndDate:_date]; -} -- (NSCalendarDate *)endDate { - return [self->event endDate]; -} -- (BOOL)hasEndDate { - return [self->event hasEndDate]; -} - -- (void)setDuration:(NSTimeInterval)_duration { - // TODO - [self warnWithFormat:@"could not apply duration!"]; -} -- (BOOL)hasDuration { - return [self->event hasDuration]; -} -- (NSTimeInterval)duration { - return [self->event durationAsTimeInterval]; -} - -- (void)setAccessClass:(NSString *)_value { - [self->event setAccessClass:_value]; -} -- (NSString *)accessClass { - NSString *s; - - s = [self->event accessClass]; - if(!s) - s = @"PUBLIC"; /* default for agenor */ - return s; -} -- (BOOL)isPublic { - return [[self accessClass] isEqualToString:@"PUBLIC"]; -} - -- (void)setTransparency:(NSString *)_value { - [self->event setTransparency:_value]; -} -- (NSString *)transparency { - return [self->event transparency]; -} -- (BOOL)isTransparent { - return [[self transparency] isEqualToString:@"TRANSPARENT"]; -} - -- (void)setOrganizer:(iCalPerson *)_organizer { - [self->event setOrganizer:_organizer]; -} -- (iCalPerson *)organizer { - return [self->event organizer]; -} - -- (void)removeAllAttendees { - [self setAttendees:nil]; -} -- (void)addToAttendees:(iCalPerson *)_person { - [self->event addToAttendees:_person]; -} -- (void)appendAttendees:(NSArray *)_persons { - unsigned i, count; - - count = [_persons count]; - for (i = 0; i < count; i++) - [self addToAttendees:[_persons objectAtIndex:i]]; -} -- (void)setAttendees:(NSArray *)_persons { - [self->event removeAllAttendees]; - if ([_persons count] > 0) - [self appendAttendees:_persons]; -} -- (NSArray *)attendees { - return [self->event attendees]; -} - -- (NSArray *)participants { - if (self->participants != nil) - return self->participants; - - self->participants = [[self _filteredAttendeesThinkingOfPersons:YES] retain]; - return self->participants; -} -- (BOOL)hasParticipants { - return [[self participants] count] != 0; -} - -- (NSArray *)resources { - return [self _filteredAttendeesThinkingOfPersons:NO]; -} - -- (NSArray *)_filteredAttendeesThinkingOfPersons:(BOOL)_persons { - NSArray *list; - NSMutableArray *filtered; - unsigned i, count; - - list = [self attendees]; - count = [list count]; - filtered = [NSMutableArray arrayWithCapacity:count]; - for (i = 0; i < count; i++) { - iCalPerson *p; - NSString *role; - - p = [list objectAtIndex:i]; - role = [p role]; - if (_persons) { - if (role == nil || ![role hasPrefix:@"NON-PART"]) - [filtered addObject:p]; - } - else { - if ([role hasPrefix:@"NON-PART"]) - [filtered addObject:p]; - } - } - return filtered; -} - -- (BOOL)isOrganizer:(id)_email { - return [[[self organizer] rfc822Email] isEqualToString:_email]; -} - -- (BOOL)isParticipant:(id)_email { - NSArray *partEmails; - - partEmails = [[self participants] valueForKey:@"rfc822Email"]; - return [partEmails containsObject:_email]; -} - -- (iCalPerson *)findParticipantWithEmail:(id)_email { - NSArray *ps; - unsigned i, count; - - ps = [self participants]; - count = [ps count]; - - for (i = 0; i < count; i++) { - iCalPerson *p; - - p = [ps objectAtIndex:i]; - if ([[p rfc822Email] isEqualToString:_email]) - return p; - } - return nil; /* not found */ -} - - -/* - NOTE: this is not the same API as used by NGiCal! - SOGo/OGo cannot deal with the complete NGiCal API properly, although - SOGo COULD do so in the future -*/ -- (void)setRecurrenceRule:(iCalRecurrenceRule *)_rrule { - [_rrule retain]; - [self->event removeAllRecurrenceRules]; - if (_rrule) - [self->event addToRecurrenceRules:_rrule]; - [_rrule release]; -} -- (iCalRecurrenceRule *)recurrenceRule { - if ([self->event hasRecurrenceRules]) - return [[self->event recurrenceRules] objectAtIndex:0]; - return nil; -} -- (BOOL)hasRecurrenceRule { - return [self recurrenceRule] != nil; -} - -- (NSArray *)recurrenceRangesWithinCalendarDateRange:(NGCalendarDateRange *)_r { - return [self->event recurrenceRangesWithinCalendarDateRange:_r]; -} - - -/* description */ - -- (void)appendAttributesToDescription:(NSMutableString *)_ms { - [_ms appendFormat:@" uid=%@", [self uid]]; - [_ms appendFormat:@" date=%@", [self startDate]]; -} - -- (NSString *)description { - NSMutableString *ms; - - ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; - [self appendAttributesToDescription:ms]; - [ms appendString:@">"]; - return ms; -} - -/* logging */ - -- (id)logger { - return logger; -} - -@end /* SOGoAppointment */ diff --git a/SOGoLogic/SOGoAppointmentICalRenderer.h b/SOGoLogic/SOGoAppointmentICalRenderer.h deleted file mode 100644 index afdd2e6f..00000000 --- a/SOGoLogic/SOGoAppointmentICalRenderer.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - 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: SOGoAppointment.h 207 2004-08-14 15:37:04Z znek $ - -#ifndef __SOGoAppointmentICalRenderer_H_ -#define __SOGoAppointmentICalRenderer_H_ - -#import - -/* - SOGoAppointmentICalRenderer - - Transform an SOGoAppointment into an iCalendar formatted string. -*/ - -@class NSString; -@class SOGoAppointment; - -@interface SOGoAppointmentICalRenderer : NSObject - -+ (id)sharedAppointmentRenderer; - -- (NSString *)vEventStringForAppointment:(SOGoAppointment *)_apt; -- (NSString *)stringForAppointment:(SOGoAppointment *)_apt; - -@end - -#endif /* __SOGoAppointmentICalRenderer_H_ */ diff --git a/SOGoLogic/SOGoAppointmentICalRenderer.m b/SOGoLogic/SOGoAppointmentICalRenderer.m deleted file mode 100644 index d0e53fdc..00000000 --- a/SOGoLogic/SOGoAppointmentICalRenderer.m +++ /dev/null @@ -1,250 +0,0 @@ -/* - 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 "SOGoAppointmentICalRenderer.h" -#include "SOGoAppointment.h" -#include "NSString+iCal.h" -#include -#include "common.h" - -// TODO: the basic renderer should be part of NGiCal - -@interface NSDate(UsedPrivates) -- (NSString *)icalString; // declared in NGiCal -@end - -@implementation SOGoAppointmentICalRenderer - -static SOGoAppointmentICalRenderer *renderer = nil; - -/* assume length of 1K - reasonable ? */ -static unsigned DefaultICalStringCapacity = 1024; - -+ (id)sharedAppointmentRenderer { - if (renderer == nil) - renderer = [[self alloc] init]; - return renderer; -} - -/* renderer */ - -- (void)addPreambleForAppointment:(SOGoAppointment *)_apt - toString:(NSMutableString *)s -{ - iCalCalendar *calendar; - - calendar = [_apt calendar]; - - [s appendString:@"BEGIN:VCALENDAR\r\nMETHOD:REQUEST\r\n"]; - - [s appendString:@"PRODID:"]; - [s appendString:[calendar isNotNull] ? [calendar prodId] : @"SOGo/0.9"]; - [s appendString:@"\r\n"]; - - [s appendString:@"VERSION:"]; - [s appendString:[calendar isNotNull] ? [calendar version] : @"2.0"]; - [s appendString:@"\r\n"]; -} -- (void)addPostambleForAppointment:(SOGoAppointment *)_apt - toString:(NSMutableString *)s -{ - [s appendString:@"END:VCALENDAR\r\n"]; -} - -- (void)addOrganizer:(iCalPerson *)p toString:(NSMutableString *)s { - NSString *x; - - if (![p isNotNull]) return; - - [s appendString:@"ORGANIZER;CN=\""]; - if ((x = [p cn])) - [s appendString:[x iCalDQUOTESafeString]]; - - [s appendString:@"\""]; - if ((x = [p email])) { - [s appendString:@":"]; /* sic! */ - [s appendString:[x iCalSafeString]]; - } - [s appendString:@"\r\n"]; -} - -- (void)addAttendees:(NSArray *)persons toString:(NSMutableString *)s { - unsigned i, count; - iCalPerson *p; - - count = [persons count]; - for (i = 0; i < count; i++) { - NSString *x; - - p = [persons objectAtIndex:i]; - [s appendString:@"ATTENDEE;"]; - - if ((x = [p role])) { - [s appendString:@"ROLE="]; - [s appendString:[x iCalSafeString]]; - [s appendString:@";"]; - } - - if ((x = [p partStat])) { - if ([p participationStatus] != iCalPersonPartStatNeedsAction) { - [s appendString:@"PARTSTAT="]; - [s appendString:[x iCalSafeString]]; - [s appendString:@";"]; - } - } - - [s appendString:@"CN=\""]; - if ((x = [p cnWithoutQuotes])) { - [s appendString:[x iCalDQUOTESafeString]]; - } - [s appendString:@"\""]; - if ([(x = [p email]) isNotNull]) { - [s appendString:@":"]; /* sic! */ - [s appendString:[x iCalSafeString]]; - } - [s appendString:@"\r\n"]; - } -} - -- (void)addVEventForAppointment:(SOGoAppointment *)_apt - toString:(NSMutableString *)s -{ - iCalEvent *event; - - event = [_apt event]; - - [s appendString:@"BEGIN:VEVENT\r\n"]; - - [s appendString:@"SUMMARY:"]; - [s appendString:[[_apt summary] iCalSafeString]]; - [s appendString:@"\r\n"]; - if ([_apt hasLocation]) { - [s appendString:@"LOCATION:"]; - [s appendString:[[_apt location] iCalSafeString]]; - [s appendString:@"\r\n"]; - } - [s appendString:@"UID:"]; - [s appendString:[_apt uid]]; - [s appendString:@"\r\n"]; - - [s appendString:@"DTSTART:"]; - [s appendString:[[_apt startDate] icalString]]; - [s appendString:@"\r\n"]; - - if ([_apt hasEndDate]) { - [s appendString:@"DTEND:"]; - [s appendString:[[_apt endDate] icalString]]; - [s appendString:@"\r\n"]; - } - if ([_apt hasDuration]) { - [s appendString:@"DURATION:"]; - [s appendString:[event duration]]; - [s appendString:@"\r\n"]; - } - if([_apt hasPriority]) { - [s appendString:@"PRIORITY:"]; - [s appendString:[_apt priority]]; - [s appendString:@"\r\n"]; - } - if([_apt hasCategories]) { - NSString *catString; - - catString = [[_apt categories] componentsJoinedByString:@","]; - [s appendString:@"CATEGORIES:"]; - [s appendString:catString]; - [s appendString:@"\r\n"]; - } - if([_apt hasComment]) { - [s appendString:@"DESCRIPTION:"]; /* this is what iCal.app does */ - [s appendString:[[_apt comment] iCalSafeString]]; - [s appendString:@"\r\n"]; - } - - [s appendString:@"STATUS:"]; - [s appendString:[_apt status]]; - [s appendString:@"\r\n"]; - - [s appendString:@"TRANSP:"]; - [s appendString:[_apt transparency]]; - [s appendString:@"\r\n"]; - - [s appendString:@"CLASS:"]; - [s appendString:[_apt accessClass]]; - [s appendString:@"\r\n"]; - - /* recurrence rules */ - if ([_apt hasRecurrenceRule]) { - [s appendString:@"RRULE:"]; - [s appendString:[[_apt recurrenceRule] iCalRepresentation]]; - [s appendString:@"\r\n"]; - } - - [self addOrganizer:[_apt organizer] toString:s]; - [self addAttendees:[_apt attendees] toString:s]; - - /* postamble */ - [s appendString:@"END:VEVENT\r\n"]; -} - -- (BOOL)isValidAppointment:(SOGoAppointment *)_apt { - if (![_apt isNotNull]) - return NO; - - if ([[_apt uid] length] == 0) { - [self warnWithFormat:@"got apt without uid, rejecting iCal generation: %@", - _apt]; - return NO; - } - if ([[[_apt startDate] icalString] length] == 0) { - [self warnWithFormat:@"got apt without start date, " - @"rejecting iCal generation: %@", - _apt]; - return NO; - } - - return YES; -} - -- (NSString *)vEventStringForAppointment:(SOGoAppointment *)_apt { - NSMutableString *s; - - if (![self isValidAppointment:_apt]) - return nil; - - s = [NSMutableString stringWithCapacity:DefaultICalStringCapacity]; - [self addVEventForAppointment:_apt toString:s]; - return s; -} - -- (NSString *)stringForAppointment:(SOGoAppointment *)_apt { - NSMutableString *s; - - if (![self isValidAppointment:_apt]) - return nil; - - s = [NSMutableString stringWithCapacity:DefaultICalStringCapacity]; - [self addPreambleForAppointment:_apt toString:s]; - [self addVEventForAppointment:_apt toString:s]; - [self addPostambleForAppointment:_apt toString:s]; - return s; -} - -@end /* SOGoAppointmentICalRenderer */ diff --git a/SOGoLogic/SOGoLRUCache.h b/SOGoLogic/SOGoLRUCache.h deleted file mode 100644 index 1d29a504..00000000 --- a/SOGoLogic/SOGoLRUCache.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2000-2004 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 __SOGoLRUCache_H_ -#define __SOGoLRUCache_H_ - - -#import - - -@interface SOGoLRUCache : NSObject -{ - unsigned size; - NSMutableDictionary *entries; -} - -- (id)initWithCacheSize:(unsigned)_size; - -- (void)addObject:(id)_obj forKey:(id)_key; -- (id)objectForKey:(id)_key; - -@end - -#endif /* __SOGoLRUCache_H_ */ diff --git a/SOGoLogic/SOGoLRUCache.m b/SOGoLogic/SOGoLRUCache.m deleted file mode 100644 index dd11e77c..00000000 --- a/SOGoLogic/SOGoLRUCache.m +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (C) 2000-2004 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 "SOGoLRUCache.h" -#import "common.h" - -@interface SOGoLRUCacheItem : NSObject -{ - id object; - unsigned useCount; -} - -- (id)initWithObject:(id)_obj; -- (id)object; - -- (unsigned)useCount; - -@end - -@implementation SOGoLRUCacheItem - -- (id)initWithObject:(id)_obj { - self = [super init]; - if(self) { - ASSIGN(self->object, _obj); - self->useCount = 1; - } - return self; -} - -- (id)object { - self->useCount++; - return self->object; -} - -- (unsigned)useCount { - return self->useCount; -} - -@end - -@implementation SOGoLRUCache - -- (id)initWithCacheSize:(unsigned)_size { - self = [super init]; - if(self) { - self->size = _size; - self->entries = [[NSMutableDictionary alloc] initWithCapacity:_size]; - } - return self; -} - -- (void)dealloc { - [self->entries release]; - [super dealloc]; -} - -- (void)addObject:(id)_obj forKey:(id)_key { - SOGoLRUCacheItem *item; - - NSAssert(_obj, @"Attempt to insert nil object!"); - - if([self->entries count] >= self->size) { - /* need to find minimum and get rid of it */ - NSEnumerator *keyEnum; - SOGoLRUCacheItem *item; - id key, leastUsedItemKey; - unsigned minimumUseCount = INT_MAX; - - keyEnum = [self->entries keyEnumerator]; - while((key = [keyEnum nextObject])) { - item = [self->entries objectForKey:key]; - if([item useCount] < minimumUseCount) { - minimumUseCount = [item useCount]; - leastUsedItemKey = key; - } - } - [self->entries removeObjectForKey:leastUsedItemKey]; - } - item = [[SOGoLRUCacheItem alloc] initWithObject:_obj]; - [self->entries setObject:item forKey:_key]; - [item release]; -} - -- (id)objectForKey:(id)_key { - SOGoLRUCacheItem *item; - - item = [self->entries objectForKey:_key]; - if(!item) - return nil; - return [item object]; -} - -@end diff --git a/SOGoLogic/common.h b/SOGoLogic/common.h deleted file mode 100644 index edfa4286..00000000 --- a/SOGoLogic/common.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - 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$ - -#import -#import - -#include -- 2.39.5