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 // Flags
[s appendString: @"<Flag xmlns=\"Email:\">"]; [s appendString: @"<Flag xmlns=\"Email:\">"];
[s appendFormat: @"<FlagStatus>%d</FlagStatus>", 0]; [s appendFormat: @"<FlagStatus>%d</FlagStatus>", ([self flagged] ? 2 : 0)];
[s appendString: @"</Flag>"]; [s appendString: @"</Flag>"];
// FIXME - support these in the future // FIXME - support these in the future
@ -799,10 +799,21 @@ struct GlobalObjectId {
if ((o = [theValues objectForKey: @"Flag"])) if ((o = [theValues objectForKey: @"Flag"]))
{ {
o = [o objectForKey: @"FlagStatus"]; // 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 intValue]) if (([o isKindOfClass: [NSMutableDictionary class]]))
[self addFlags: @"\\Flagged"]; {
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 else
[self removeFlags: @"\\Flagged"]; [self removeFlags: @"\\Flagged"];
} }

2
NEWS
View File

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

View File

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

View File

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