2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #import <NGCards/iCalEntityObject.h>
24 #import "SOGoAptMailNotification.h"
27 @interface SOGoAptMailNotification (PrivateAPI)
29 - (void)setIsSubject:(BOOL)_isSubject;
32 @implementation SOGoAptMailNotification
34 static NSCharacterSet *wsSet = nil;
35 static NSTimeZone *EST = nil;
38 static BOOL didInit = NO;
43 wsSet = [[NSCharacterSet whitespaceAndNewlineCharacterSet] retain];
44 EST = [[NSTimeZone timeZoneWithAbbreviation:@"EST"] retain];
48 [self->oldApt release];
49 [self->newApt release];
50 [self->homePageURL release];
51 [self->viewTZ release];
53 [self->oldStartDate release];
54 [self->newStartDate release];
61 - (void)setOldApt:(iCalEntityObject *)_oldApt {
62 ASSIGN(self->oldApt, _oldApt);
69 - (void)setNewApt:(iCalEntityObject *) _newApt
71 ASSIGN(self->newApt, _newApt);
74 - (NSString *)homePageURL {
75 return self->homePageURL;
77 - (void)setHomePageURL:(NSString *)_homePageURL {
78 ASSIGN(self->homePageURL, _homePageURL);
81 - (NSString *)appointmentURL {
84 aptUID = [[self newApt] uid];
85 return [NSString stringWithFormat:@"%@/Calendar/%@/view?tab=participants",
90 - (NSTimeZone *)viewTZ {
91 if (self->viewTZ) return self->viewTZ;
94 - (void)setViewTZ:(NSTimeZone *)_viewTZ {
95 ASSIGN(self->viewTZ, _viewTZ);
99 return self->isSubject;
101 - (void)setIsSubject:(BOOL)_isSubject {
102 self->isSubject = _isSubject;
108 - (NSCalendarDate *)oldStartDate {
109 if (!self->oldStartDate) {
110 ASSIGN(self->oldStartDate, [[self oldApt] startDate]);
111 [self->oldStartDate setTimeZone:[self viewTZ]];
113 return self->oldStartDate;
116 - (NSCalendarDate *)newStartDate {
117 if (!self->newStartDate) {
118 ASSIGN(self->newStartDate, [[self newApt] startDate]);
119 [self->newStartDate setTimeZone:[self viewTZ]];
121 return self->newStartDate;
124 /* Generate Response */
126 - (NSString *)getSubject {
129 [self setIsSubject:YES];
130 subject = [[[self generateResponse] contentAsString]
131 stringByTrimmingCharactersInSet:wsSet];
133 [self errorWithFormat:@"Failed to properly generate subject! Please check "
134 @"template for component '%@'!",
136 subject = @"ERROR: missing subject!";
141 - (NSString *)getBody {
142 [self setIsSubject:NO];
143 return [[self generateResponse] contentAsString];