From b9fdbab1b479dadb06ca489476100d8f83df789a Mon Sep 17 00:00:00 2001 From: helge Date: Thu, 7 Jul 2005 15:51:25 +0000 Subject: [PATCH] added method to store flags for MSN sequences git-svn-id: http://svn.opengroupware.org/SOPE/trunk@869 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-mime/ChangeLog | 4 ++++ sope-mime/NGImap4/ChangeLog | 5 +++++ sope-mime/NGImap4/NGImap4Client.h | 2 ++ sope-mime/NGImap4/NGImap4Client.m | 22 ++++++++++++++++++++++ sope-mime/Version | 2 +- 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/sope-mime/ChangeLog b/sope-mime/ChangeLog index 9ec18c8b..2521dd04 100644 --- a/sope-mime/ChangeLog +++ b/sope-mime/ChangeLog @@ -1,3 +1,7 @@ +2005-07-07 Helge Hess + + * NGImap4: added method to store flags for MSN sequences (v4.5.222) + 2005-07-05 Helge Hess * NGImap4ResponseNormalizer.[hm], NGImap4Client.[hm], diff --git a/sope-mime/NGImap4/ChangeLog b/sope-mime/NGImap4/ChangeLog index 258d292c..e2bbfe86 100644 --- a/sope-mime/NGImap4/ChangeLog +++ b/sope-mime/NGImap4/ChangeLog @@ -1,3 +1,8 @@ +2005-07-07 Helge Hess + + * NGImap4Client.m: added -storeFlags:forMSNs:addOrRemove: method to + change flags for a set of MSNs (instead of ranges) + 2005-04-24 Helge Hess * fixed gcc 4.0 warnings diff --git a/sope-mime/NGImap4/NGImap4Client.h b/sope-mime/NGImap4/NGImap4Client.h index 52106a3c..a99974a4 100644 --- a/sope-mime/NGImap4/NGImap4Client.h +++ b/sope-mime/NGImap4/NGImap4Client.h @@ -138,6 +138,8 @@ typedef enum { flags:(NSArray *)_flags; - (NSDictionary *)storeFrom:(unsigned)_from to:(unsigned)_to add:(NSNumber *)_add flags:(NSArray *)_flags; +- (NSDictionary *)storeFlags:(NSArray *)_flags forMSNs:(id)_msns + addOrRemove:(BOOL)_flag; - (NSDictionary *)copyUid:(unsigned)_uid toFolder:(NSString *)_folder; - (NSDictionary *)copyUids:(NSArray *)_uids toFolder:(NSString *)_folder; diff --git a/sope-mime/NGImap4/NGImap4Client.m b/sope-mime/NGImap4/NGImap4Client.m index 551678f2..40822627 100644 --- a/sope-mime/NGImap4/NGImap4Client.m +++ b/sope-mime/NGImap4/NGImap4Client.m @@ -816,6 +816,28 @@ static BOOL ImapDebugEnabled = NO; return [self->normer normalizeResponse:[self processCommand:cmd]]; } +- (NSDictionary *)storeFlags:(NSArray *)_flags forMSNs:(id)_msns + addOrRemove:(BOOL)_flag +{ + NSString *cmd; + NSString *flagstr; + NSString *seqstr; + + if ([_msns isKindOfClass:[NSArray class]]) { + // TODO: improve by using ranges, eg 1:5 instead of 1,2,3,4,5 + _msns = [_msns valueForKey:@"stringValue"]; + seqstr = [_msns componentsJoinedByString:@","]; + } + else + seqstr = [_msns stringValue]; + + flagstr = [_flags2ImapFlags(self, _flags) componentsJoinedByString:@" "]; + cmd = [NSString stringWithFormat:@"store %@ %cFLAGS (%@)", + seqstr, _flag ? '+' : '-', flagstr]; + + return [self->normer normalizeResponse:[self processCommand:cmd]]; +} + - (NSDictionary *)copyFrom:(unsigned)_from to:(unsigned)_to toFolder:(NSString *)_folder { diff --git a/sope-mime/Version b/sope-mime/Version index a2300f74..31c2fe4f 100644 --- a/sope-mime/Version +++ b/sope-mime/Version @@ -2,7 +2,7 @@ MAJOR_VERSION:=4 MINOR_VERSION:=5 -SUBMINOR_VERSION:=221 +SUBMINOR_VERSION:=222 # v4.5.214 requires libNGExtensions v4.5.146 # v4.2.149 requires libNGStreams v4.2.34 -- 2.39.5