/* SOGoAptMailICalReply - this file is part of SOGo * * Copyright (C) 2007-2009 Inverse inc. * * Author: Wolfgang Sourdeau * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This file 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #import #import #import #import #import #import #import #import #import #import #import #import #import "iCalPerson+SOGo.h" #import "SOGoAptMailICalReply.h" @interface SOGoAptMailICalReply (PrivateAPI) - (BOOL) isSubject; @end @implementation SOGoAptMailICalReply static NSCharacterSet *wsSet = nil; + (void) initialize { static BOOL didInit = NO; if (!didInit) { didInit = YES; wsSet = [[NSCharacterSet whitespaceAndNewlineCharacterSet] retain]; } } - (id) init { if ((self = [super init])) { apt = nil; attendee = nil; } return self; } - (void) dealloc { [apt release]; [attendee release]; [super dealloc]; } - (void) setApt: (iCalEntityObject *) newApt { ASSIGN (apt, newApt); } - (iCalEntityObject *) apt { return apt; } - (void) setAttendee: (iCalPerson *) newAttendee { ASSIGN (attendee, newAttendee); } - (iCalPerson *) attendee { return attendee; } - (NSString *) attendeeName { NSString *name; name = [attendee cn]; if (name && [name length]) return name; return [attendee rfc822Email]; } - (BOOL) hasSentBy { return [attendee hasSentBy]; } - (NSString *) sentBy { return [attendee sentBy]; } - (BOOL) hasAccepted { NSString *partStat; partStat = [[attendee partStat] lowercaseString]; return [partStat isEqualToString: @"accepted"]; } - (BOOL) hasDeclined { NSString *partStat; partStat = [[attendee partStat] lowercaseString]; return [partStat isEqualToString: @"declined"]; } - (BOOL) hasNotAcceptedNotDeclined { return !([self hasAccepted] || [self hasDeclined]); } - (NSCalendarDate *) startDate { NSCalendarDate *date; SOGoUser *user; NSTimeZone *tz; date = [apt startDate]; user = [[self context] activeUser]; tz = [[user userDefaults] timeZone]; [date setTimeZone: tz]; return date; } - (NSString *) summary { return [apt summary]; } - (BOOL) isSubject { return isSubject; } /* Generate Response */ - (NSString *) getSubject { NSString *subject; isSubject = 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 { NSString *body; isSubject = NO; body = [[self generateResponse] contentAsString]; return [body stringByTrimmingCharactersInSet: wsSet]; } @end @interface SOGoAptMailEnglishICalReply : SOGoAptMailICalReply @end @implementation SOGoAptMailEnglishICalReply @end @interface SOGoAptMailBrazilianPortugueseICalReply : SOGoAptMailICalReply @end @implementation SOGoAptMailBrazilianPortugueseICalReply @end @interface SOGoAptMailCzechICalReply : SOGoAptMailICalReply @end @implementation SOGoAptMailCzechICalReply @end @interface SOGoAptMailFrenchICalReply : SOGoAptMailICalReply @end @implementation SOGoAptMailFrenchICalReply @end @interface SOGoAptMailGermanICalReply : SOGoAptMailICalReply @end @implementation SOGoAptMailGermanICalReply @end @interface SOGoAptMailHungarianICalReply : SOGoAptMailICalReply @end @implementation SOGoAptMailHungarianICalReply @end @interface SOGoAptMailItalianICalReply : SOGoAptMailICalReply @end @implementation SOGoAptMailItalianICalReply @end @interface SOGoAptMailRussianICalReply : SOGoAptMailICalReply @end @implementation SOGoAptMailRussianICalReply @end @interface SOGoAptMailSpanishICalReply : SOGoAptMailICalReply @end @implementation SOGoAptMailSpanishICalReply @end @interface SOGoAptMailSwedishICalReply : SOGoAptMailICalReply @end @implementation SOGoAptMailSwedishICalReply @end @interface SOGoAptMailWelshICalReply : SOGoAptMailICalReply @end @implementation SOGoAptMailWelshICalReply @end