(feat) new junk/not junk capability with generic SMTP integration
This commit is contained in:
parent
04c68e0674
commit
7ca66b4078
|
@ -1630,6 +1630,16 @@ Defaults to `Trash` when unset.
|
||||||
Use a `/` as a hierarchy separator if referring to an IMAP subfolder.
|
Use a `/` as a hierarchy separator if referring to an IMAP subfolder.
|
||||||
For example: `INBOX/Trash`.
|
For example: `INBOX/Trash`.
|
||||||
|
|
||||||
|
|U |SOGoJunkFolderName
|
||||||
|
|Parameter used to set the IMAP folder name used to store junk
|
||||||
|
messages.
|
||||||
|
|
||||||
|
Defaults to `Junk` when unset.
|
||||||
|
|
||||||
|
Use a `/` as a hierarchy separator if referring to an IMAP subfolder.
|
||||||
|
For example: `INBOX/Junk`. Also see the SOGoMailJunkSettings for
|
||||||
|
more options regarding junk/not-junk actions.
|
||||||
|
|
||||||
|D |SOGoIMAPCASServiceName
|
|D |SOGoIMAPCASServiceName
|
||||||
|Parameter used to set the CAS service name (URL) of the imap service.
|
|Parameter used to set the CAS service name (URL) of the imap service.
|
||||||
This is useful if SOGo is connecting to the IMAP service through a
|
This is useful if SOGo is connecting to the IMAP service through a
|
||||||
|
@ -2084,7 +2094,17 @@ Defaults to `%{FolderName} (%{UserName} <%{Email}>)` when unset.
|
||||||
the template named `UIxAdditionalPreferences.wox`. This template should
|
the template named `UIxAdditionalPreferences.wox`. This template should
|
||||||
be put under `~sogo/GNUstep/Library/SOGo/Templates/PreferencesUI/`.
|
be put under `~sogo/GNUstep/Library/SOGo/Templates/PreferencesUI/`.
|
||||||
|
|
||||||
Defaults to `NO` when unset.
|
|D |SOGoMailJunkSettings
|
||||||
|
|Parameter used to enable email junk settings. The value is a dictionary
|
||||||
|
and the follow keys are supported: `vendor` (which must be set to "generic"
|
||||||
|
for now), `junkEmailAddress` which sets the email address to whom SOGo will
|
||||||
|
send junk mails to, `notJunkEmailAddress` which sets the email address to
|
||||||
|
whome SOGo will send non-junk mails to and `limit`, which is an integer value
|
||||||
|
and sets the maximum number of mails that will be attached to a
|
||||||
|
junk/not junk report sent by SOGo. Example: `SOGoMailJunkSettings = {
|
||||||
|
vendor = "generic"; junkEmailAddress = "spam@foo.com";
|
||||||
|
notJunkEmailAddress = "ham@foo.com"; limit = 10;
|
||||||
|
};`
|
||||||
|=======================================================================
|
|=======================================================================
|
||||||
|
|
||||||
SOGo Configuration Summary
|
SOGo Configuration Summary
|
||||||
|
@ -2113,6 +2133,7 @@ like this:
|
||||||
SOGoDraftsFolderName = Drafts;
|
SOGoDraftsFolderName = Drafts;
|
||||||
SOGoSentFolderName = Sent;
|
SOGoSentFolderName = Sent;
|
||||||
SOGoTrashFolderName = Trash;
|
SOGoTrashFolderName = Trash;
|
||||||
|
SOGoJunkFolderName = Junk;
|
||||||
SOGoMailingMechanism = smtp;
|
SOGoMailingMechanism = smtp;
|
||||||
SOGoSMTPServer = 127.0.0.1;
|
SOGoSMTPServer = 127.0.0.1;
|
||||||
SOGoUserSources = (
|
SOGoUserSources = (
|
||||||
|
|
6
NEWS
6
NEWS
|
@ -1,3 +1,9 @@
|
||||||
|
2.3.7 (2016-01-XX)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
New features
|
||||||
|
- new junk/not junk capability with generic SMTP integration
|
||||||
|
|
||||||
2.3.6 (2016-01-18)
|
2.3.6 (2016-01-18)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ Mailer_OBJC_FILES += \
|
||||||
SOGoSentFolder.m \
|
SOGoSentFolder.m \
|
||||||
SOGoDraftsFolder.m \
|
SOGoDraftsFolder.m \
|
||||||
SOGoTrashFolder.m \
|
SOGoTrashFolder.m \
|
||||||
|
SOGoJunkFolder.m \
|
||||||
\
|
\
|
||||||
SOGoMailBodyPart.m \
|
SOGoMailBodyPart.m \
|
||||||
SOGoHTMLMailBodyPart.m \
|
SOGoHTMLMailBodyPart.m \
|
||||||
|
|
30
SoObjects/Mailer/SOGoJunkFolder.h
Normal file
30
SoObjects/Mailer/SOGoJunkFolder.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2007-2016 Inverse inc.
|
||||||
|
|
||||||
|
This file is part of SOGo.
|
||||||
|
|
||||||
|
SOGo is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU Lesser General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2, or (at your option) any
|
||||||
|
later version.
|
||||||
|
|
||||||
|
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with OGo; see the file COPYING. If not, write to the
|
||||||
|
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __Mailer_SOGoJunkFolder_H__
|
||||||
|
#define __Mailer_SOGoJunkFolder_H__
|
||||||
|
|
||||||
|
#import "SOGoMailFolder.h"
|
||||||
|
|
||||||
|
@interface SOGoJunkFolder : SOGoSpecialMailFolder
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* __Mailer_SOGoJunkFolder_H__ */
|
26
SoObjects/Mailer/SOGoJunkFolder.m
Normal file
26
SoObjects/Mailer/SOGoJunkFolder.m
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2007-2016 Inverse inc.
|
||||||
|
|
||||||
|
This file is part of SOGo.
|
||||||
|
|
||||||
|
SOGo is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU Lesser General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2, or (at your option) any
|
||||||
|
later version.
|
||||||
|
|
||||||
|
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with OGo; see the file COPYING. If not, write to the
|
||||||
|
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "SOGoJunkFolder.h"
|
||||||
|
|
||||||
|
@implementation SOGoJunkFolder
|
||||||
|
|
||||||
|
@end /* SOGoJunkFolder */
|
|
@ -42,6 +42,7 @@
|
||||||
@class SOGoDraftsFolder;
|
@class SOGoDraftsFolder;
|
||||||
@class SOGoSentFolder;
|
@class SOGoSentFolder;
|
||||||
@class SOGoTrashFolder;
|
@class SOGoTrashFolder;
|
||||||
|
@class SOGoJunkFolder;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
undefined = -1,
|
undefined = -1,
|
||||||
|
@ -55,6 +56,7 @@ typedef enum {
|
||||||
SOGoDraftsFolder *draftsFolder;
|
SOGoDraftsFolder *draftsFolder;
|
||||||
SOGoSentFolder *sentFolder;
|
SOGoSentFolder *sentFolder;
|
||||||
SOGoTrashFolder *trashFolder;
|
SOGoTrashFolder *trashFolder;
|
||||||
|
SOGoJunkFolder *junkFolder;
|
||||||
SOGoIMAPAclStyle imapAclStyle;
|
SOGoIMAPAclStyle imapAclStyle;
|
||||||
NSMutableArray *identities;
|
NSMutableArray *identities;
|
||||||
NSString *otherUsersFolderName;
|
NSString *otherUsersFolderName;
|
||||||
|
@ -95,11 +97,13 @@ typedef enum {
|
||||||
- (NSString *) trashFolderNameInContext: (id)_ctx;
|
- (NSString *) trashFolderNameInContext: (id)_ctx;
|
||||||
- (NSString *) otherUsersFolderNameInContext: (id)_ctx;
|
- (NSString *) otherUsersFolderNameInContext: (id)_ctx;
|
||||||
- (NSString *) sharedFoldersNameInContext: (id)_ctx;
|
- (NSString *) sharedFoldersNameInContext: (id)_ctx;
|
||||||
|
- (NSString *) junkFolderNameInContext: (id)_ctx;
|
||||||
|
|
||||||
- (SOGoMailFolder *) inboxFolderInContext: (id)_ctx;
|
- (SOGoMailFolder *) inboxFolderInContext: (id)_ctx;
|
||||||
- (SOGoDraftsFolder *) draftsFolderInContext: (id)_ctx;
|
- (SOGoDraftsFolder *) draftsFolderInContext: (id)_ctx;
|
||||||
- (SOGoSentFolder *) sentFolderInContext: (id)_ctx;
|
- (SOGoSentFolder *) sentFolderInContext: (id)_ctx;
|
||||||
- (SOGoTrashFolder *) trashFolderInContext: (id)_ctx;
|
- (SOGoTrashFolder *) trashFolderInContext: (id)_ctx;
|
||||||
|
- (SOGoJunkFolder *) junkFolderInContext: (id)_ctx;
|
||||||
|
|
||||||
/* namespaces */
|
/* namespaces */
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
Copyright (C) 2004-2005 SKYRIX Software AG
|
||||||
Copyright (C) 2007-2014 Inverse inc.
|
Copyright (C) 2007-2016 Inverse inc.
|
||||||
|
|
||||||
This file is part of SOGo.
|
This file is part of SOGo.
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@
|
||||||
#import "SOGoMailNamespace.h"
|
#import "SOGoMailNamespace.h"
|
||||||
#import "SOGoSentFolder.h"
|
#import "SOGoSentFolder.h"
|
||||||
#import "SOGoTrashFolder.h"
|
#import "SOGoTrashFolder.h"
|
||||||
|
#import "SOGoJunkFolder.h"
|
||||||
#import "SOGoUser+Mailer.h"
|
#import "SOGoUser+Mailer.h"
|
||||||
|
|
||||||
#import "SOGoMailAccount.h"
|
#import "SOGoMailAccount.h"
|
||||||
|
@ -78,6 +79,7 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
draftsFolder = nil;
|
draftsFolder = nil;
|
||||||
sentFolder = nil;
|
sentFolder = nil;
|
||||||
trashFolder = nil;
|
trashFolder = nil;
|
||||||
|
junkFolder = nil;
|
||||||
imapAclStyle = undefined;
|
imapAclStyle = undefined;
|
||||||
identities = nil;
|
identities = nil;
|
||||||
otherUsersFolderName = nil;
|
otherUsersFolderName = nil;
|
||||||
|
@ -93,6 +95,7 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
[draftsFolder release];
|
[draftsFolder release];
|
||||||
[sentFolder release];
|
[sentFolder release];
|
||||||
[trashFolder release];
|
[trashFolder release];
|
||||||
|
[junkFolder release];
|
||||||
[identities release];
|
[identities release];
|
||||||
[otherUsersFolderName release];
|
[otherUsersFolderName release];
|
||||||
[sharedFoldersName release];
|
[sharedFoldersName release];
|
||||||
|
@ -366,6 +369,7 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
[self draftsFolderNameInContext: context],
|
[self draftsFolderNameInContext: context],
|
||||||
[self sentFolderNameInContext: context],
|
[self sentFolderNameInContext: context],
|
||||||
[self trashFolderNameInContext: context],
|
[self trashFolderNameInContext: context],
|
||||||
|
[self junkFolderNameInContext: context],
|
||||||
nil] stringsWithFormat: @"/%@"];
|
nil] stringsWithFormat: @"/%@"];
|
||||||
folders = [[self imap4Connection] allFoldersForURL: [self imap4URL]
|
folders = [[self imap4Connection] allFoldersForURL: [self imap4URL]
|
||||||
onlySubscribedFolders: subscribedOnly];
|
onlySubscribedFolders: subscribedOnly];
|
||||||
|
@ -408,6 +412,8 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
folderType = @"sent";
|
folderType = @"sent";
|
||||||
else if ([folderName isEqualToString: [NSString stringWithFormat: @"/%@", [self trashFolderNameInContext: context]]])
|
else if ([folderName isEqualToString: [NSString stringWithFormat: @"/%@", [self trashFolderNameInContext: context]]])
|
||||||
folderType = @"trash";
|
folderType = @"trash";
|
||||||
|
else if ([folderName isEqualToString: [NSString stringWithFormat: @"/%@", [self junkFolderNameInContext: context]]])
|
||||||
|
folderType = @"junk";
|
||||||
else
|
else
|
||||||
folderType = @"folder";
|
folderType = @"folder";
|
||||||
|
|
||||||
|
@ -678,6 +684,7 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
|
|
||||||
ud = [[context activeUser] userDefaults];
|
ud = [[context activeUser] userDefaults];
|
||||||
|
|
||||||
|
// We skip the Junk folder here, as EAS doesn't know about this
|
||||||
if ([ud synchronizeOnlyDefaultMailFolders])
|
if ([ud synchronizeOnlyDefaultMailFolders])
|
||||||
folderList = [[NSArray arrayWithObjects:
|
folderList = [[NSArray arrayWithObjects:
|
||||||
[self inboxFolderNameInContext: context],
|
[self inboxFolderNameInContext: context],
|
||||||
|
@ -773,6 +780,9 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
else if ([folderName
|
else if ([folderName
|
||||||
isEqualToString: [self trashFolderNameInContext: _ctx]])
|
isEqualToString: [self trashFolderNameInContext: _ctx]])
|
||||||
klazz = [SOGoTrashFolder class];
|
klazz = [SOGoTrashFolder class];
|
||||||
|
else if ([folderName
|
||||||
|
isEqualToString: [self junkFolderNameInContext: _ctx]])
|
||||||
|
klazz = [SOGoJunkFolder class];
|
||||||
else
|
else
|
||||||
klazz = [SOGoMailFolder class];
|
klazz = [SOGoMailFolder class];
|
||||||
|
|
||||||
|
@ -837,6 +847,11 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
return [self _userFolderNameWithPurpose: @"Trash"];
|
return [self _userFolderNameWithPurpose: @"Trash"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) junkFolderNameInContext: (id)_ctx
|
||||||
|
{
|
||||||
|
return [self _userFolderNameWithPurpose: @"Junk"];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) otherUsersFolderNameInContext: (id)_ctx
|
- (NSString *) otherUsersFolderNameInContext: (id)_ctx
|
||||||
{
|
{
|
||||||
return otherUsersFolderName;
|
return otherUsersFolderName;
|
||||||
|
@ -935,6 +950,19 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
return trashFolder;
|
return trashFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (SOGoJunkFolder *) junkFolderInContext: (id) _ctx
|
||||||
|
{
|
||||||
|
if (!junkFolder)
|
||||||
|
{
|
||||||
|
junkFolder
|
||||||
|
= [self folderWithTraversal: [self junkFolderNameInContext: _ctx]
|
||||||
|
andClassName: @"SOGoJunkFolder"];
|
||||||
|
[trashFolder retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
return junkFolder;
|
||||||
|
}
|
||||||
|
|
||||||
/* account delegation */
|
/* account delegation */
|
||||||
- (NSArray *) delegates
|
- (NSArray *) delegates
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
Copyright (C) 2004-2005 SKYRIX Software AG
|
||||||
|
Copyright (C) 2009-2016 Inverse inc.
|
||||||
|
|
||||||
This file is part of OpenGroupware.org.
|
This file is part of SOGo.
|
||||||
|
|
||||||
OGo is free software; you can redistribute it and/or modify it under
|
SOGo is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU Lesser General Public License as published by the
|
the terms of the GNU Lesser General Public License as published by the
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
Free Software Foundation; either version 2, or (at your option) any
|
||||||
later version.
|
later version.
|
||||||
|
|
||||||
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
License for more details.
|
License for more details.
|
||||||
|
|
|
@ -77,6 +77,9 @@
|
||||||
toFolder: (NSString *) destinationFolder
|
toFolder: (NSString *) destinationFolder
|
||||||
inContext: (id) localContext;
|
inContext: (id) localContext;
|
||||||
|
|
||||||
|
- (WOResponse *) markMessagesAsJunkOrNotJunk: (NSArray *) uids
|
||||||
|
junk: (BOOL) isJunk;
|
||||||
|
|
||||||
- (NSException *) postData: (NSData *) _data flags: (id) _flags;
|
- (NSException *) postData: (NSData *) _data flags: (id) _flags;
|
||||||
|
|
||||||
- (void) markForExpunge;
|
- (void) markForExpunge;
|
||||||
|
@ -120,6 +123,8 @@
|
||||||
- (id) appendMessage: (NSData *) message
|
- (id) appendMessage: (NSData *) message
|
||||||
usingId: (int *) imap4id;
|
usingId: (int *) imap4id;
|
||||||
|
|
||||||
|
- (NSString *) className;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SOGoSpecialMailFolder : SOGoMailFolder
|
@interface SOGoSpecialMailFolder : SOGoMailFolder
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
#import <NGExtensions/NSString+misc.h>
|
#import <NGExtensions/NSString+misc.h>
|
||||||
#import <NGExtensions/NSFileManager+Extensions.h>
|
#import <NGExtensions/NSFileManager+Extensions.h>
|
||||||
|
#import <NGExtensions/NGHashMap.h>
|
||||||
|
#import <NGExtensions/NSCalendarDate+misc.h>
|
||||||
|
|
||||||
#import <DOM/DOMElement.h>
|
#import <DOM/DOMElement.h>
|
||||||
#import <DOM/DOMProtocols.h>
|
#import <DOM/DOMProtocols.h>
|
||||||
|
@ -42,12 +44,20 @@
|
||||||
|
|
||||||
#import <EOControl/EOSortOrdering.h>
|
#import <EOControl/EOSortOrdering.h>
|
||||||
|
|
||||||
|
#import <NGMime/NGMimeBodyPart.h>
|
||||||
|
#import <NGMime/NGMimeFileData.h>
|
||||||
|
#import <NGMime/NGMimeMultipartBody.h>
|
||||||
|
#import <NGMail/NGMimeMessage.h>
|
||||||
|
#import <NGMail/NGMimeMessageGenerator.h>
|
||||||
|
|
||||||
#import <NGImap4/NGImap4Connection.h>
|
#import <NGImap4/NGImap4Connection.h>
|
||||||
#import <NGImap4/NGImap4Client.h>
|
#import <NGImap4/NGImap4Client.h>
|
||||||
#import <NGImap4/NSString+Imap4.h>
|
#import <NGImap4/NSString+Imap4.h>
|
||||||
|
|
||||||
#import <SOGo/DOMNode+SOGo.h>
|
#import <SOGo/DOMNode+SOGo.h>
|
||||||
#import <SOGo/NSArray+Utilities.h>
|
#import <SOGo/NSArray+Utilities.h>
|
||||||
|
#import <SOGo/NSCalendarDate+SOGo.h>
|
||||||
|
#import <SOGo/SOGoDAVAuthenticator.h>
|
||||||
#import <SOGo/NSDictionary+Utilities.h>
|
#import <SOGo/NSDictionary+Utilities.h>
|
||||||
#import <SOGo/NSString+Utilities.h>
|
#import <SOGo/NSString+Utilities.h>
|
||||||
#import <SOGo/NSString+DAV.h>
|
#import <SOGo/NSString+DAV.h>
|
||||||
|
@ -60,6 +70,7 @@
|
||||||
#import <SOGo/SOGoUserSettings.h>
|
#import <SOGo/SOGoUserSettings.h>
|
||||||
#import <SOGo/WORequest+SOGo.h>
|
#import <SOGo/WORequest+SOGo.h>
|
||||||
#import <SOGo/WOResponse+SOGo.h>
|
#import <SOGo/WOResponse+SOGo.h>
|
||||||
|
#import <SOGo/SOGoMailer.h>
|
||||||
|
|
||||||
#import "EOQualifier+MailDAV.h"
|
#import "EOQualifier+MailDAV.h"
|
||||||
#import "SOGoMailObject.h"
|
#import "SOGoMailObject.h"
|
||||||
|
@ -67,6 +78,8 @@
|
||||||
#import "SOGoMailManager.h"
|
#import "SOGoMailManager.h"
|
||||||
#import "SOGoMailFolder.h"
|
#import "SOGoMailFolder.h"
|
||||||
#import "SOGoTrashFolder.h"
|
#import "SOGoTrashFolder.h"
|
||||||
|
#import "SOGoMailObject+Draft.h"
|
||||||
|
|
||||||
|
|
||||||
#define XMLNS_INVERSEDAV @"urn:inverse:params:xml:ns:inverse-dav"
|
#define XMLNS_INVERSEDAV @"urn:inverse:params:xml:ns:inverse-dav"
|
||||||
|
|
||||||
|
@ -783,6 +796,115 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (WOResponse *) markMessagesAsJunkOrNotJunk: (NSArray *) uids
|
||||||
|
junk: (BOOL) isJunk
|
||||||
|
{
|
||||||
|
NSDictionary *junkSettings;
|
||||||
|
NSString *recipient;
|
||||||
|
NSException *error;
|
||||||
|
unsigned int limit;
|
||||||
|
|
||||||
|
junkSettings = [[[context activeUser] domainDefaults] mailJunkSettings];
|
||||||
|
error = nil;
|
||||||
|
|
||||||
|
if ([[junkSettings objectForKey: @"vendor"] caseInsensitiveCompare: @"generic"] == NSOrderedSame)
|
||||||
|
{
|
||||||
|
if (isJunk)
|
||||||
|
recipient = [junkSettings objectForKey: @"junkEmailAddress"];
|
||||||
|
else
|
||||||
|
recipient = [junkSettings objectForKey: @"notJunkEmailAddress"];
|
||||||
|
|
||||||
|
limit = [[junkSettings objectForKey: @"limit"] intValue];
|
||||||
|
|
||||||
|
// If no limit is set, we only attach one mail at the time
|
||||||
|
// to reports sent by SOGo.
|
||||||
|
if (!limit)
|
||||||
|
limit = 1;
|
||||||
|
|
||||||
|
if ([recipient length])
|
||||||
|
{
|
||||||
|
NGMimeMessage *messageToSend;
|
||||||
|
SOGoMailObject *mailObject;
|
||||||
|
NGMimeBodyPart *bodyPart;
|
||||||
|
NGMutableHashMap *map;
|
||||||
|
NGMimeFileData *fdata;
|
||||||
|
NSArray *identities;
|
||||||
|
NSData *data;
|
||||||
|
id body;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
identities = [[self mailAccountFolder] identities];
|
||||||
|
|
||||||
|
for (i = 0; i < [uids count]; i++)
|
||||||
|
{
|
||||||
|
// If we are starting or reaching the limit, we create
|
||||||
|
// a new mail message
|
||||||
|
if ((i%limit) == 0)
|
||||||
|
{
|
||||||
|
map = [NGMutableHashMap hashMapWithCapacity: 5];
|
||||||
|
|
||||||
|
#warning SOPE is just plain stupid here - if you change the case of keys, it will break the encoding of fields
|
||||||
|
[map setObject: @"multipart/mixed" forKey: @"content-type"];
|
||||||
|
[map setObject: @"1.0" forKey: @"MIME-Version"];
|
||||||
|
[map setObject: [[identities objectAtIndex: 0] objectForKey: @"email"] forKey: @"from"];
|
||||||
|
[map setObject: recipient forKey: @"to"];
|
||||||
|
[map setObject: [[NSCalendarDate date] rfc822DateString] forKey: @"date"];
|
||||||
|
|
||||||
|
messageToSend = [[[NGMimeMessage alloc] initWithHeader: map] autorelease];
|
||||||
|
body = [[[NGMimeMultipartBody alloc] initWithPart: messageToSend] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
mailObject = [self lookupName: [uids objectAtIndex: i] inContext: context acquire: NO];
|
||||||
|
|
||||||
|
// We skip emails that might have disappeared before we were able
|
||||||
|
// to perform the action
|
||||||
|
if ([mailObject isKindOfClass: [NSException class]])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
map = [[[NGMutableHashMap alloc] initWithCapacity: 1] autorelease];
|
||||||
|
[map setObject: @"message/rfc822" forKey: @"content-type"];
|
||||||
|
[map setObject: @"8bit" forKey: @"content-transfer-encoding"];
|
||||||
|
[map addObject: [NSString stringWithFormat: @"attachment; filename=\"%@\"", [mailObject filenameForForward]] forKey: @"content-disposition"];
|
||||||
|
bodyPart = [[[NGMimeBodyPart alloc] initWithHeader: map] autorelease];
|
||||||
|
|
||||||
|
data = [mailObject content];
|
||||||
|
fdata = [[NGMimeFileData alloc] initWithBytes: [data bytes] length: [data length]];
|
||||||
|
|
||||||
|
[bodyPart setBody: fdata];
|
||||||
|
RELEASE(fdata);
|
||||||
|
[body addBodyPart: bodyPart];
|
||||||
|
|
||||||
|
// We reached the limit or the end of the array
|
||||||
|
if ((i%limit) == 0 || i == [uids count]-1)
|
||||||
|
{
|
||||||
|
id <SOGoAuthenticator> authenticator;
|
||||||
|
NGMimeMessageGenerator *generator;
|
||||||
|
|
||||||
|
[messageToSend setBody: body];
|
||||||
|
|
||||||
|
generator = [[[NGMimeMessageGenerator alloc] init] autorelease];
|
||||||
|
data = [generator generateMimeFromPart: messageToSend];
|
||||||
|
|
||||||
|
authenticator = [SOGoDAVAuthenticator sharedSOGoDAVAuthenticator];
|
||||||
|
|
||||||
|
error = [[SOGoMailer mailerWithDomainDefaults: [[context activeUser] domainDefaults]]
|
||||||
|
sendMailData: data
|
||||||
|
toRecipients: [NSArray arrayWithObject: recipient]
|
||||||
|
sender: [[identities objectAtIndex: 0] objectForKey: @"email"]
|
||||||
|
withAuthenticator: authenticator
|
||||||
|
inContext: context];
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSDictionary *) statusForFlags: (NSArray *) flags
|
- (NSDictionary *) statusForFlags: (NSArray *) flags
|
||||||
{
|
{
|
||||||
NGImap4Client *client;
|
NGImap4Client *client;
|
||||||
|
@ -1931,6 +2053,11 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) className
|
||||||
|
{
|
||||||
|
return NSStringFromClass([self class]);
|
||||||
|
}
|
||||||
|
|
||||||
- (id) PUTAction: (WOContext *) _ctx
|
- (id) PUTAction: (WOContext *) _ctx
|
||||||
{
|
{
|
||||||
WORequest *rq;
|
WORequest *rq;
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2005 SKYRIX Software AG
|
Copyright (C) 2005 SKYRIX Software AG
|
||||||
|
Copyright (C) 2007-2016 Inverse inc.
|
||||||
|
|
||||||
This file is part of OpenGroupware.org.
|
This file is part of SOGo
|
||||||
|
|
||||||
OGo is free software; you can redistribute it and/or modify it under
|
SOGo is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU Lesser General Public License as published by the
|
the terms of the GNU Lesser General Public License as published by the
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
Free Software Foundation; either version 2, or (at your option) any
|
||||||
later version.
|
later version.
|
||||||
|
|
||||||
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
License for more details.
|
License for more details.
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2005 SKYRIX Software AG
|
Copyright (C) 2005 SKYRIX Software AG
|
||||||
|
Copyright (C) 2007-2016 Inverse inc.
|
||||||
|
|
||||||
This file is part of OpenGroupware.org.
|
This file is part of SOGo.
|
||||||
|
|
||||||
OGo is free software; you can redistribute it and/or modify it under
|
SOGo is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU Lesser General Public License as published by the
|
the terms of the GNU Lesser General Public License as published by the
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
Free Software Foundation; either version 2, or (at your option) any
|
||||||
later version.
|
later version.
|
||||||
|
|
||||||
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
License for more details.
|
License for more details.
|
||||||
|
@ -19,8 +20,6 @@
|
||||||
02111-1307, USA.
|
02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import <Foundation/NSString.h>
|
|
||||||
|
|
||||||
#import "SOGoTrashFolder.h"
|
#import "SOGoTrashFolder.h"
|
||||||
|
|
||||||
@implementation SOGoTrashFolder
|
@implementation SOGoTrashFolder
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
SOGoSentFolderName = "Sent";
|
SOGoSentFolderName = "Sent";
|
||||||
SOGoDraftsFolderName = "Drafts";
|
SOGoDraftsFolderName = "Drafts";
|
||||||
SOGoTrashFolderName = "Trash";
|
SOGoTrashFolderName = "Trash";
|
||||||
|
SOGoJunkFolderName = "Junk";
|
||||||
|
|
||||||
SOGoMailAutoSave = "5";
|
SOGoMailAutoSave = "5";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* SOGoDomainDefaults.h - this file is part of SOGo
|
/* SOGoDomainDefaults.h - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009-2015 Inverse inc.
|
* Copyright (C) 2009-2016 Inverse inc.
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -81,6 +81,8 @@
|
||||||
- (BOOL) notifyOnPersonalModifications;
|
- (BOOL) notifyOnPersonalModifications;
|
||||||
- (BOOL) notifyOnExternalModifications;
|
- (BOOL) notifyOnExternalModifications;
|
||||||
|
|
||||||
|
- (NSDictionary *) mailJunkSettings;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* SOGODOMAINDEFAULTS_H */
|
#endif /* SOGODOMAINDEFAULTS_H */
|
||||||
|
|
|
@ -361,4 +361,9 @@
|
||||||
return [self boolForKey: @"SOGoNotifyOnExternalModifications"];
|
return [self boolForKey: @"SOGoNotifyOnExternalModifications"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *) mailJunkSettings
|
||||||
|
{
|
||||||
|
return [self objectForKey: @"SOGoMailJunkSettings"];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -797,6 +797,8 @@
|
||||||
forKey: @"Sent"];
|
forKey: @"Sent"];
|
||||||
[mailboxes setObject: [_defaults trashFolderName]
|
[mailboxes setObject: [_defaults trashFolderName]
|
||||||
forKey: @"Trash"];
|
forKey: @"Trash"];
|
||||||
|
[mailboxes setObject: [_defaults junkFolderName]
|
||||||
|
forKey: @"Junk"];
|
||||||
[mailAccount setObject: mailboxes forKey: @"mailboxes"];
|
[mailAccount setObject: mailboxes forKey: @"mailboxes"];
|
||||||
[mailboxes release];
|
[mailboxes release];
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,9 @@ extern NSString *SOGoWeekStartFirstFullWeek;
|
||||||
- (void) setTrashFolderName: (NSString *) newValue;
|
- (void) setTrashFolderName: (NSString *) newValue;
|
||||||
- (NSString *) trashFolderName;
|
- (NSString *) trashFolderName;
|
||||||
|
|
||||||
|
- (void) setJunkFolderName: (NSString *) newValue;
|
||||||
|
- (NSString *) junkFolderName;
|
||||||
|
|
||||||
- (void) setFirstDayOfWeek: (int) newValue;
|
- (void) setFirstDayOfWeek: (int) newValue;
|
||||||
- (int) firstDayOfWeek;
|
- (int) firstDayOfWeek;
|
||||||
|
|
||||||
|
|
|
@ -458,6 +458,17 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||||
stringByEncodingImap4FolderName];
|
stringByEncodingImap4FolderName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setJunkFolderName: (NSString *) newValue
|
||||||
|
{
|
||||||
|
[self setObject: newValue forKey: @"SOGoJunkFolderName"];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) junkFolderName
|
||||||
|
{
|
||||||
|
return [[self stringForKey: @"SOGoJunkFolderName"]
|
||||||
|
stringByEncodingImap4FolderName];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setFirstDayOfWeek: (int) newValue
|
- (void) setFirstDayOfWeek: (int) newValue
|
||||||
{
|
{
|
||||||
[self setInteger: newValue forKey: @"SOGoFirstDayOfWeek"];
|
[self setInteger: newValue forKey: @"SOGoFirstDayOfWeek"];
|
||||||
|
|
|
@ -140,6 +140,7 @@
|
||||||
"TrashFolderName" = "Trash";
|
"TrashFolderName" = "Trash";
|
||||||
"InboxFolderName" = "Inbox";
|
"InboxFolderName" = "Inbox";
|
||||||
"DraftsFolderName" = "Drafts";
|
"DraftsFolderName" = "Drafts";
|
||||||
|
"JunkFolderName" = "Junk";
|
||||||
"SieveFolderName" = "Filters";
|
"SieveFolderName" = "Filters";
|
||||||
"Folders" = "Folders"; /* title line */
|
"Folders" = "Folders"; /* title line */
|
||||||
/* MailMoveToPopUp */
|
/* MailMoveToPopUp */
|
||||||
|
@ -171,6 +172,7 @@
|
||||||
"Sent Messages" = "Sent Messages";
|
"Sent Messages" = "Sent Messages";
|
||||||
"Drafts" = "Drafts";
|
"Drafts" = "Drafts";
|
||||||
"Deleted Messages" = "Deleted Messages";
|
"Deleted Messages" = "Deleted Messages";
|
||||||
|
"Junk Messages" = "Junk Messages";
|
||||||
/* Message list popup menu */
|
/* Message list popup menu */
|
||||||
"Open Message In New Window" = "Open Message In New Window";
|
"Open Message In New Window" = "Open Message In New Window";
|
||||||
"Reply to Sender Only" = "Reply to Sender Only";
|
"Reply to Sender Only" = "Reply to Sender Only";
|
||||||
|
@ -186,6 +188,8 @@
|
||||||
"Print..." = "Print...";
|
"Print..." = "Print...";
|
||||||
"Delete Message" = "Delete Message";
|
"Delete Message" = "Delete Message";
|
||||||
"Delete Selected Messages" = "Delete Selected Messages";
|
"Delete Selected Messages" = "Delete Selected Messages";
|
||||||
|
"Mark the selected messages as junk" = "Mark the selected messages as junk";
|
||||||
|
"Mark the selected messages as not junk" = "Mark the selected messages as not junk";
|
||||||
/* Number of selected messages in list */
|
/* Number of selected messages in list */
|
||||||
"selected" = "selected";
|
"selected" = "selected";
|
||||||
"This Folder" = "This Folder";
|
"This Folder" = "This Folder";
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
/* UIxMailFolderActions.h - this file is part of SOGo
|
/* UIxMailFolderActions.h - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Inverse inc.
|
* Copyright (C) 2007-2016 Inverse inc.
|
||||||
*
|
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* UIxMailFolderActions.m - this file is part of SOGo
|
/* UIxMailFolderActions.m - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2013 Inverse inc.
|
* Copyright (C) 2007-2016 Inverse inc.
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -544,6 +544,11 @@
|
||||||
return [self _setFolderPurpose: @"Trash"];
|
return [self _setFolderPurpose: @"Trash"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (WOResponse *) setAsJunkFolderAction
|
||||||
|
{
|
||||||
|
return [self _setFolderPurpose: @"Junk"];
|
||||||
|
}
|
||||||
|
|
||||||
- (WOResponse *) expungeAction
|
- (WOResponse *) expungeAction
|
||||||
{
|
{
|
||||||
NSException *error;
|
NSException *error;
|
||||||
|
@ -778,5 +783,36 @@
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (WOResponse *) _markMessagesAsJunkOrNotJunk: (BOOL) isJunk
|
||||||
|
{
|
||||||
|
NSDictionary *content;
|
||||||
|
WOResponse *response;
|
||||||
|
WORequest *request;
|
||||||
|
SOGoMailFolder *co;
|
||||||
|
NSArray *uids;
|
||||||
|
|
||||||
|
request = [context request];
|
||||||
|
content = [[request contentAsString] objectFromJSONString];
|
||||||
|
uids = [NSArray arrayWithArray: [content objectForKey:@"uids"]];
|
||||||
|
|
||||||
|
co = [self clientObject];
|
||||||
|
|
||||||
|
if ([co markMessagesAsJunkOrNotJunk: uids junk: isJunk])
|
||||||
|
response = [self responseWithStatus: 500];
|
||||||
|
else
|
||||||
|
response = [self responseWith204];
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (WOResponse *) markMessagesAsJunkAction
|
||||||
|
{
|
||||||
|
return [self _markMessagesAsJunkOrNotJunk: YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (WOResponse *) markMessagesAsNotJunkAction
|
||||||
|
{
|
||||||
|
return [self _markMessagesAsJunkOrNotJunk: NO];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -167,6 +167,21 @@
|
||||||
actionClass = "UIxMailFolderActions";
|
actionClass = "UIxMailFolderActions";
|
||||||
actionName = "setAsTrashFolder";
|
actionName = "setAsTrashFolder";
|
||||||
};
|
};
|
||||||
|
setAsJunkFolder = {
|
||||||
|
protectedBy = "View";
|
||||||
|
actionClass = "UIxMailFolderActions";
|
||||||
|
actionName = "setAsJunkFolder";
|
||||||
|
};
|
||||||
|
markMessagesAsJunk = {
|
||||||
|
protectedBy = "View";
|
||||||
|
actionClass = "UIxMailFolderActions";
|
||||||
|
actionName = "markMessagesAsJunk";
|
||||||
|
};
|
||||||
|
markMessagesAsNotJunk = {
|
||||||
|
protectedBy = "View";
|
||||||
|
actionClass = "UIxMailFolderActions";
|
||||||
|
actionName = "markMessagesAsNotJunk";
|
||||||
|
};
|
||||||
userRights = {
|
userRights = {
|
||||||
protectedBy = "ReadAcls";
|
protectedBy = "ReadAcls";
|
||||||
pageName = "UIxMailUserRightsEditor";
|
pageName = "UIxMailUserRightsEditor";
|
||||||
|
|
Loading…
Reference in a new issue