Monotone-Parent: 81f6f619789306a73dc061a36ac5b92bc8ecaac6

Monotone-Revision: 64aa83e8cd0a166c047f31a255fba032c405fbf9

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-09-05T16:50:22
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2008-09-05 16:50:22 +00:00
parent 627c07b01f
commit 2ed91624e0
20 changed files with 475 additions and 105 deletions

View File

@ -1,18 +1,16 @@
2008-09-05 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2008-09-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Mailer/SOGoMailForward.m ([SOGoMailForward -init]): * SoObjects/Mailer/SOGoMailReply.m: made class a child of
added a "replyMode" ivar, used for outlook-style replying. SOGoMailForward, since we need to access more or less the same
([SOGoMailForward -messageBody]): if used in "reply mode", quote fields from the original message, especially in outlook reply mode.
the returned body. ([SOGoMailReply -setOutlookMode:newOutlookMode]): new accessor
defining in which mode we are.
* SoObjects/Mailer/SOGoMailObject+Draft.m ([SOGoMailObject * SoObjects/Mailer/SOGoMailObject+Draft.m ([SOGoMailObject
-contentForReply]): if the reply style is outlook, then we use the -contentForReply]): if the reply style is outlook, then we use the
content generated for inline forwarding. content generated for inline forwarding.
([SOGoMailObject -useOutlookStyleReplies]): new method that ([SOGoMailObject -useOutlookStyleReplies]): new method that
indicates whether the ud key "SOGoMailUseOutlookStyleReplies". 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 * SoObjects/Mailer/SOGoMailFolder.m ([SOGoMailFolder
-expungeLastMarkedFolder]): do not perform the expunge if the -expungeLastMarkedFolder]): do not perform the expunge if the

View File

@ -25,6 +25,7 @@
#import <NGExtensions/NGBase64Coding.h> #import <NGExtensions/NGBase64Coding.h>
#import <NGExtensions/NGQuotedPrintableCoding.h> #import <NGExtensions/NGQuotedPrintableCoding.h>
#import <NGExtensions/NGExtensions/NSString+Encoding.h>
#import "NSData+Mail.h" #import "NSData+Mail.h"

View File

@ -1,4 +1,10 @@
On <#date/>, <#from/> wrote: <#outlookMode>-------- Original Message --------
Subject: <#subject/>
Date: <#date/>
From: <#from/>
<#hasReplyTo>Reply-To: <#replyTo/></#hasReplyTo><#hasOrganization>Organization: <#organization/></#hasOrganization>To: <#to/>
<#hasCc>CC: <#cc/></#hasCc><#hasNewsGroups>Newsgroups: <#newsgroups/></#hasNewsGroups><#hasReferences>References: <#references/></#hasReferences></#outlookMode>
<#standardMode>On <#date/>, <#from/> wrote:</#standardMode>
<#messageBody/> <#messageBody/>

View File

@ -1,3 +1,17 @@
outlookMode: WOConditional {
condition = outlookMode;
}
standardMode: WOConditional {
condition = outlookMode;
negate = YES;
}
subject: WOString {
value = subject;
escapeHTML = NO;
}
date: WOString { date: WOString {
value = date; value = date;
escapeHTML = NO; escapeHTML = NO;
@ -8,6 +22,56 @@ from: WOString {
escapeHTML = NO; escapeHTML = NO;
} }
hasReplyTo: WOConditional {
condition = hasReplyTo;
}
replyTo: WOString {
value = replyTo;
escapeHTML = NO;
}
hasOrganization: WOConditional {
condition = hasOrganization;
}
organization: WOString {
value = organization;
escapeHTML = NO;
}
to: WOString {
value = to;
escapeHTML = NO;
}
hasCc: WOConditional {
condition = hasCc;
}
cc: WOString {
value = cc;
escapeHTML = NO;
}
hasNewsGroups: WOConditional {
condition = hasNewsGroups;
}
newsgroups: WOString {
value = newsgroups;
escapeHTML = NO;
}
hasReferences: WOConditional {
condition = hasReferences;
}
references: WOString {
value = references;
escapeHTML = NO;
}
messageBody: WOString { messageBody: WOString {
value = messageBody; value = messageBody;
escapeHTML = NO; escapeHTML = NO;

View File

@ -1,4 +1,10 @@
On <#date/>, <#from/> wrote: <#outlookMode>-------- Original Message --------
Subject: <#subject/>
Date: <#date/>
From: <#from/>
<#hasReplyTo>Reply-To: <#replyTo/></#hasReplyTo><#hasOrganization>Organization: <#organization/></#hasOrganization>To: <#to/>
<#hasCc>CC: <#cc/></#hasCc><#hasNewsGroups>Newsgroups: <#newsgroups/></#hasNewsGroups><#hasReferences>References: <#references/></#hasReferences></#outlookMode>
<#standardMode>On <#date/>, <#from/> wrote:</#standardMode>
<#messageBody/> <#messageBody/>

View File

@ -1,3 +1,17 @@
outlookMode: WOConditional {
condition = outlookMode;
}
standardMode: WOConditional {
condition = outlookMode;
negate = YES;
}
subject: WOString {
value = subject;
escapeHTML = NO;
}
date: WOString { date: WOString {
value = date; value = date;
escapeHTML = NO; escapeHTML = NO;
@ -8,6 +22,56 @@ from: WOString {
escapeHTML = NO; escapeHTML = NO;
} }
hasReplyTo: WOConditional {
condition = hasReplyTo;
}
replyTo: WOString {
value = replyTo;
escapeHTML = NO;
}
hasOrganization: WOConditional {
condition = hasOrganization;
}
organization: WOString {
value = organization;
escapeHTML = NO;
}
to: WOString {
value = to;
escapeHTML = NO;
}
hasCc: WOConditional {
condition = hasCc;
}
cc: WOString {
value = cc;
escapeHTML = NO;
}
hasNewsGroups: WOConditional {
condition = hasNewsGroups;
}
newsgroups: WOString {
value = newsgroups;
escapeHTML = NO;
}
hasReferences: WOConditional {
condition = hasReferences;
}
references: WOString {
value = references;
escapeHTML = NO;
}
messageBody: WOString { messageBody: WOString {
value = messageBody; value = messageBody;
escapeHTML = NO; escapeHTML = NO;

View File

@ -32,14 +32,15 @@
SOGoMailObject *sourceMail; SOGoMailObject *sourceMail;
NSString *field; NSString *field;
NSString *currentValue; NSString *currentValue;
BOOL replyMode;
} }
- (void) setForwardedMail: (SOGoMailObject *) newSourceMail; - (void) setSourceMail: (SOGoMailObject *) newSourceMail;
- (void) setReplyMode: (BOOL) newReplyMode;
@end @end
@interface SOGoMailDutchForward : SOGoMailForward
@end
@interface SOGoMailEnglishForward : SOGoMailForward @interface SOGoMailEnglishForward : SOGoMailForward
@end @end
@ -52,4 +53,7 @@
@interface SOGoMailItalianForward : SOGoMailForward @interface SOGoMailItalianForward : SOGoMailForward
@end @end
@interface SOGoMailSpanishForward : SOGoMailForward
@end
#endif /* SOGOMAILFORWARD_H */ #endif /* SOGOMAILFORWARD_H */

View File

@ -21,7 +21,6 @@
*/ */
#import <NGObjWeb/WOContext+SoObjects.h> #import <NGObjWeb/WOContext+SoObjects.h>
#import <NGExtensions/NSString+misc.h>
#import <SoObjects/SOGo/SOGoDateFormatter.h> #import <SoObjects/SOGo/SOGoDateFormatter.h>
#import <SoObjects/SOGo/SOGoUser.h> #import <SoObjects/SOGo/SOGoUser.h>
@ -37,7 +36,6 @@
{ {
sourceMail = nil; sourceMail = nil;
currentValue = nil; currentValue = nil;
replyMode = NO;
} }
return self; return self;
@ -50,16 +48,11 @@
[super dealloc]; [super dealloc];
} }
- (void) setForwardedMail: (SOGoMailObject *) newSourceMail - (void) setSourceMail: (SOGoMailObject *) newSourceMail
{ {
ASSIGN (sourceMail, newSourceMail); ASSIGN (sourceMail, newSourceMail);
} }
- (void) setReplyMode: (BOOL) newReplyMode
{
replyMode = newReplyMode;
}
- (NSString *) subject - (NSString *) subject
{ {
return [sourceMail decodedSubject]; return [sourceMail decodedSubject];
@ -153,15 +146,7 @@
- (NSString *) messageBody - (NSString *) messageBody
{ {
NSString *messageBody; return [sourceMail contentForEditing];
if (replyMode)
messageBody
= [[sourceMail contentForEditing] stringByApplyingMailQuoting];
else
messageBody = [sourceMail contentForEditing];
return messageBody;
} }
- (NSString *) signature - (NSString *) signature
@ -179,6 +164,9 @@
@end @end
@implementation SOGoMailDutchForward
@end
@implementation SOGoMailEnglishForward @implementation SOGoMailEnglishForward
@end @end
@ -191,3 +179,5 @@
@implementation SOGoMailItalianForward @implementation SOGoMailItalianForward
@end @end
@implementation SOGoMailSpanishForward
@end

View File

@ -1,4 +1,10 @@
Le <#date/>, <#from/> a écrit: <#outlookMode>-------- Original Message --------
Subject: <#subject/>
Date: <#date/>
From: <#from/>
<#hasReplyTo>Reply-To: <#replyTo/></#hasReplyTo><#hasOrganization>Organization: <#organization/></#hasOrganization>To: <#to/>
<#hasCc>CC: <#cc/></#hasCc><#hasNewsGroups>Newsgroups: <#newsgroups/></#hasNewsGroups><#hasReferences>References: <#references/></#hasReferences></#outlookMode>
<#standardMode>Le <#date/>, <#from/> a écrit:</#standardMode>
<#messageBody/> <#messageBody/>

View File

@ -1,3 +1,17 @@
outlookMode: WOConditional {
condition = outlookMode;
}
standardMode: WOConditional {
condition = outlookMode;
negate = YES;
}
subject: WOString {
value = subject;
escapeHTML = NO;
}
date: WOString { date: WOString {
value = date; value = date;
escapeHTML = NO; escapeHTML = NO;
@ -8,6 +22,56 @@ from: WOString {
escapeHTML = NO; escapeHTML = NO;
} }
hasReplyTo: WOConditional {
condition = hasReplyTo;
}
replyTo: WOString {
value = replyTo;
escapeHTML = NO;
}
hasOrganization: WOConditional {
condition = hasOrganization;
}
organization: WOString {
value = organization;
escapeHTML = NO;
}
to: WOString {
value = to;
escapeHTML = NO;
}
hasCc: WOConditional {
condition = hasCc;
}
cc: WOString {
value = cc;
escapeHTML = NO;
}
hasNewsGroups: WOConditional {
condition = hasNewsGroups;
}
newsgroups: WOString {
value = newsgroups;
escapeHTML = NO;
}
hasReferences: WOConditional {
condition = hasReferences;
}
references: WOString {
value = references;
escapeHTML = NO;
}
messageBody: WOString { messageBody: WOString {
value = messageBody; value = messageBody;
escapeHTML = NO; escapeHTML = NO;

View File

@ -1,4 +1,10 @@
On <#date/>, <#from/> wrote: <#outlookMode>-------- Original Message --------
Subject: <#subject/>
Date: <#date/>
From: <#from/>
<#hasReplyTo>Reply-To: <#replyTo/></#hasReplyTo><#hasOrganization>Organization: <#organization/></#hasOrganization>To: <#to/>
<#hasCc>CC: <#cc/></#hasCc><#hasNewsGroups>Newsgroups: <#newsgroups/></#hasNewsGroups><#hasReferences>References: <#references/></#hasReferences></#outlookMode>
<#standardMode>On <#date/>, <#from/> wrote:</#standardMode>
<#messageBody/> <#messageBody/>

View File

@ -1,3 +1,17 @@
outlookMode: WOConditional {
condition = outlookMode;
}
standardMode: WOConditional {
condition = outlookMode;
negate = YES;
}
subject: WOString {
value = subject;
escapeHTML = NO;
}
date: WOString { date: WOString {
value = date; value = date;
escapeHTML = NO; escapeHTML = NO;
@ -8,6 +22,56 @@ from: WOString {
escapeHTML = NO; escapeHTML = NO;
} }
hasReplyTo: WOConditional {
condition = hasReplyTo;
}
replyTo: WOString {
value = replyTo;
escapeHTML = NO;
}
hasOrganization: WOConditional {
condition = hasOrganization;
}
organization: WOString {
value = organization;
escapeHTML = NO;
}
to: WOString {
value = to;
escapeHTML = NO;
}
hasCc: WOConditional {
condition = hasCc;
}
cc: WOString {
value = cc;
escapeHTML = NO;
}
hasNewsGroups: WOConditional {
condition = hasNewsGroups;
}
newsgroups: WOString {
value = newsgroups;
escapeHTML = NO;
}
hasReferences: WOConditional {
condition = hasReferences;
}
references: WOString {
value = references;
escapeHTML = NO;
}
messageBody: WOString { messageBody: WOString {
value = messageBody; value = messageBody;
escapeHTML = NO; escapeHTML = NO;

View File

@ -1,4 +1,10 @@
Il giorno <#date/>, <#from/> ha scritto: <#outlookMode>-------- Original Message --------
Subject: <#subject/>
Date: <#date/>
From: <#from/>
<#hasReplyTo>Reply-To: <#replyTo/></#hasReplyTo><#hasOrganization>Organization: <#organization/></#hasOrganization>To: <#to/>
<#hasCc>CC: <#cc/></#hasCc><#hasNewsGroups>Newsgroups: <#newsgroups/></#hasNewsGroups><#hasReferences>References: <#references/></#hasReferences></#outlookMode>
<#standardMode>Il giorno <#date/>, <#from/> ha scritto:</#standardMode>
<#messageBody/> <#messageBody/>

View File

@ -1,4 +1,18 @@
date: WOString { outlookMode: WOConditional {
condition = outlookMode;
}
standardMode: WOConditional {
condition = outlookMode;
negate = YES;
}
subject: WOString {
value = subject;
escapeHTML = NO;
}
date: WOString {
value = date; value = date;
escapeHTML = NO; escapeHTML = NO;
} }
@ -8,6 +22,56 @@ from: WOString {
escapeHTML = NO; escapeHTML = NO;
} }
hasReplyTo: WOConditional {
condition = hasReplyTo;
}
replyTo: WOString {
value = replyTo;
escapeHTML = NO;
}
hasOrganization: WOConditional {
condition = hasOrganization;
}
organization: WOString {
value = organization;
escapeHTML = NO;
}
to: WOString {
value = to;
escapeHTML = NO;
}
hasCc: WOConditional {
condition = hasCc;
}
cc: WOString {
value = cc;
escapeHTML = NO;
}
hasNewsGroups: WOConditional {
condition = hasNewsGroups;
}
newsgroups: WOString {
value = newsgroups;
escapeHTML = NO;
}
hasReferences: WOConditional {
condition = hasReferences;
}
references: WOString {
value = references;
escapeHTML = NO;
}
messageBody: WOString { messageBody: WOString {
value = messageBody; value = messageBody;
escapeHTML = NO; escapeHTML = NO;

View File

@ -32,7 +32,6 @@
- (NSString *) subjectForReply; - (NSString *) subjectForReply;
- (NSString *) contentForReply; - (NSString *) contentForReply;
- (NSString *) contentForOutlookReply;
- (NSString *) subjectForForward; - (NSString *) subjectForForward;
- (NSString *) filenameForForward; - (NSString *) filenameForForward;

View File

@ -88,6 +88,7 @@
return newSubject; return newSubject;
} }
- (NSString *) _contentForEditingFromKeys: (NSArray *) keys - (NSString *) _contentForEditingFromKeys: (NSArray *) keys
{ {
NSArray *types; NSArray *types;
@ -125,7 +126,7 @@
} }
} }
} }
return content; return content;
} }
@ -146,39 +147,17 @@
- (NSString *) contentForReply - (NSString *) contentForReply
{ {
SOGoUser *currentUser; SOGoUser *currentUser;
NSString *pageName, *replyContent; NSString *pageName;
SOGoMailReply *page; SOGoMailReply *page;
if ([self useOutlookStyleReplies])
replyContent = [self contentForOutlookReply];
else
{
currentUser = [context activeUser];
pageName = [NSString stringWithFormat: @"SOGoMail%@Reply",
[currentUser language]];
page = [[WOApplication application] pageWithName: pageName
inContext: context];
[page setRepliedMail: self];
replyContent = [[page generateResponse] contentAsString];
}
return replyContent;
}
- (NSString *) contentForOutlookReply
{
SOGoUser *currentUser;
NSString *pageName;
SOGoMailForward *page;
currentUser = [context activeUser]; currentUser = [context activeUser];
pageName = [NSString stringWithFormat: @"SOGoMail%@Forward", pageName = [NSString stringWithFormat: @"SOGoMail%@Reply",
[currentUser language]]; [currentUser language]];
page = [[WOApplication application] pageWithName: pageName page = [[WOApplication application] pageWithName: pageName
inContext: context]; inContext: context];
[page setForwardedMail: self]; [page setSourceMail: self];
[page setReplyMode: YES]; [page setOutlookMode: [self useOutlookStyleReplies]];
return [[page generateResponse] contentAsString]; return [[page generateResponse] contentAsString];
} }
@ -239,8 +218,7 @@
[currentUser language]]; [currentUser language]];
page = [[WOApplication application] pageWithName: pageName page = [[WOApplication application] pageWithName: pageName
inContext: context]; inContext: context];
[page setForwardedMail: self]; [page setSourceMail: self];
[page setReplyMode: NO];
return [[page generateResponse] contentAsString]; return [[page generateResponse] contentAsString];
} }

View File

@ -23,21 +23,23 @@
#ifndef SOGOMAILREPLY_H #ifndef SOGOMAILREPLY_H
#define SOGOMAILREPLY_H #define SOGOMAILREPLY_H
#import <NGObjWeb/SoComponent.h> #import "SOGoMailForward.h"
@class SOGoMailObject; @class SOGoMailObject;
@interface SOGoMailReply : SoComponent @interface SOGoMailReply : SOGoMailForward
{ {
SOGoMailObject *sourceMail; BOOL outlookMode;
NSString *field;
NSString *currentValue;
} }
- (void) setRepliedMail: (SOGoMailObject *) newSourceMail; - (void) setOutlookMode: (BOOL) newOutlookMode;
- (BOOL) outlookMode;
@end @end
@interface SOGoMailDutchReply : SOGoMailReply
@end
@interface SOGoMailEnglishReply : SOGoMailReply @interface SOGoMailEnglishReply : SOGoMailReply
@end @end
@ -50,4 +52,7 @@
@interface SOGoMailItalianReply : SOGoMailReply @interface SOGoMailItalianReply : SOGoMailReply
@end @end
@interface SOGoMailSpanishReply : SOGoMailReply
@end
#endif /* SOGOMAILREPLY_H */ #endif /* SOGOMAILREPLY_H */

View File

@ -35,37 +35,20 @@
{ {
if ((self = [super init])) if ((self = [super init]))
{ {
sourceMail = nil; outlookMode = NO;
currentValue = nil;
} }
return self; return self;
} }
- (void) dealloc - (void) setOutlookMode: (BOOL) newOutlookMode
{ {
[sourceMail release]; outlookMode = newOutlookMode;
[currentValue release];
[super dealloc];
} }
- (void) setRepliedMail: (SOGoMailObject *) newSourceMail - (BOOL) outlookMode
{ {
ASSIGN (sourceMail, newSourceMail); return outlookMode;
}
- (NSString *) date
{
SOGoDateFormatter *formatter;
formatter = [[context activeUser] dateFormatterInContext: context];
return [formatter formattedDateAndTime: [sourceMail date]];
}
- (NSString *) from
{
return [[sourceMail mailHeaders] objectForKey: @"from"];
} }
- (NSString *) messageBody - (NSString *) messageBody
@ -87,19 +70,9 @@
return [s stringByApplyingMailQuoting]; return [s stringByApplyingMailQuoting];
} }
- (NSString *) signature @end
{
NSString *signature, *mailSignature;
signature = [[context activeUser] signature];
if ([signature length])
mailSignature = [NSString stringWithFormat: @"-- \n%@", signature];
else
mailSignature = @"";
return mailSignature;
}
@implementation SOGoMailDutchReply
@end @end
@implementation SOGoMailEnglishReply @implementation SOGoMailEnglishReply
@ -114,3 +87,5 @@
@implementation SOGoMailItalianReply @implementation SOGoMailItalianReply
@end @end
@implementation SOGoMailSpanishReply
@end

View File

@ -1,4 +1,10 @@
On <#date/>, <#from/> wrote: <#outlookMode>-------- Original Message --------
Subject: <#subject/>
Date: <#date/>
From: <#from/>
<#hasReplyTo>Reply-To: <#replyTo/></#hasReplyTo><#hasOrganization>Organization: <#organization/></#hasOrganization>To: <#to/>
<#hasCc>CC: <#cc/></#hasCc><#hasNewsGroups>Newsgroups: <#newsgroups/></#hasNewsGroups><#hasReferences>References: <#references/></#hasReferences></#outlookMode>
<#standardMode>On <#date/>, <#from/> wrote:</#standardMode>
<#messageBody/> <#messageBody/>

View File

@ -1,3 +1,17 @@
outlookMode: WOConditional {
condition = outlookMode;
}
standardMode: WOConditional {
condition = outlookMode;
negate = YES;
}
subject: WOString {
value = subject;
escapeHTML = NO;
}
date: WOString { date: WOString {
value = date; value = date;
escapeHTML = NO; escapeHTML = NO;
@ -8,6 +22,56 @@ from: WOString {
escapeHTML = NO; escapeHTML = NO;
} }
hasReplyTo: WOConditional {
condition = hasReplyTo;
}
replyTo: WOString {
value = replyTo;
escapeHTML = NO;
}
hasOrganization: WOConditional {
condition = hasOrganization;
}
organization: WOString {
value = organization;
escapeHTML = NO;
}
to: WOString {
value = to;
escapeHTML = NO;
}
hasCc: WOConditional {
condition = hasCc;
}
cc: WOString {
value = cc;
escapeHTML = NO;
}
hasNewsGroups: WOConditional {
condition = hasNewsGroups;
}
newsgroups: WOString {
value = newsgroups;
escapeHTML = NO;
}
hasReferences: WOConditional {
condition = hasReferences;
}
references: WOString {
value = references;
escapeHTML = NO;
}
messageBody: WOString { messageBody: WOString {
value = messageBody; value = messageBody;
escapeHTML = NO; escapeHTML = NO;