@implementation SOGoMailBaseObject
+static BOOL debugOn = YES;
+static BOOL debugTree = NO;
+
- (id)initWithImap4URL:(NSURL *)_url inContainer:(id)_container {
NSString *n;
}
- (id)treeNavigationNodes {
- return [[self container] treeNavigationBlockWithActiveChildBlock:
- [self treeNavigationBlockForActiveNode]
- depth:1];
+ id block;
+
+ block = [self treeNavigationBlockForActiveNode];
+ if (debugTree) [self logWithFormat:@"own block: %@", block];
+ block = [[self container] treeNavigationBlockWithActiveChildBlock:block
+ depth:1];
+ if (debugTree) [self logWithFormat:@" root block: %@", block];
+ return block;
}
+/* debugging */
+
+- (NSString *)loggingPrefix {
+ /* improve perf ... */
+ return [NSString stringWithFormat:@"<0x%08X[%@]:%@>",
+ self, NSStringFromClass([self class]),
+ [self nameInContainer]];
+}
@end /* SOGoMailBaseObject */
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
debugOn = [ud boolForKey:@"SOGoEnableIMAP4Debug"];
+ debugCache = [ud boolForKey:@"SOGoEnableIMAP4CacheDebug"];
poolingOff = [ud boolForKey:@"SOGoDisableIMAP4Pooling"];
+
+ if (debugOn) NSLog(@"Note: SOGoEnableIMAP4Debug is enabled!");
+ if (poolingOff) NSLog(@"WARNING: IMAP4 connection pooling is disabled!");
+
}
+ (id)defaultMailManager {
result = [client login:[_url user] password:_pwd];
if (![[result valueForKey:@"result"] boolValue]) {
- [self logWithFormat:@"ERROR: IMAP4 login failed! (%@,pwd=%s,%@)",
- [_url absoluteString], [_pwd length] > 0 ? "yes" : "no", client];
+ [self logWithFormat:
+ @"ERROR: IMAP4 login failed "
+ @"(host=%@,user=%@,pwd=%s,url=%@/%@/%@): "
+ @"%@",
+ [_url host], [_url user], [_pwd length] > 0 ? "yes" : "no",
+ [_url absoluteString], [_url baseURL],
+ NSStringFromClass([[_url baseURL] class]),
+ client];
return nil;
}
/* Note: the result is normalized, that is, it contains / as the separator */
folderName = [_url path];
+#if __APPLE__
+ /* normalized results already have the / in front on libFoundation?! */
if ([folderName hasPrefix:@"/"])
folderName = [folderName substringFromIndex:1];
+#endif
result = [_result valueForKey:@"list"];
/* Cyrus already tells us whether we need to check for children */
flags = [result objectForKey:folderName];
- if ([flags containsObject:@"hasnochildren"])
+ if ([flags containsObject:@"hasnochildren"]) {
+#if 0
+ [self debugWithFormat:@"folder %@ has no children.", folderName];
+#endif
return nil;
+ }
+
+ [self debugWithFormat:@"all keys %@: %@", folderName, [result allKeys]];
names = [self _getDirectChildren:[result allKeys] folderName:folderName];
#if 0
SOGoMailConnectionEntry *entry;
NGImap4Client *client;
NSDictionary *result;
+
+ if (debugOn)
+ [self debugWithFormat:@"subfolders for URL: %@ ...",[_url absoluteString]];
/* check cache */
entry = [self entryForURL:_url];
[entry cacheHierarchyResults:result];
- if (debugCache)
- [self logWithFormat:@"cached results in entry %@: %@", entry, result];
+ if (debugCache) {
+ [self logWithFormat:@"cached results in entry %@: 0x%08X(%d)",
+ entry, result, [result count]];
+ }
}
/* extract list */