Skip to content

Commit

Permalink
Improve handling of mail delegates
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Jul 6, 2016
1 parent 0e8637e commit bfd3508
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 85 deletions.
4 changes: 2 additions & 2 deletions SoObjects/Mailer/SOGoMailAccount.m
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ - (void) addDelegates: (NSArray *) newDelegates
max = [newDelegates count];
for (count = 0; count < max; count++)
{
currentDelegate = [newDelegates objectAtIndex: 0];
currentDelegate = [newDelegates objectAtIndex: count];
delegateUser = [SOGoUser userWithLogin: currentDelegate];
if (delegateUser)
{
Expand All @@ -1127,7 +1127,7 @@ - (void) removeDelegates: (NSArray *) oldDelegates
max = [oldDelegates count];
for (count = 0; count < max; count++)
{
currentDelegate = [oldDelegates objectAtIndex: 0];
currentDelegate = [oldDelegates objectAtIndex: count];
delegateUser = [SOGoUser userWithLogin: currentDelegate];
if (delegateUser)
{
Expand Down
20 changes: 12 additions & 8 deletions SoObjects/SOGo/SOGoUserManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -346,18 +346,22 @@ - (NSString *) getFullEmailForUID: (NSString *) uid
NSDictionary *contactInfos;
NSString *cn, *email, *fullEmail;

fullEmail = nil;
contactInfos = [self contactInfosForUserWithUIDorEmail: uid];
email = [contactInfos objectForKey: @"c_email"];
cn = [contactInfos objectForKey: @"cn"];
if ([cn length] > 0)
if (contactInfos)
{
if ([email length] > 0)
fullEmail = [NSString stringWithFormat: @"%@ <%@>", cn, email];
email = [contactInfos objectForKey: @"c_email"];
cn = [contactInfos objectForKey: @"cn"];
if ([cn length] > 0)
{
if ([email length] > 0)
fullEmail = [NSString stringWithFormat: @"%@ <%@>", cn, email];
else
fullEmail = cn;
}
else
fullEmail = cn;
fullEmail = email;
}
else
fullEmail = email;

return fullEmail;
}
Expand Down
75 changes: 0 additions & 75 deletions UI/MailerUI/UIxMailUserDelegationEditor.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,84 +24,9 @@
#import <SOGoUI/UIxComponent.h>

@interface UIxMailUserDelegationEditor : UIxComponent
// {
// NSArray *delegates;
// NSString *currentDelegate;
// }

// - (NSArray *) delegates;
// - (void) setCurrentDelegate: (NSString *) newCurrentDelegate;
// - (NSString *) currentDelegate;

@end

@implementation UIxMailUserDelegationEditor

// - (id) init
// {
// if ((self = [super init]))
// {
// delegates = nil;
// currentDelegate = nil;
// }

// return self;
// }

// - (void) dealloc
// {
// [delegates release];
// [currentDelegate release];
// [super dealloc];
// }

// - (NSArray *) delegates
// {
// if (!delegates)
// {
// delegates = [[self clientObject] delegates];
// [delegates retain];
// }

// return delegates;
// }

// - (void) setCurrentDelegate: (NSString *) newCurrentDelegate
// {
// ASSIGN (currentDelegate, newCurrentDelegate);
// }

// - (NSString *) currentDelegate
// {
// return currentDelegate;
// }

// - (NSString *) currentDelegateDisplayName
// {
// SOGoUserManager *um;
// NSString *s;

// um = [SOGoUserManager sharedUserManager];
// s = ([currentDelegate hasPrefix: @"@"]
// ? [currentDelegate substringFromIndex: 1]
// : currentDelegate);

// return [um getFullEmailForUID: s];
// }

// - (id) defaultAction
// {
// id response;
// SOGoMailAccount *co;

// co = [self clientObject];
// if ([[co nameInContainer] isEqualToString: @"0"])
// response = self;
// else
// response = [self responseWithStatus: 403
// andString: @"The list of account delegates cannot be modified on secondary accounts."];

// return response;
// }

@end

0 comments on commit bfd3508

Please sign in to comment.