/*
- Copyright (C) 2000-2005 SKYRIX Software AG
+ Copyright (C) 2000-2007 SKYRIX Software AG
+ Copyright (C) 2007 Helge Hess
This file is part of SOPE.
flags : NSArray
unseen : NSNumber
access : NSString ([READ-WRITE], ... )
+
+ Eg:
+ 17 select "INBOX"
+ * FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
+ * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)]
+ * OK (seen state failure) Unable to preserve \Seen state: System I/O \
+ error
+ * 0 EXISTS
+ * 0 RECENT
+ * OK [UIDVALIDITY 1016867500]
+ * OK [UIDNEXT 18948]
+ * OK [NOMODSEQ] Sorry, modsequences have not been enabled on this \
+ mailbox
+ 17 OK [READ-WRITE] Completed
*/
NSDictionary *obj;
NSEnumerator *enumerator;
result = [self normalizeResponse:_map];
- if ((flags = [[_map objectEnumeratorForKey:@"flags"] nextObject]))
+ if ((flags = [[_map objectEnumeratorForKey:@"flags"] nextObject]) != nil)
[result setObject:_imapFlags2Flags(self, flags) forKey:@"flags"];
+ // TODO: document the contents of this dictionary
enumerator = [_map objectEnumeratorForKey:@"ok"];
- while ((obj = [enumerator nextObject])) {
+ while ((obj = [enumerator nextObject]) != nil) {
id o;
- if ((o = [obj objectForKey:@"unseen"]))
- [result setObject:o forKey:@"unseen"];
+ if ([obj isKindOfClass:DictClass]) {
+ if ((o = [obj objectForKey:@"unseen"]))
+ [result setObject:o forKey:@"unseen"];
+ }
+ else
+ [self warnWithFormat:@"unexpected OK object: %@", obj];
}
enumerator = [_map objectEnumeratorForKey:@"no"];
- while ((obj = [enumerator nextObject])) {
+ while ((obj = [enumerator nextObject]) != nil) {
id o;
+ // TODO: document this
if ([obj isKindOfClass:DictClass]) {
- if ((o = [obj objectForKey:@"ALERT"]))
+ if ((o = [obj objectForKey:@"ALERT"]) != nil)
[result setObject:o forKey:@"alert"];
}
- else {
+ else // TODO: this looks wrong, its not safe that this is the ALERT result?
[result setObject:obj forKey:@"alert"];
- }
}
obj = [_map objectForKey:@"ResponseResult"];