From 627c07b01fa1942e8845bbb397dd3cdb36feca23 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 5 Sep 2008 15:55:03 +0000 Subject: [PATCH] Monotone-Parent: 2b06dc463d88e9e0940158ceccab067e7cc497f7 Monotone-Revision: 81f6f619789306a73dc061a36ac5b92bc8ecaac6 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-09-05T15:55:03 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 ++++++++ SoObjects/Mailer/SOGoMailForward.h | 2 ++ SoObjects/Mailer/SOGoMailForward.m | 17 ++++++++++++++++- SoObjects/Mailer/SOGoMailObject+Draft.h | 1 + SoObjects/Mailer/SOGoMailObject+Draft.m | 23 ++++++++++++++++++++--- 5 files changed, 47 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 507ebc6f6..e91365fb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,18 @@ 2008-09-05 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoMailForward.m ([SOGoMailForward -init]): + added a "replyMode" ivar, used for outlook-style replying. + ([SOGoMailForward -messageBody]): if used in "reply mode", quote + the returned body. + * SoObjects/Mailer/SOGoMailObject+Draft.m ([SOGoMailObject -contentForReply]): if the reply style is outlook, then we use the content generated for inline forwarding. ([SOGoMailObject -useOutlookStyleReplies]): new method that indicates whether the ud key "SOGoMailUseOutlookStyleReplies". + ([SOGoMailObject -contentForOutlookReply]): new method, derived + from -contentForInlineForward but set the forward template in + reply-mode, to get the text in quoted form. * SoObjects/Mailer/SOGoMailFolder.m ([SOGoMailFolder -expungeLastMarkedFolder]): do not perform the expunge if the diff --git a/SoObjects/Mailer/SOGoMailForward.h b/SoObjects/Mailer/SOGoMailForward.h index e20fa5d6e..e4381da2a 100644 --- a/SoObjects/Mailer/SOGoMailForward.h +++ b/SoObjects/Mailer/SOGoMailForward.h @@ -32,9 +32,11 @@ SOGoMailObject *sourceMail; NSString *field; NSString *currentValue; + BOOL replyMode; } - (void) setForwardedMail: (SOGoMailObject *) newSourceMail; +- (void) setReplyMode: (BOOL) newReplyMode; @end diff --git a/SoObjects/Mailer/SOGoMailForward.m b/SoObjects/Mailer/SOGoMailForward.m index 49165bb64..3842121f2 100644 --- a/SoObjects/Mailer/SOGoMailForward.m +++ b/SoObjects/Mailer/SOGoMailForward.m @@ -21,6 +21,7 @@ */ #import +#import #import #import @@ -36,6 +37,7 @@ { sourceMail = nil; currentValue = nil; + replyMode = NO; } return self; @@ -53,6 +55,11 @@ ASSIGN (sourceMail, newSourceMail); } +- (void) setReplyMode: (BOOL) newReplyMode +{ + replyMode = newReplyMode; +} + - (NSString *) subject { return [sourceMail decodedSubject]; @@ -146,7 +153,15 @@ - (NSString *) messageBody { - return [sourceMail contentForEditing]; + NSString *messageBody; + + if (replyMode) + messageBody + = [[sourceMail contentForEditing] stringByApplyingMailQuoting]; + else + messageBody = [sourceMail contentForEditing]; + + return messageBody; } - (NSString *) signature diff --git a/SoObjects/Mailer/SOGoMailObject+Draft.h b/SoObjects/Mailer/SOGoMailObject+Draft.h index 706e1ca80..9f826bbcf 100644 --- a/SoObjects/Mailer/SOGoMailObject+Draft.h +++ b/SoObjects/Mailer/SOGoMailObject+Draft.h @@ -32,6 +32,7 @@ - (NSString *) subjectForReply; - (NSString *) contentForReply; +- (NSString *) contentForOutlookReply; - (NSString *) subjectForForward; - (NSString *) filenameForForward; diff --git a/SoObjects/Mailer/SOGoMailObject+Draft.m b/SoObjects/Mailer/SOGoMailObject+Draft.m index 0df47ec54..f59df5e69 100644 --- a/SoObjects/Mailer/SOGoMailObject+Draft.m +++ b/SoObjects/Mailer/SOGoMailObject+Draft.m @@ -88,7 +88,6 @@ return newSubject; } - - (NSString *) _contentForEditingFromKeys: (NSArray *) keys { NSArray *types; @@ -126,7 +125,7 @@ } } } - + return content; } @@ -151,7 +150,7 @@ SOGoMailReply *page; if ([self useOutlookStyleReplies]) - replyContent = [self contentForInlineForward]; + replyContent = [self contentForOutlookReply]; else { currentUser = [context activeUser]; @@ -166,6 +165,23 @@ return replyContent; } +- (NSString *) contentForOutlookReply +{ + SOGoUser *currentUser; + NSString *pageName; + SOGoMailForward *page; + + currentUser = [context activeUser]; + pageName = [NSString stringWithFormat: @"SOGoMail%@Forward", + [currentUser language]]; + page = [[WOApplication application] pageWithName: pageName + inContext: context]; + [page setForwardedMail: self]; + [page setReplyMode: YES]; + + return [[page generateResponse] contentAsString]; +} + - (NSString *) filenameForForward { NSString *subject; @@ -224,6 +240,7 @@ page = [[WOApplication application] pageWithName: pageName inContext: context]; [page setForwardedMail: self]; + [page setReplyMode: NO]; return [[page generateResponse] contentAsString]; }