Added patch from tfu for #2995

pull/69/merge
Ludovic Marcotte 2015-02-05 16:21:27 -05:00
parent eca22caefc
commit 3731819e15
3 changed files with 92 additions and 0 deletions

View File

@ -47,6 +47,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import <NGExtensions/NSString+Encoding.h> #import <NGExtensions/NSString+Encoding.h>
#import <NGImap4/NGImap4Envelope.h> #import <NGImap4/NGImap4Envelope.h>
#import <NGImap4/NGImap4EnvelopeAddress.h> #import <NGImap4/NGImap4EnvelopeAddress.h>
#import <NGImap4/NSString+Imap4.h>
#import <NGObjWeb/WOContext+SoObjects.h> #import <NGObjWeb/WOContext+SoObjects.h>
#import <NGMime/NGMimeBodyPart.h> #import <NGMime/NGMimeBodyPart.h>
@ -57,6 +58,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import <NGMail/NGMimeMessage.h> #import <NGMail/NGMimeMessage.h>
#import <NGMail/NGMimeMessageGenerator.h> #import <NGMail/NGMimeMessageGenerator.h>
#import <Mailer/SOGoMailLabel.h>
#import <SOGo/SOGoUserDefaults.h>
#include "iCalTimeZone+ActiveSync.h" #include "iCalTimeZone+ActiveSync.h"
#include "NSData+ActiveSync.h" #include "NSData+ActiveSync.h"
#include "NSDate+ActiveSync.h" #include "NSDate+ActiveSync.h"
@ -774,6 +779,27 @@ struct GlobalObjectId {
[s appendString: @"<Flag xmlns=\"Email:\">"]; [s appendString: @"<Flag xmlns=\"Email:\">"];
[s appendFormat: @"<FlagStatus>%d</FlagStatus>", ([self flagged] ? 2 : 0)]; [s appendFormat: @"<FlagStatus>%d</FlagStatus>", ([self flagged] ? 2 : 0)];
[s appendString: @"</Flag>"]; [s appendString: @"</Flag>"];
// Categroies/Labels
NSEnumerator *categories;
categories = [[[self fetchCoreInfos] objectForKey: @"flags"] objectEnumerator];
if (categories)
{
NSString *currentFlag;
NSDictionary *v;
v = [[[context activeUser] userDefaults] mailLabelsColors];
[s appendFormat: @"<Categories xmlns=\"Email:\">"];
while ((currentFlag = [categories nextObject]))
{
if ([[v objectForKey: currentFlag] objectAtIndex:0])
[s appendFormat: @"<Category>%@</Category>", [[[v objectForKey: currentFlag] objectAtIndex:0] activeSyncRepresentationInContext: context]];
}
[s appendFormat: @"</Categories>"];
}
// FIXME - support these in the future // FIXME - support these in the future
//[s appendString: @"<ConversationId xmlns=\"Email2:\">foobar</ConversationId>"]; //[s appendString: @"<ConversationId xmlns=\"Email2:\">foobar</ConversationId>"];
@ -836,6 +862,65 @@ struct GlobalObjectId {
else else
[self removeFlags: @"seen"];; [self removeFlags: @"seen"];;
} }
if ((o = [theValues objectForKey: @"Categories"]))
{
NSEnumerator *categories;
NSString *currentFlag;
NSDictionary *v;
v = [[[context activeUser] userDefaults] mailLabelsColors];
// add categories/labels sent from client
if ([o isKindOfClass: [NSArray class]])
{
NSEnumerator *enumerator;
NSMutableArray *labels;
NSEnumerator *flags;
id key;
labels = [NSMutableArray array];
enumerator = [v keyEnumerator];
flags = [o objectEnumerator];
while ((currentFlag = [flags nextObject]))
{
while ((key = [enumerator nextObject]))
{
if (([currentFlag isEqualToString:[[v objectForKey:key] objectAtIndex:0]]))
{
[labels addObject: key];
break;
}
}
}
[self addFlags: [labels componentsJoinedByString: @" "]];
}
categories = [[[self fetchCoreInfos] objectForKey: @"flags"] objectEnumerator];
// remove all categories/labels from server which were not it the list sent from client
if (categories)
{
while ((currentFlag = [categories nextObject]))
{
// only deal with lables and don't touch flags like seen and flagged
if (([v objectForKey: currentFlag]))
{
if (![o isKindOfClass: [NSArray class]])
{
[self removeFlags: currentFlag];
}
else if (([o indexOfObject: [[v objectForKey:currentFlag] objectAtIndex:0]] == NSNotFound))
{
[self removeFlags: currentFlag];
}
}
}
}
}
} }
@end @end

View File

@ -2421,6 +2421,10 @@ Please be aware of the following limitations:
solution is to configure Outlook to use a LDAP server (over SSL) with solution is to configure Outlook to use a LDAP server (over SSL) with
authentication. Outlook 2013 also does not seem to support multiple authentication. Outlook 2013 also does not seem to support multiple
address books over ActiveSync. address books over ActiveSync.
* To successfully synchronize Outlook email categories, a corresponding
mail label (Preferences->Mail Options) has to be created manually in SOGo
for each label defined in Outlook. The name in SOGo and in Outlook must be
identical.
* Make sure you do not use a self-signed certificate. While this will * Make sure you do not use a self-signed certificate. While this will
work, Outlook will work intermittently as it will raise popups for work, Outlook will work intermittently as it will raise popups for
certificate validation, sometimes in background, preventing the user to certificate validation, sometimes in background, preventing the user to

3
NEWS
View File

@ -1,6 +1,9 @@
2.2.16 (2015-02-DD) 2.2.16 (2015-02-DD)
------------------- -------------------
Enhancements
- added support for email categories using EAS (#2995)
Bug fixes Bug fixes
- (regression) fixed sending a message when mail module is not active (#3088) - (regression) fixed sending a message when mail module is not active (#3088)
- mail lables with blanks are not handled correctly (#3078) - mail lables with blanks are not handled correctly (#3078)