1 /* SOGoMailForward.m - this file is part of SOGo
3 * Copyright (C) 2007 Inverse groupe conseil
5 * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
7 * This file is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This file is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #import <NGObjWeb/WOContext+SoObjects.h>
25 #import <SoObjects/SOGo/SOGoDateFormatter.h>
26 #import <SoObjects/SOGo/SOGoUser.h>
28 #import "SOGoMailObject+Draft.h"
29 #import "SOGoMailForward.h"
31 @implementation SOGoMailForward
35 if ((self = [super init]))
47 [currentValue release];
51 - (void) setForwardedMail: (SOGoMailObject *) newSourceMail
53 ASSIGN (sourceMail, newSourceMail);
56 - (NSString *) subject
58 return [sourceMail subject];
63 SOGoDateFormatter *formatter;
65 formatter = [[context activeUser] dateFormatterInContext: context];
67 return [formatter formattedDateAndTime: [sourceMail date]];
72 return [[sourceMail mailHeaders] objectForKey: @"from"];
75 - (NSString *) _headerField: (NSString *) fieldName
77 if (![field isEqualToString: fieldName])
79 [currentValue release];
80 currentValue = [[sourceMail mailHeaders] objectForKey: fieldName];
81 [currentValue retain];
89 return ([[self _headerField: @"reply-to"] length] > 0);
92 - (NSString *) replyTo
94 return ([NSString stringWithFormat: @"%@\n",
95 [self _headerField: @"reply-to"]]);
98 - (BOOL) hasOrganization
100 return ([[self _headerField: @"organization"] length] > 0);
103 - (NSString *) organization
105 return ([NSString stringWithFormat: @"%@\n",
106 [self _headerField: @"organization"]]);
111 return [[sourceMail mailHeaders] objectForKey: @"to"];
116 return ([[self _headerField: @"cc"] length] > 0);
121 return ([NSString stringWithFormat: @"%@\n",
122 [self _headerField: @"cc"]]);
125 - (BOOL) hasNewsGroups
127 return ([[self _headerField: @"newsgroups"] length] > 0);
130 - (NSString *) newsgroups
132 return ([NSString stringWithFormat: @"%@\n",
133 [self _headerField: @"newsgroups"]]);
136 - (BOOL) hasReferences
138 return ([[self _headerField: @"references"] length] > 0);
141 - (NSString *) references
143 return ([NSString stringWithFormat: @"%@\n",
144 [self _headerField: @"references"]]);
147 - (NSString *) messageBody
149 return [sourceMail contentForEditing];
152 - (NSString *) signature
154 NSString *signature, *mailSignature;
156 signature = [[context activeUser] signature];
157 if ([signature length])
158 mailSignature = [NSString stringWithFormat: @"--\r\n%@", signature];
162 return mailSignature;
167 @implementation SOGoMailEnglishForward
170 @implementation SOGoMailFrenchForward
173 @implementation SOGoMailGermanForward