feat(preferences): Add user preferences to enable / disable signature for new mail, reply and forward

This commit is contained in:
smizrahi committed 2023-07-26 19:38:57 +02:00
1 parent 577d991d42
commit 8582e423bd
14 files changed
+158 -46

No files matched your search

+10 -13
View File
@@ -1072,19 +1072,16 @@ static NSString *userAgent = nil;
ud = [[context activeUser] userDefaults];
// TODO: Change mailMessageForwarding for reply
if ([[ud mailMessageForwarding] isEqualToString: @"inline"])
{
[self setText: [sourceMail contentForReply]];
if ([sourceMail isEncrypted])
[self _fetchAttachmentsFromEncryptedMail: sourceMail onlyImages: YES];
else if ([sourceMail isOpaqueSigned])
[self _fetchAttachmentsFromOpaqueSignedMail: sourceMail onlyImages: YES];
else
[self _fetchAttachmentsFromMail: sourceMail onlyImages: YES];
}
[self save];
[self setText: [sourceMail contentForReply]];
if ([sourceMail isEncrypted])
[self _fetchAttachmentsFromEncryptedMail: sourceMail onlyImages: YES];
else if ([sourceMail isOpaqueSigned])
[self _fetchAttachmentsFromOpaqueSignedMail: sourceMail onlyImages: YES];
else
[self _fetchAttachmentsFromMail: sourceMail onlyImages: YES];
[self save];
[self storeInfo];
}
@@ -1135,7 +1132,7 @@ static NSString *userAgent = nil;
// TODO: use subject for filename?
// error = [newDraft saveAttachment:content withName:@"forward.eml"];
signature = [[self mailAccountFolder] signature];
if ([signature length])
if ([signature length] && [ud mailUseSignatureOnForward])
{
nl = (isHTML ? @"<br />" : @"\n");
space = (isHTML ? @"&nbsp;" : @" ");
+7 -1
View File
@@ -234,6 +234,12 @@
return [sourceMail contentForEditing];
}
- (BOOL)isSignatureEnabled {
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
return [ud mailUseSignatureOnForward];
}
- (NSString *) signature
{
BOOL fromSentMailbox;
@@ -275,7 +281,7 @@
if (identity)
{
signature = [identity objectForKey: @"signature"];
if ([signature length])
if ([signature length] && [self isSignatureEnabled])
{
nl = (htmlComposition ? @"<br />" : @"\n");
space = (htmlComposition ? @"&nbsp;" : @" ");
+8
View File
@@ -22,6 +22,8 @@
#import <NGExtensions/NSString+misc.h>
#import <NGImap4/NGImap4Envelope.h>
#import <SOGo/SOGoUserDefaults.h>
#import "SOGoMailObject+Draft.h"
#import "SOGoMailReply.h"
@@ -85,6 +87,12 @@
return s;
}
- (BOOL)isSignatureEnabled {
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
return [ud mailUseSignatureOnReply];
}
@end
@implementation SOGoMailArabicReply
+3
View File
@@ -109,6 +109,9 @@
SOGoMailMessageForwarding = "inline";
SOGoMailReplyPlacement = "below";
SOGoMailSignaturePlacement = "below";
SOGoMailUseSignatureOnNew = YES;
SOGoMailUseSignatureOnReply = YES;
SOGoMailUseSignatureOnForward = YES;
SOGoRefreshViewIntervals = ( 1, 2, 5, 10, 20, 30, 60 );
SOGoMailListViewColumnsOrder = ( "Thread", "Flagged", "Attachment", "Subject",
"From", "Unread", "Date", "Priority",
+7
View File
@@ -175,6 +175,13 @@ extern NSString *SOGoPasswordRecoverySecondaryEmail;
- (void) setMailSignaturePlacement: (NSString *) newValue;
- (NSString *) mailSignaturePlacement;
- (BOOL)mailUseSignatureOnNew;
- (void)setMailUseSignatureOnNew:(BOOL)newValue;
- (BOOL)mailUseSignatureOnReply;
- (void)setMailUseSignatureOnReply:(BOOL)newValue;
- (BOOL)mailUseSignatureOnForward;
- (void)setMailUseSignatureOnForward:(BOOL)newValue;
- (void) setAllowUserReceipt: (BOOL) allow;
- (BOOL) allowUserReceipt;
- (void) setUserReceiptNonRecipientAction: (NSString *) action;
+30
View File
@@ -707,6 +707,36 @@ NSString *SOGoPasswordRecoverySecondaryEmail = @"SecondaryEmail";
return signaturePlacement;
}
- (BOOL) mailUseSignatureOnNew
{
return [self boolForKey: @"SOGoMailUseSignatureOnNew"];
}
- (void) setMailUseSignatureOnNew: (BOOL) newValue
{
[self setBool: newValue forKey: @"SOGoMailUseSignatureOnNew"];
}
- (BOOL) mailUseSignatureOnReply
{
return [self boolForKey: @"SOGoMailUseSignatureOnReply"];
}
- (void) setMailUseSignatureOnReply: (BOOL) newValue
{
[self setBool: newValue forKey: @"SOGoMailUseSignatureOnReply"];
}
- (BOOL) mailUseSignatureOnForward
{
return [self boolForKey: @"SOGoMailUseSignatureOnForward"];
}
- (void) setMailUseSignatureOnForward: (BOOL) newValue
{
[self setBool: newValue forKey: @"SOGoMailUseSignatureOnForward"];
}
- (void) setAllowUserReceipt: (BOOL) allow
{
[self setBool: allow forKey: @"SOGoMailReceiptAllow"];