#include "common.h"
+@interface NSString(DotCutting)
+
+- (NSString *)titleForSOGoIMAP4String;
+
+@end
+
@implementation UIxMailAccountView
/* title */
- (NSString *)objectTitle {
- return [[self clientObject] nameInContainer];
+ return [[[self clientObject] nameInContainer] titleForSOGoIMAP4String];
}
+
+- (BOOL)isShareAccount {
+ return [[[self clientObject] nameInContainer] rangeOfString:@".-."].length >0
+ ? YES : NO;
+}
+
+- (NSString *)fullSharePath {
+ NSRange r;
+ NSString *s;
+
+ s = [[self clientObject] nameInContainer];
+ r = [s rangeOfString:@".-."];
+ if (r.length == 0) return nil;
+
+ s = [s substringFromIndex:(r.location + r.length)];
+ r = [s rangeOfString:@"@"];
+ if (r.length == 0) return s;
+
+ return [s substringToIndex:r.location];
+}
+
- (NSString *)panelTitle {
NSString *s;
- (NSString *)stringByCuttingOffAtDotsWhenExceedingLength:(int)_maxLength;
+- (NSString *)titleForSOGoIMAP4String;
+
@end
@implementation UIxMailTree
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
{
*_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";
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) */
title="panelTitle"
>
<div class="titlediv">
- <var:string value="clientObject.nameInContainer"/>
+ <var:if condition="isShareAccount">
+ <var:string label:value="Share: " />
+ </var:if>
+ <var:if condition="isShareAccount" const:negate="1">
+ <var:string label:value="Account: " />
+ </var:if>
+ <var:string value="objectTitle"/>
</div>
<div class="embedwhite_out">
<div class="embedwhite_in">
<div style="padding: 8px;">
<div style="font-weight: bold; font-size: 16px;">
- SOGo Mail - <var:string value="clientObject.nameInContainer"/>
+ SOGo Mail -
+
+ <var:if condition="isShareAccount">
+ <var:string label:value="Shared Account: " />
+ </var:if>
+
+ <var:string value="objectTitle"/>
</div>
<br />
+ <var:if condition="isShareAccount">
+ <div>
+ <var:string label:value="Share: " />
+ <var:string value="fullSharePath" />
+ </div>
+ </var:if>
<br />
<div class="whitesec_title">Email</div><br />