2005-07-07 Helge Hess <helge.hess@opengroupware.org>
- * v0.9.90
+ * SOGoMailManager.m, SOGoMailFolder.m: added methods to "bulk add"
+ flags to all messages contained in a folder
+ (-addFlags:toAllMessagesInURL:password: for the manager,
+ -addFlagsToAllMessages: for the SOGoFolder) (v0.9.91)
+
+2005-07-07 Helge Hess <helge.hess@opengroupware.org>
* added specific SOGoTrashFolder.m class (subclass of SOGoMailFolder)
- to allow hooking up a different UI
+ to allow hooking up a different UI (v0.9.90)
2005-07-07 Helge Hess <helge.hess@opengroupware.org>
- (BOOL)isDeleteAndExpungeAllowed;
+/* flags */
+
+- (NSException *)addFlagsToAllMessages:(id)_f;
+
@end
#endif /* __Mailer_SOGoMailFolder_H__ */
password:[self imap4Password]];
}
+/* flags */
+
+- (NSException *)addFlagsToAllMessages:(id)_f {
+ return [[self mailManager] addFlags:_f toAllMessagesInURL:[self imap4URL]
+ password:[self imap4Password]];
+}
+
/* name lookup */
- (BOOL)isMessageKey:(NSString *)_key inContext:(id)_ctx {
- (id)aclForMailboxAtURL:(NSURL *)_url password:(NSString *)_pwd;
- (NSString *)myRightsForMailboxAtURL:(NSURL *)_url password:(NSString *)_pwd;
+- (NSException *)addFlags:(id)_f toAllMessagesInURL:(NSURL *)_u
+ password:(NSString *)_p;
+
@end
#endif /* __Mailer_SOGoMailManager_H__ */
return [result valueForKey:@"myrights"];
}
+/* bulk flag adding (eg used for empty/trash) */
+
+- (NSException *)addFlags:(id)_f toAllMessagesInURL:(NSURL *)_url
+ password:(NSString *)_p
+{
+ NGImap4Client *client;
+ id result;
+
+ if (![_url isNotNull]) return nil;
+ if (![_f isNotNull]) return nil;
+
+ if (![_f isKindOfClass:[NSArray class]])
+ _f = [NSArray arrayWithObjects:&_f count:1];
+
+ /* get client */
+
+ if ((client = [self imap4ClientForURL:_url password:_p]) == nil)
+ // TODO: return 401?
+ return nil;
+
+ /* select folder */
+
+ if (![self selectFolder:[self imap4FolderNameForURL:_url] inClient:client]) {
+ return [NSException exceptionWithHTTPStatus:404 /* not found */
+ reason:@"could not select IMAP4 folder"];
+ }
+
+ /* fetch all sequence numbers */
+
+ result = [client searchWithQualifier:nil /* means: ALL */];
+ if (![[result valueForKey:@"result"] boolValue]) {
+ return [NSException exceptionWithHTTPStatus:500 /* server error */
+ reason:@"could not search in IMAP4 folder"];
+ }
+
+ result = [result valueForKey:@"search"];
+ if ([result count] == 0) /* no messages in there, nothin' to be done */
+ return nil;
+
+ /* store flags */
+
+ result = [client storeFlags:_f forMSNs:result addOrRemove:YES];
+ if (![[result valueForKey:@"result"] boolValue]) {
+ return [NSException exceptionWithHTTPStatus:500 /* server error */
+ reason:@"could not change flags in IMAP4 folder"];
+ }
+
+ return nil;
+}
+
/* debugging */
- (BOOL)isDebuggingEnabled {
newName:@"fakeNewUnusedByIMAP4" /* autoassigned */
inContext:_ctx];
if (error != nil) return error;
-
+
/* b) mark deleted */
error = [[self mailManager] markURLDeleted:[self imap4URL]
# Version file
-SUBMINOR_VERSION:=90
+SUBMINOR_VERSION:=91
+# v0.9.91 requires libNGMime v4.5.222
# v0.9.69 requires libNGMime v4.5.210
# v0.9.55 requires libNGExtensions v4.5.136
# v0.9.44 requires libNGMime v4.3.194