Added (slightly modified) patch from #2806

pull/41/head
Ludovic Marcotte 2014-06-09 09:34:00 -04:00
parent 0f04be2bcb
commit f48839bf55
4 changed files with 23 additions and 6 deletions

View File

@ -761,7 +761,7 @@ struct GlobalObjectId {
// Flags
[s appendString: @"<Flag xmlns=\"Email:\">"];
[s appendFormat: @"<FlagStatus>%d</FlagStatus>", 0];
[s appendFormat: @"<FlagStatus>%d</FlagStatus>", ([self flagged] ? 2 : 0)];
[s appendString: @"</Flag>"];
// FIXME - support these in the future
@ -799,10 +799,21 @@ struct GlobalObjectId {
if ((o = [theValues objectForKey: @"Flag"]))
{
o = [o objectForKey: @"FlagStatus"];
if ([o intValue])
[self addFlags: @"\\Flagged"];
// We must handle empty flags -> {Flag = ""; } - some ActiveSync clients, like the HTC Desire
// will send an empty Flag message when "unflagging" a mail.
if (([o isKindOfClass: [NSMutableDictionary class]]))
{
if ((o = [o objectForKey: @"FlagStatus"]))
{
// 0 = The flag is cleared.
// 1 = The status is set to complete.
// 2 = The status is set to active.
if (([o isEqualToString: @"2"]))
[self addFlags: @"\\Flagged"];
else
[self removeFlags: @"\\Flagged"];
}
}
else
[self removeFlags: @"\\Flagged"];
}

2
NEWS
View File

@ -6,7 +6,7 @@ Enhancements
- implemented the GetAttachment ActiveSync command (#2808)
Bug fixes
- better handling of empty "Flag" messages over ActiveSync (#2806)
2.2.5 (2014-06-05)
------------------

View File

@ -114,6 +114,7 @@ NSArray *SOGoMailCoreInfoKeys;
- (NSException *) removeFlags:(id)_f;
- (BOOL) isNewMail; /* \Recent */
- (BOOL) flagged; /* \Flagged */
- (BOOL) read; /* \Unseen */
- (BOOL) replied; /* \Answered */
- (BOOL) forwarded; /* $forwarded */

View File

@ -1464,6 +1464,11 @@ static BOOL debugSoParts = NO;
return [self _hasFlag: @"seen"];
}
- (BOOL) flagged
{
return [self _hasFlag: @"flagged"];
}
- (BOOL) replied
{
return [self _hasFlag: @"answered"];