merge of 'c31687d1f15f8f1be580514cd252776e204a1b65'

and 'd44c77e73da2480ce01afa441c8a2705f220ae25'

Monotone-Parent: c31687d1f15f8f1be580514cd252776e204a1b65
Monotone-Parent: d44c77e73da2480ce01afa441c8a2705f220ae25
Monotone-Revision: 701785bc094e6e0cc71468721c162b7ddd82fda5

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-09-30T16:50:07
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau committed 2008-09-30 16:50:07 +00:00
commit 95ee964274
34 files changed
+425 -129

No files matched your search

+1 -10
View File
@@ -47,7 +47,7 @@ static unsigned int newCount;
ud = [NSUserDefaults standardUserDefaults];
spoolFolder = [ud stringForKey:@"SOGoMailSpoolPath"];
if (![spoolFolder length])
spoolFolder = @"/tmp/";
spoolFolder = @"/tmp/";
[spoolFolder retain];
NSLog(@"Note: using SOGo mail spool folder: %@", spoolFolder);
@@ -102,14 +102,5 @@ static unsigned int newCount;
return YES;
}
- (NSString *) userSpoolFolderPath
{
NSString *login;
login = [[context activeUser] login];
return [NSString stringWithFormat: @"%@/%@",
spoolFolder, login];
}
@end
@@ -1,3 +1,8 @@
<#signaturePlacementOnTop>
<#signature/>
</#signaturePlacementOnTop>
<#outlookMode>-------- Original Message --------
Subject: <#subject/>
Date: <#date/>
@@ -8,4 +13,5 @@ From: <#from/>
<#messageBody/>
<#signature/>
<#signaturePlacementOnBottom><#signature/></#signaturePlacementOnBottom>
@@ -81,3 +81,21 @@ signature: WOString {
value = signature;
escapeHTML = NO;
}
replyPlacementOnTop: WOConditional {
condition = replyPlacementOnTop;
}
replyPlacementOnBottom: WOConditional {
condition = replyPlacementOnTop;
negate = YES;
}
signaturePlacementOnTop: WOConditional {
condition = signaturePlacementOnTop;
}
signaturePlacementOnBottom: WOConditional {
condition = signaturePlacementOnTop;
negate = YES;
}
+5
View File
@@ -24,6 +24,7 @@
#include <SoObjects/Mailer/SOGoMailBaseObject.h>
#import <Foundation/NSRange.h>
#import <NGObjWeb/WOResponse.h>
/*
SOGoMailFolder
@@ -55,6 +56,7 @@ typedef enum {
/* messages */
- (NSException *) deleteUIDs: (NSArray *) uids inContext: (id) context;
- (WOResponse *) archiveUIDs: (NSArray *) uids inContext: (id) context;
- (NSArray *) fetchUIDsMatchingQualifier: (id)_q sortOrdering: (id) _so;
- (NSArray *) fetchUIDs: (NSArray *) _uids parts: (NSArray *) _parts;
@@ -81,6 +83,9 @@ typedef enum {
- (NSArray *) allFolderPaths;
- (NSArray *) allFolderURLs;
- (NSString *) userSpoolFolderPath;
- (BOOL) ensureSpoolFolderPath;
@end
@interface SOGoSpecialMailFolder : SOGoMailFolder
+122 -12
View File
@@ -23,13 +23,16 @@
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSTask.h>
#import <NGObjWeb/NSException+HTTP.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WOResponse.h>
#import <NGExtensions/NSNull+misc.h>
#import <NGExtensions/NSURL+misc.h>
#import <NGExtensions/NSObject+Logs.h>
#import <NGExtensions/NSString+misc.h>
#import <NGExtensions/NSFileManager+Extensions.h>
#import <NGImap4/NGImap4Connection.h>
#import <NGImap4/NGImap4Client.h>
@@ -51,6 +54,8 @@ static BOOL aclUsernamesAreQuoted = NO;
/* http://www.tools.ietf.org/wg/imapext/draft-ietf-imapext-acl/ */
static BOOL aclConformsToIMAPExt = NO;
static NSString *spoolFolder = nil;
@interface NGImap4Connection (PrivateMethods)
- (NSString *) imap4FolderNameForURL: (NSURL *) url;
@@ -65,19 +70,29 @@ static BOOL aclConformsToIMAPExt = NO;
NSString *aclStyleStr;
if (aclStyle == undefined)
{
ud = [NSUserDefaults standardUserDefaults];
aclStyleStr = [ud stringForKey: @"SOGoIMAPAclStyle"];
if ([aclStyleStr isEqualToString: @"rfc2086"])
aclStyle = rfc2086;
else
aclStyle = rfc4314;
{
ud = [NSUserDefaults standardUserDefaults];
aclStyleStr = [ud stringForKey: @"SOGoIMAPAclStyle"];
if ([aclStyleStr isEqualToString: @"rfc2086"])
aclStyle = rfc2086;
else
aclStyle = rfc4314;
aclUsernamesAreQuoted
= [ud boolForKey: @"SOGoIMAPAclUsernamesAreQuoted"];
aclConformsToIMAPExt
= [ud boolForKey: @"SOGoIMAPAclConformsToIMAPExt"];
}
aclUsernamesAreQuoted
= [ud boolForKey: @"SOGoIMAPAclUsernamesAreQuoted"];
aclConformsToIMAPExt
= [ud boolForKey: @"SOGoIMAPAclConformsToIMAPExt"];
}
if (!spoolFolder)
{
spoolFolder = [ud stringForKey:@"SOGoMailSpoolPath"];
if (![spoolFolder length])
spoolFolder = @"/tmp/";
[spoolFolder retain];
NSLog(@"Note: using SOGo mail spool folder: %@", spoolFolder);
}
}
+ (SOGoIMAPAclStyle) imapAclStyle
@@ -302,6 +317,82 @@ static BOOL aclConformsToIMAPExt = NO;
return error;
}
- (WOResponse *) archiveUIDs: (NSArray *) uids
inContext: (id) localContext
{
NSException *error;
NSFileManager *fm;
NSString *spoolPath, *fileName;
NSDictionary *msgs;
NSArray *messages;
NSData *content, *zipContent;
NSTask *zipTask;
NSMutableArray *zipTaskArguments;
WOResponse *response;
int i;
spoolPath = [self userSpoolFolderPath];
if ( ![self ensureSpoolFolderPath] ) {
error = [NSException exceptionWithHTTPStatus: 500
reason: @"spoolFolderPath doesn't exist"];
return (WOResponse *)error;
}
fm = [NSFileManager defaultManager];
if ( ![fm fileExistsAtPath: @"/usr/bin/zip"] ) {
error = [NSException exceptionWithHTTPStatus: 500
reason: @"zip not available"];
return (WOResponse *)error;
}
zipTask = [[NSTask alloc] init];
[zipTask setCurrentDirectoryPath: spoolPath];
[zipTask setLaunchPath: @"/usr/bin/zip"];
zipTaskArguments = [NSMutableArray arrayWithObjects: nil];
[zipTaskArguments addObject: @"SavedMessages.zip"];
msgs = (NSDictionary *)[self fetchUIDs: uids
parts: [NSArray arrayWithObject: @"RFC822"]];
messages = [msgs objectForKey: @"fetch"];
for (i = 0; i < [messages count]; i++) {
content = [[messages objectAtIndex: i] objectForKey: @"message"];
[content writeToFile:
[NSString stringWithFormat:@"%@/%d.eml", spoolPath, [uids objectAtIndex: i]]
atomically: YES];
[zipTaskArguments addObject:
[NSString stringWithFormat:@"%d.eml", [uids objectAtIndex: i]]];
}
[zipTask setArguments: zipTaskArguments];
[zipTask launch];
[zipTask waitUntilExit];
[zipTask release];
zipContent = [[NSData alloc] initWithContentsOfFile:
[NSString stringWithFormat: @"%@/SavedMessages.zip", spoolPath]];
for(i = 0; i < [zipTaskArguments count]; i++) {
fileName = [zipTaskArguments objectAtIndex: i];
[fm removeFileAtPath:
[NSString stringWithFormat: @"%@/%@", spoolPath, fileName] handler: nil];
}
response = [[WOResponse alloc] init];
[response autorelease];
[response setHeader: @"application/zip" forKey:@"content-type"];
[response setHeader: @"attachment;filename=SavedMessages.zip" forKey: @"Content-Disposition"];
[response setContent: zipContent];
[zipContent release];
return response;
}
- (NSArray *) fetchUIDsMatchingQualifier: (id) _q
sortOrdering: (id) _so
{
@@ -891,6 +982,25 @@ static BOOL aclConformsToIMAPExt = NO;
return [userURL absoluteString];
}
- (NSString *) userSpoolFolderPath
{
NSString *login;
login = [[context activeUser] login];
return [NSString stringWithFormat: @"%@/%@",
spoolFolder, login];
}
- (BOOL) ensureSpoolFolderPath
{
NSFileManager *fm;
fm = [NSFileManager defaultManager];
return ([fm createDirectoriesAtPath: [self userSpoolFolderPath] attributes:nil]);
}
@end /* SOGoMailFolder */
@implementation SOGoSpecialMailFolder
@@ -1,3 +1,8 @@
<#signaturePlacementOnTop>
<#signature/>
</#signaturePlacementOnTop>
<#outlookMode>-------- Message original --------
Sujet: <#subject/>
Date: <#date/>
@@ -8,4 +13,5 @@ De: <#from/>
<#messageBody/>
<#signature/>
<#signaturePlacementOnBottom><#signature/></#signaturePlacementOnBottom>
@@ -81,3 +81,21 @@ signature: WOString {
value = signature;
escapeHTML = NO;
}
replyPlacementOnTop: WOConditional {
condition = replyPlacementOnTop;
}
replyPlacementOnBottom: WOConditional {
condition = replyPlacementOnTop;
negate = YES;
}
signaturePlacementOnTop: WOConditional {
condition = signaturePlacementOnTop;
}
signaturePlacementOnBottom: WOConditional {
condition = signaturePlacementOnTop;
negate = YES;
}
@@ -1,3 +1,8 @@
<#signaturePlacementOnTop>
<#signature/>
</#signaturePlacementOnTop>
<#outlookMode>-------- Original E-Mail --------
Betreff: <#subject/>
Datum: <#date/>
@@ -8,4 +13,5 @@ Sender: <#from/>
<#messageBody/>
<#signature/>
<#signaturePlacementOnBottom><#signature/></#signaturePlacementOnBottom>
@@ -81,3 +81,21 @@ signature: WOString {
value = signature;
escapeHTML = NO;
}
replyPlacementOnTop: WOConditional {
condition = replyPlacementOnTop;
}
replyPlacementOnBottom: WOConditional {
condition = replyPlacementOnTop;
negate = YES;
}
signaturePlacementOnTop: WOConditional {
condition = signaturePlacementOnTop;
}
signaturePlacementOnBottom: WOConditional {
condition = signaturePlacementOnTop;
negate = YES;
}
@@ -1,3 +1,8 @@
<#signaturePlacementOnTop>
<#signature/>
</#signaturePlacementOnTop>
<#outlookMode>-------- Messaggio originale --------
Oggetto: <#subject/>
Data: <#date/>
@@ -8,4 +13,5 @@ Da: <#from/>
<#messageBody/>
<#signature/>
<#signaturePlacementOnBottom><#signature/></#signaturePlacementOnBottom>
@@ -81,3 +81,21 @@ signature: WOString {
value = signature;
escapeHTML = NO;
}
replyPlacementOnTop: WOConditional {
condition = replyPlacementOnTop;
}
replyPlacementOnBottom: WOConditional {
condition = replyPlacementOnTop;
negate = YES;
}
signaturePlacementOnTop: WOConditional {
condition = signaturePlacementOnTop;
}
signaturePlacementOnBottom: WOConditional {
condition = signaturePlacementOnTop;
negate = YES;
}
@@ -1,3 +1,8 @@
<#signaturePlacementOnTop>
<#signature/>
</#signaturePlacementOnTop>
<#outlookMode>-------- Original Message --------
Subject: <#subject/>
Date: <#date/>
@@ -8,4 +13,5 @@ From: <#from/>
<#messageBody/>
<#signature/>
<#signaturePlacementOnBottom><#signature/></#signaturePlacementOnBottom>
@@ -81,3 +81,21 @@ signature: WOString {
value = signature;
escapeHTML = NO;
}
replyPlacementOnTop: WOConditional {
condition = replyPlacementOnTop;
}
replyPlacementOnBottom: WOConditional {
condition = replyPlacementOnTop;
negate = YES;
}
signaturePlacementOnTop: WOConditional {
condition = signaturePlacementOnTop;
}
signaturePlacementOnBottom: WOConditional {
condition = signaturePlacementOnTop;
negate = YES;
}