]> err.no Git - scalable-opengroupware.org/commitdiff
added account discovery
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 7 Jul 2005 13:31:20 +0000 (13:31 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 7 Jul 2005 13:31:20 +0000 (13:31 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@684 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/SoObjects/Mailer/ChangeLog
SOGo/SoObjects/Mailer/SOGoMailAccount.m
SOGo/SoObjects/Mailer/SOGoMailAccounts.m
SOGo/SoObjects/Mailer/Version
SOGo/UI/MailerUI/ChangeLog
SOGo/UI/MailerUI/UIxMailTree.m
SOGo/UI/MailerUI/Version

index 76ea86f1027b49a0257ad596a1f3bdc7600c7aaa..9f1b93f8fbc3c423ad280ddafab3a96ea7ad6982 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-07  Helge Hess  <helge.hess@opengroupware.org>
+
+       * SOGoMailAccounts.m: expose shared mailboxes retrieved via
+         AgenorUserManager (aka LDAP) in -toManyRelationshipKeys (v0.9.89)
+
 2005-07-07  Helge Hess  <helge.hess@opengroupware.org>
 
        * SOGoMailObject.m: implemented -trashInContext: method (v0.9.88)
index ec0707ab934da785fea2cd2f4427066b39e325f3..f2b7fd886422600ee36a1d39abdf81d6926df723 100644 (file)
@@ -329,7 +329,7 @@ static BOOL     useAltNamespace   = NO;
   
   if ([login length] == 0)
     return host;
-
+  
   r = [login rangeOfString:@"."];
   if (r.length > 0)
     login = [login substringToIndex:r.location];
index 2db0774ea8bfcb1e2e63537e472b27f223a4edea..d3e8d756c8dce859a7f78900cb171719571cb8fe 100644 (file)
 
 - (NSArray *)toManyRelationshipKeys {
   static AgenorUserManager *um = nil;
-  NSString *uid, *account;
+  NSString *uid;
+  id       account;
+  NSArray  *shares;
   
   if (um == nil)
     um = [[AgenorUserManager sharedUserManager] retain];
   
   uid     = [[self container] davDisplayName]; /* the uid part of the URL */
   account = [um getIMAPAccountStringForUID:uid];
+  shares  = [um getSharedMailboxAccountStringsForUID:uid];
   
-  return account ? [NSArray arrayWithObject:account] : nil;
+  if (account != nil) account = [NSArray arrayWithObject:account];
+  
+  return ([shares count] == 0)
+    ? account
+    : [account arrayByAddingObjectsFromArray:shares];
 }
 
 /* name lookup */
index 9bc595749469e8f6b4edc690c3e5cc21990031b3..483a62f827a57a8cf36a8498cf29420729778ceb 100644 (file)
@@ -1,6 +1,6 @@
 # Version file
 
-SUBMINOR_VERSION:=88
+SUBMINOR_VERSION:=89
 
 # v0.9.69 requires libNGMime       v4.5.210
 # v0.9.55 requires libNGExtensions v4.5.136
index 9fb669f6957681f1f481458c3050d08ffc7d1f5a..aef0bc642e19b065cdf840de5e8ec5823a5e4ae7 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-07  Helge Hess  <helge.hess@opengroupware.org>
+
+       * UIxMailTree.m: properly display share names in account list (show
+         name of share instead of the cut-off account login). Added some
+         improved heuristics to determine a viably short name (v0.9.128)
+
 2005-07-07  Helge Hess  <helge.hess@opengroupware.org>
 
        * UIxMailView.m, product.plist: added -trash button and action
index fac6cd8965ba2c42253d20d72aceb209a0f4ebf9..a1c722d24ff1fa2b368f0664d1d6d7b0d828bf9e 100644 (file)
     tbtv_trash_17x17.gif
 */
 
+@interface NSString(DotCutting)
+
+- (NSString *)stringByCuttingOffAtDotsWhenExceedingLength:(int)_maxLength;
+
+@end
+
 @implementation UIxMailTree
 
 static BOOL debugBlocks = NO;
@@ -161,7 +167,7 @@ static BOOL debugBlocks = NO;
 - (NSString *)treeNavigationLinkForObject:(id)_object atDepth:(int)_depth {
   NSString *link;
   unsigned i;
-
+  
   link = [[_object nameInContainer] stringByAppendingString:@"/"];
   link = [link stringByAppendingString:[self treeFolderAction]];
   
@@ -177,6 +183,43 @@ static BOOL debugBlocks = NO;
   return link;
 }
 
+- (NSString *)titleForIMAP4String:(NSString *)_constr {
+  /* 
+     eg:
+       guizmo.g.-.baluh.hommes.tests-montee-en-charge-ogo@\
+       amelie-01.ac.melanie2.i2
+  */
+  static int CutOffLength = 16;
+  NSString *s;
+  NSRange  r;
+  
+  s = _constr;
+  
+  /* check for connect strings without hostnames */
+  
+  r = [s rangeOfString:@"@"];
+  if (r.length == 0) {
+    /* no login provide, just use the hostname (without domain) */
+    r = [s rangeOfString:@"."];
+    return r.length > 0 ? [s substringToIndex:r.location] : s;
+  }
+  
+  s = [s substringToIndex:r.location];
+  
+  /* check for shares */
+  
+  r = [s rangeOfString:@".-."];
+  if (r.length > 0) {
+    /* eg: 'baluh.hommes.tests-montee-en-charge-ogo' */
+    s = [s substringFromIndex:(r.location + r.length)];
+    
+    return [s stringByCuttingOffAtDotsWhenExceedingLength:CutOffLength];
+  }
+  
+  /* just the login name, possibly long (test.et.di.cete-lyon) */
+  return [s stringByCuttingOffAtDotsWhenExceedingLength:CutOffLength];
+}
+
 - (void)getTitle:(NSString **)_t andIcon:(NSString **)_icon
   forObject:(id)_object
 {
@@ -226,8 +269,12 @@ static BOOL debugBlocks = NO;
   
   if ([_object isKindOfClass:NSClassFromString(@"SOGoMailFolder")])
     *_icon = nil;
-  else if ([_object isKindOfClass:NSClassFromString(@"SOGoMailAccount")])
+  else if ([_object isKindOfClass:NSClassFromString(@"SOGoMailAccount")]) {
     *_icon = @"tbtv_inbox_17x17.gif";
+    
+    /* title processing is somehow Agenor specific and should be done in UI */
+    *_t = [self titleForIMAP4String:[_object nameInContainer]];
+  }
   else if ([_object isKindOfClass:NSClassFromString(@"SOGoMailAccounts")])
     *_icon = @"tbtv_inbox_17x17.gif";
   else if ([_object isKindOfClass:NSClassFromString(@"SOGoUserFolder")])
@@ -478,3 +525,35 @@ static BOOL debugBlocks = NO;
 }
 
 @end /* UIxMailTree */
+
+
+@implementation NSString(DotCutting)
+
+- (NSString *)stringByCuttingOffAtDotsWhenExceedingLength:(int)_maxLength {
+  NSRange  r, r2;
+  NSString *s;
+  int      i;
+  
+  if ([self length] <= _maxLength) /* if length is small, return as is */
+    return self;
+  
+  if ((r = [self rangeOfString:@"."]).length == 0)
+    /* no dots in share, return even if longer than boundary */
+    return self;
+  
+  s = self;
+  i  = r.location + r.length;
+  r2 = [s rangeOfString:@"." options:NSLiteralSearch 
+         range:NSMakeRange(i, [s length] - i)];
+    
+  if (r2.length > 0) {
+    s = [s substringToIndex:r2.location];
+    if ([s length] <= _maxLength) /* if length is small, return as is */
+      return s;
+  }
+  
+  /* no second dot, and the whole was too long => cut off after first */
+  return [s substringToIndex:r.location];
+}
+
+@end /* NSString(DotCutting) */
index 179f28d65d51930ef370c9dd62c98ddd8c1f46d5..bff1a237abe85bc46fd0e010eabbee42124ebd7d 100644 (file)
@@ -1,6 +1,6 @@
 # version file
 
-SUBMINOR_VERSION:=127
+SUBMINOR_VERSION:=128
 
 # v0.9.100 requires libNGMime        v4.5.213
 # v0.9.99  requires libNGMime        v4.5.212