]> err.no Git - scalable-opengroupware.org/blobdiff - SOGo/UI/MailerUI/UIxMailTree.m
improved share support
[scalable-opengroupware.org] / SOGo / UI / MailerUI / UIxMailTree.m
index a1c722d24ff1fa2b368f0664d1d6d7b0d828bf9e..a6538ec8798e9f68f32344234dbcd78c72d633b3 100644 (file)
@@ -50,6 +50,8 @@
 
 - (NSString *)stringByCuttingOffAtDotsWhenExceedingLength:(int)_maxLength;
 
+- (NSString *)titleForSOGoIMAP4String;
+
 @end
 
 @implementation UIxMailTree
@@ -183,43 +185,6 @@ 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
 {
@@ -273,7 +238,7 @@ static BOOL debugBlocks = NO;
     *_icon = @"tbtv_inbox_17x17.gif";
     
     /* title processing is somehow Agenor specific and should be done in UI */
-    *_t = [self titleForIMAP4String:[_object nameInContainer]];
+    *_t = [[_object nameInContainer] titleForSOGoIMAP4String];
   }
   else if ([_object isKindOfClass:NSClassFromString(@"SOGoMailAccounts")])
     *_icon = @"tbtv_inbox_17x17.gif";
@@ -556,4 +521,41 @@ static BOOL debugBlocks = NO;
   return [s substringToIndex:r.location];
 }
 
+- (NSString *)titleForSOGoIMAP4String {
+  /* 
+     eg:
+       guizmo.g.-.baluh.hommes.tests-montee-en-charge-ogo@\
+       amelie-01.ac.melanie2.i2
+  */
+  static int CutOffLength = 16;
+  NSString *s;
+  NSRange  r;
+  
+  s = self;
+  
+  /* 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];
+}
+
 @end /* NSString(DotCutting) */