/* Copyright (C) 2000-2005 SKYRIX Software AG Copyright (C) 2006-2008 Inverse inc. 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. */ #import #import #import #import #import #import #import #import #import #import "SOGoAptMailNotification.h" @interface SOGoAptMailNotification (PrivateAPI) - (BOOL) isSubject; - (void) setIsSubject: (BOOL) newIsSubject; @end @implementation SOGoAptMailNotification static NSCharacterSet *wsSet = nil; static NSTimeZone *UTC = nil; + (void) initialize { if (!wsSet) { wsSet = [[NSCharacterSet whitespaceAndNewlineCharacterSet] retain]; UTC = [[NSTimeZone timeZoneWithAbbreviation: @"UTC"] retain]; } } - (id) init { if ((self = [super init])) { apt = nil; } return self; } - (void) dealloc { [apt release]; [organizerName release]; [super dealloc]; } - (iCalEntityObject *) apt { return apt; } - (void) setApt: (iCalEntityObject *) newApt { ASSIGN (apt, newApt); } - (BOOL) isSubject { return isSubject; } - (void) setIsSubject: (BOOL) newIsSubject { isSubject = newIsSubject; } - (NSString *) summary { return [apt summary]; } - (void) setOrganizerName: (NSString *) theString { ASSIGN(organizerName, theString); } - (NSString *) organizerName { return organizerName; } - (BOOL) hasSentBy { return [[apt organizer] hasSentBy]; } - (NSString *) sentBy { return [[apt organizer] sentBy]; } /* Helpers */ /* Generate Response */ - (NSString *) getSubject { NSString *subject; [self setIsSubject: YES]; subject = [[[self generateResponse] contentAsString] stringByTrimmingCharactersInSet: wsSet]; if (!subject) { [self errorWithFormat:@"Failed to properly generate subject! Please check " @"template for component '%@'!", [self name]]; subject = @"ERROR: missing subject!"; } return [subject asQPSubjectString: @"utf-8"]; } - (NSString *) getBody { [self setIsSubject:NO]; return [[self generateResponse] contentAsString]; } @end