]> err.no Git - scalable-opengroupware.org/commitdiff
fixed libFoundation vs Cocoa issue
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 29 Sep 2004 23:24:45 +0000 (23:24 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 29 Sep 2004 23:24:45 +0000 (23:24 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@335 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/SoObjects/Mailer/ChangeLog
SOGo/SoObjects/Mailer/SOGoMailBaseObject.m
SOGo/SoObjects/Mailer/SOGoMailManager.m
SOGo/SoObjects/Mailer/common.h

index 158de732b819b58fc63845300553b889a45d5ec1..1c64918b6d728c87f5f42a636a25030b9f3a16fb 100644 (file)
@@ -1,3 +1,11 @@
+2004-09-30  Helge Hess  <helge.hess@skyrix.com>
+       
+       * v0.9.16
+       
+       * SOGoMailBaseObject.m: improved debug logging
+       
+       * SOGoMailManager.m: fixed an Apple/libFoundation incompatibility
+
 2004-09-29  Helge Hess  <helge.hess@skyrix.com>
 
        * SOGoMailManager.m: minor improvement to error logging (v0.9.15)
index 53bffb9347a07cdd71a9039b7dfac160b69a7fb1..26f02e11d6b96ddc4dcdab6ae4cbf31ea184790a 100644 (file)
@@ -28,6 +28,9 @@
 
 @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 */
index be260354fb2318724c5ef3a83b51d2b379245ac8..8973495d2647d58990b95ffddd6c0cd545b62d84 100644 (file)
@@ -56,7 +56,12 @@ static NSTimeInterval PoolScanInterval = 5 * 60;
   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 {
@@ -143,8 +148,14 @@ static NSTimeInterval PoolScanInterval = 5 * 60;
   
   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;
   }
   
@@ -226,15 +237,24 @@ static NSTimeInterval PoolScanInterval = 5 * 60;
   
   /* 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
@@ -249,6 +269,9 @@ static NSTimeInterval PoolScanInterval = 5 * 60;
   SOGoMailConnectionEntry *entry;
   NGImap4Client *client;
   NSDictionary  *result;
+
+  if (debugOn)
+    [self debugWithFormat:@"subfolders for URL: %@ ...",[_url absoluteString]];
   
   /* check cache */
   
@@ -293,8 +316,10 @@ static NSTimeInterval PoolScanInterval = 5 * 60;
       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 */
index a03b8b0d186bca6a72c9c2d47db8d2f68a110dea..42bb4ab6258466f78bfd79e59802ebc0d96b5275 100644 (file)
@@ -21,6 +21,7 @@
 // $Id$
 
 #import <Foundation/Foundation.h>
+#import <Foundation/NSObjCRuntime.h>
 
 #if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY
 #  include <NGExtensions/NGObjectMacros.h>