diff --git a/OGoContentStore/OCSContactFieldExtractor.m b/OGoContentStore/OCSContactFieldExtractor.m index fb3fc13f6..7b53fd061 100644 --- a/OGoContentStore/OCSContactFieldExtractor.m +++ b/OGoContentStore/OCSContactFieldExtractor.m @@ -95,21 +95,14 @@ static NSString *fieldNames[] = { } - (NSMutableDictionary *)extractQuickFieldsFromVCardString:(NSString *)_str { - NSArray *vCards; + NGVCard *vCard; - if ((vCards = [NGVCard parseVCardsFromSource:_str]) == nil) { - [self errorWithFormat:@"Could not parse content as a vCard."]; - return nil; - } - if ([vCards count] == 0) { + if ((vCard = [NGVCard parseSingleFromSource: _str]) == nil) { [self errorWithFormat:@"Could not parse content as a vCard."]; return nil; } - if ([vCards count] > 1) - [self warnWithFormat:@"More than one vCard in content, using first."]; - - return [self extractQuickFieldsFromVCard:[vCards objectAtIndex:0]]; + return [self extractQuickFieldsFromVCard: vCard]; } - (NSMutableDictionary *)extractQuickFieldsFromContent:(NSString *)_content { diff --git a/OGoContentStore/OCSiCalFieldExtractor.m b/OGoContentStore/OCSiCalFieldExtractor.m index edc71dced..6da3172d1 100644 --- a/OGoContentStore/OCSiCalFieldExtractor.m +++ b/OGoContentStore/OCSiCalFieldExtractor.m @@ -208,20 +208,17 @@ static NSNumber *distantFutureNumber = nil; - (NSMutableDictionary *)extractQuickFieldsFromContent:(NSString *)_content { NSAutoreleasePool *pool; NSDictionary *fields; - NSArray *cals; id cal; if ([_content length] == 0) return nil; pool = [[NSAutoreleasePool alloc] init]; - cals = [CardGroup groupsOfClass: [iCalCalendar class] - fromSource: _content]; - if ([cals count] > 0) - { - cal = [cals objectAtIndex: 0]; + cal = [iCalCalendar parseSingleFromSource: _content]; - fields = nil; + fields = nil; + if (cal) + { if ([cal isKindOfClass:[iCalEvent class]]) fields = [[self extractQuickFieldsFromEvent:cal] retain]; else if ([cal isKindOfClass:[iCalCalendar class]]) @@ -231,6 +228,8 @@ static NSNumber *distantFutureNumber = nil; cal]; } } + else + [self logWithFormat:@"ERROR: parsing source didn't return anything"]; [pool release]; diff --git a/OGoContentStore/iCalRepeatableEntityObject+OCS.m b/OGoContentStore/iCalRepeatableEntityObject+OCS.m index 5ecbdba70..13ed1710e 100644 --- a/OGoContentStore/iCalRepeatableEntityObject+OCS.m +++ b/OGoContentStore/iCalRepeatableEntityObject+OCS.m @@ -47,7 +47,7 @@ iCalRecurrenceRule *rule; rule = [a objectAtIndex:i]; - [ma addObject:[rule iCalRepresentation]]; + [ma addObject: [rule versitString]]; } [cycleInfo setObject:ma forKey:@"rules"]; } @@ -63,7 +63,7 @@ iCalRecurrenceRule *rule; rule = [a objectAtIndex:i]; - [ma addObject:[rule iCalRepresentation]]; + [ma addObject: [rule versitString]]; } [cycleInfo setObject:ma forKey:@"exRules"]; } diff --git a/Protocols/iCalHTTP/SOGoICalFilePublish.m b/Protocols/iCalHTTP/SOGoICalFilePublish.m index cf8b935ba..894565f56 100644 --- a/Protocols/iCalHTTP/SOGoICalFilePublish.m +++ b/Protocols/iCalHTTP/SOGoICalFilePublish.m @@ -30,9 +30,7 @@ #include "SOGoICalHTTPHandler.h" #include #include -#include #include -#include #include #include "common.h" diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 8a156965f..ef94d6ba5 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -837,8 +837,7 @@ static NSNumber *sharedYes = nil; events = [NSMutableArray arrayWithCapacity:[files count]]; contents = [files objectEnumerator]; while ((content = [contents nextObject]) != nil) - [events addObjectsFromArray: [CardGroup groupsOfClass: [iCalCalendar class] - fromSource: content]]; + [events addObject: [iCalCalendar parseSingleFromSource: content]]; return events; } diff --git a/SoObjects/Appointments/SOGoAppointmentObject.h b/SoObjects/Appointments/SOGoAppointmentObject.h index 607345ad7..3be5fafa1 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.h +++ b/SoObjects/Appointments/SOGoAppointmentObject.h @@ -70,7 +70,6 @@ - (NSException *)changeParticipationStatus:(NSString *)_status inContext:(id)_ctx; -- (iCalCalendar *) calendarFromContent: (NSString *) cnt; - (iCalEvent *) firstEventFromCalendar: (iCalCalendar *) calendar; @end diff --git a/UI/Contacts/UIxContactSelector.m b/UI/Contacts/UIxContactSelector.m index ce1fee914..ff083785d 100644 --- a/UI/Contacts/UIxContactSelector.m +++ b/UI/Contacts/UIxContactSelector.m @@ -21,10 +21,10 @@ // $Id: UIxContactSelector.m 394 2004-10-14 08:47:35Z znek $ #import +#import #import #import -#import #import "common.h" @@ -134,6 +134,9 @@ NSMutableArray *persons; NSEnumerator *uids; NSString *uid; + AgenorUserManager *um; + + um = [AgenorUserManager sharedUserManager]; persons = [NSMutableArray new]; [persons autorelease]; @@ -145,7 +148,7 @@ uid = [uids nextObject]; while (uid) { - [persons addObject: [iCalPerson personWithUid: uid]]; + [persons addObject: [um iCalPersonWithUid: uid]]; uid = [uids nextObject]; } } diff --git a/UI/MailPartViewers/UIxMailPartICalViewer.h b/UI/MailPartViewers/UIxMailPartICalViewer.h new file mode 100644 index 000000000..08ed095dd --- /dev/null +++ b/UI/MailPartViewers/UIxMailPartICalViewer.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#ifndef UIXMAILPARTICALVIEWER_H +#define UIXMAILPARTICALVIEWER_H + +#import "UIxMailPartViewer.h" + +@class SOGoDateFormatter; +@class iCalEvent; +@class iCalCalendar; + +@interface UIxMailPartICalViewer : UIxMailPartViewer +{ + iCalCalendar *inCalendar; + iCalEvent *inEvent; + id attendee; + SOGoDateFormatter *dateFormatter; + id item; + id storedEventObject; + iCalEvent *storedEvent; +} + +- (iCalEvent *) authorativeEvent; + +@end + +#endif /* UIXMAILPARTICALVIEWER_H */ diff --git a/UI/MailPartViewers/UIxMailPartICalViewer.m b/UI/MailPartViewers/UIxMailPartICalViewer.m index 9f7f9dc52..a91b83113 100644 --- a/UI/MailPartViewers/UIxMailPartICalViewer.m +++ b/UI/MailPartViewers/UIxMailPartICalViewer.m @@ -19,41 +19,22 @@ 02111-1307, USA. */ -#include "UIxMailPartViewer.h" - /* UIxMailPartICalViewer Show plain/calendar mail parts. */ -@class SOGoDateFormatter; -@class iCalEvent, iCalCalendar; +#import +#import +#import +#import +#import +#import +#import +#import "common.h" -@interface UIxMailPartICalViewer : UIxMailPartViewer -{ - iCalCalendar *inCalendar; - iCalEvent *inEvent; - id attendee; - SOGoDateFormatter *dateFormatter; - id item; - id storedEventObject; - iCalEvent *storedEvent; -} - -- (iCalEvent *)authorativeEvent; - -@end - -#include -#include -#include -#include -#include -#include -#include -#include -#include "common.h" +#import "UIxMailPartICalViewer.h" @implementation UIxMailPartICalViewer @@ -101,28 +82,18 @@ /* accessors */ -- (iCalCalendar *)inCalendar { - NSString *iCalString; - - if (self->inCalendar != nil) - return [self->inCalendar isNotNull] ? self->inCalendar : nil; - - if ((iCalString = [self flatContentAsString]) == nil) { - [self errorWithFormat:@"Could not retrieve content string for part!"]; - self->inCalendar = [[NSNull null] retain]; - return nil; - } - - self->inCalendar = - [[iCalCalendar parseCalendarFromSource:iCalString] retain]; - if (self->inCalendar == nil) { - [self warnWithFormat:@"Could not parse a vcalendar string."]; - self->inCalendar = [[NSNull null] retain]; - return nil; - } - else - return self->inCalendar; +- (iCalCalendar *) inCalendar +{ + if (!inCalendar) + { + inCalendar + = [iCalCalendar parseSingleFromSource: [self flatContentAsString]]; + [inCalendar retain]; + } + + return inCalendar; } + - (BOOL)couldParseCalendar { return [[self inCalendar] isNotNull]; } diff --git a/UI/Scheduler/GNUmakefile b/UI/Scheduler/GNUmakefile index 482cf71c2..0ed5913ad 100644 --- a/UI/Scheduler/GNUmakefile +++ b/UI/Scheduler/GNUmakefile @@ -10,7 +10,6 @@ SchedulerUI_LANGUAGES = English French German SchedulerUI_OBJC_FILES = \ SchedulerUIProduct.m \ - iCalPerson+UIx.m \ NSCalendarDate+Scheduler.m \ \ UIxCalMainView.m \ @@ -31,18 +30,14 @@ SchedulerUI_OBJC_FILES = \ UIxCalDayOverview.m \ UIxCalDayChartview.m \ UIxCalDayListview.m \ - UIxCalDayPrintview.m \ UIxCalWeekOverview.m \ UIxCalWeekChartview.m \ UIxCalWeekListview.m \ UIxCalWeekColumnsview.m \ - UIxCalWeekPrintview.m \ UIxCalMonthOverview.m \ - UIxCalMonthPrintview.m \ UIxCalYearOverview.m \ UIxCalInlineMonthOverview.m \ UIxAppointmentView.m \ - UIxAppointmentPrintview.m \ UIxAppointmentEditor.m \ UIxCalSelectTab.m \ UIxCalDateLabel.m \ @@ -53,6 +48,10 @@ SchedulerUI_OBJC_FILES = \ UIxCalInlineAptView.m \ UIxCalScheduleOverview.m \ UIxCalParticipationStatusView.m \ +# UIxCalDayPrintview.m \ +# UIxCalWeekPrintview.m \ +# UIxCalMonthPrintview.m \ +# UIxAppointmentPrintview.m \ SchedulerUI_RESOURCE_FILES += \ Version \ diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index 00c4ccdcd..54c1277a6 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -88,15 +88,14 @@ @end -#include "common.h" -#include -#include -#include -#include -#include -#include -#include "iCalPerson+UIx.h" -#include "UIxComponent+Agenor.h" +#import "common.h" +#import +#import +#import +#import +#import +#import +#import "UIxComponent+Agenor.h" @interface NSDate(UsedPrivates) - (NSString *)icalString; // TODO: this is in NGCards @@ -849,7 +848,7 @@ SOGoAppointmentObject *clientObject; clientObject = [self clientObject]; - calendar = [clientObject calendarFromContent: _iCalString]; + calendar = [iCalCalendar parseSingleFromSource: _iCalString]; appointment = [clientObject firstEventFromCalendar: calendar]; return appointment; @@ -876,12 +875,11 @@ /* access */ -- (BOOL)isMyApt { - if (organizer == nil) - return YES; // assume this is safe to do, right? - +- (BOOL) isMyApt +{ // TODO: this should check a set of emails against the SoUser - return [[organizer rfc822Email] isEqualToString:[self emailForUser]]; + return (![[organizer email] length] + || [[organizer rfc822Email] isEqualToString: [self emailForUser]]); } - (BOOL)canAccessApt { diff --git a/UI/Scheduler/UIxAppointmentView.m b/UI/Scheduler/UIxAppointmentView.m index ca19d3d6c..cb4562abc 100644 --- a/UI/Scheduler/UIxAppointmentView.m +++ b/UI/Scheduler/UIxAppointmentView.m @@ -178,14 +178,13 @@ return nil; } - calendar = [clientObject calendarFromContent: iCalString]; + calendar = [iCalCalendar parseSingleFromSource: iCalString]; appointment = [clientObject firstEventFromCalendar: calendar]; [appointment retain]; return appointment; } - /* hrefs */ - (NSString *)attributesTabLink {