Add missing delegators identities in mail editor

Fixes #3720
pull/214/head
Francis Lachapelle 2016-06-13 10:44:49 -04:00
parent d2869bed7f
commit 4f64994f7b
3 changed files with 41 additions and 14 deletions

1
NEWS
View File

@ -14,6 +14,7 @@ Bug fixes
- [web] fixed all-day events covering a timezone change (#3457) - [web] fixed all-day events covering a timezone change (#3457)
- [web] sgTimePicker parser now respects the user's time format and language - [web] sgTimePicker parser now respects the user's time format and language
- [web] fixed time format when user chooses the default one - [web] fixed time format when user chooses the default one
- [web] added missing delegators identities in mail editor (#3720)
- [core] properly handle sorted/deleted calendars (#3723) - [core] properly handle sorted/deleted calendars (#3723)
- [core] properly handle flattened timezone definitions (#2690) - [core] properly handle flattened timezone definitions (#2690)

View File

@ -1,6 +1,5 @@
/* /*
Copyright (C) 2006-2015 Inverse inc. Copyright (C) 2006-2016 Inverse inc.
Copyright (C) 2005 SKYRIX Software AG
This file is part of SOGo. This file is part of SOGo.
@ -15,7 +14,7 @@
License for more details. License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the License along with SOGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. 02111-1307, USA.
*/ */
@ -113,6 +112,7 @@
- (unsigned int) weekNumberForDate: (NSCalendarDate *) date; - (unsigned int) weekNumberForDate: (NSCalendarDate *) date;
- (NSArray *) mailAccounts; - (NSArray *) mailAccounts;
- (NSArray *) mailAccountsWithDelegatedIdentities: (BOOL) appendDeletegatedIdentities;
- (NSDictionary *) accountWithName: (NSString *) accountName; - (NSDictionary *) accountWithName: (NSString *) accountName;
- (NSArray *) allIdentities; - (NSArray *) allIdentities;
- (NSDictionary *) primaryIdentity; - (NSDictionary *) primaryIdentity;

View File

@ -1,6 +1,5 @@
/* /*
Copyright (C) 2006-2015 Inverse inc. Copyright (C) 2006-2016 Inverse inc.
Copyright (C) 2005 SKYRIX Software AG
This file is part of SOGo. This file is part of SOGo.
@ -15,7 +14,7 @@
License for more details. License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the License along with SOGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. 02111-1307, USA.
*/ */
@ -621,20 +620,21 @@
} }
} }
- (void) _appendSystemMailAccount - (void) _appendSystemMailAccountWithDelegatedIdentities: (BOOL) appendDeletegatedIdentities
{ {
NSString *fullName, *replyTo, *imapLogin, *imapServer, *cImapServer, *signature, NSString *fullName, *replyTo, *imapLogin, *imapServer, *cImapServer, *signature,
*encryption, *scheme, *action, *query, *customEmail, *defaultEmail, *sieveServer; *encryption, *scheme, *action, *query, *customEmail, *defaultEmail, *sieveServer;
NSMutableDictionary *mailAccount, *identity, *mailboxes, *receipts, *mailSettings; NSMutableDictionary *mailAccount, *identity, *mailboxes, *receipts, *mailSettings;
NSNumber *port; NSNumber *port;
NSMutableArray *identities; NSMutableArray *identities;
NSArray *mails, *delegates; NSArray *mails, *delegators, *delegates;
NSURL *url, *cUrl; NSURL *url, *cUrl;
unsigned int count, max, default_identity; unsigned int count, max, default_identity;
NSInteger defaultPort; NSInteger defaultPort;
[self userDefaults]; [self userDefaults];
mailSettings = [[self userSettings] objectForKey: @"Mail"];
mailAccount = [NSMutableDictionary new]; mailAccount = [NSMutableDictionary new];
// 1. login // 1. login
@ -781,7 +781,29 @@
} }
[[identities objectAtIndex: default_identity] setObject: [NSNumber numberWithBool: YES] [[identities objectAtIndex: default_identity] setObject: [NSNumber numberWithBool: YES]
forKey: @"isDefault"]; forKey: @"isDefault"];
/* identities from delegators */
if (appendDeletegatedIdentities)
{
delegators = [mailSettings objectForKey: @"DelegateFrom"];
if (delegators)
{
NSDictionary *delegatorAccount;
SOGoUser *delegator;
max = [delegators count];
for (count = 0; count < max; count++)
{
delegator = [SOGoUser userWithLogin: [delegators objectAtIndex: count]];
if (delegator)
{
delegatorAccount = [[delegator mailAccountsWithDelegatedIdentities: NO] objectAtIndex: 0];
[identities addObjectsFromArray: [delegatorAccount objectForKey: @"identities"]];
}
}
}
}
[mailAccount setObject: identities forKey: @"identities"]; [mailAccount setObject: identities forKey: @"identities"];
[identities release]; [identities release];
@ -820,11 +842,7 @@
[mailAccount setObject: mailboxes forKey: @"specialMailboxes"]; [mailAccount setObject: mailboxes forKey: @"specialMailboxes"];
[mailboxes release]; [mailboxes release];
[mailAccounts addObject: mailAccount];
[mailAccount release];
/* delegates */ /* delegates */
mailSettings = [[self userSettings] objectForKey: @"Mail"];
delegates = [mailSettings objectForKey: @"DelegateTo"]; delegates = [mailSettings objectForKey: @"DelegateTo"];
if (!delegates) if (!delegates)
delegates = [NSArray array]; delegates = [NSArray array];
@ -845,16 +863,24 @@
delegates = allDelegates; delegates = allDelegates;
} }
[mailAccount setObject: delegates forKey: @"delegates"]; [mailAccount setObject: delegates forKey: @"delegates"];
[mailAccounts addObject: mailAccount];
[mailAccount release];
} }
- (NSArray *) mailAccounts - (NSArray *) mailAccounts
{
return [self mailAccountsWithDelegatedIdentities: YES];
}
- (NSArray *) mailAccountsWithDelegatedIdentities: (BOOL) appendDeletegatedIdentities
{ {
NSArray *auxAccounts; NSArray *auxAccounts;
if (!mailAccounts) if (!mailAccounts)
{ {
mailAccounts = [NSMutableArray new]; mailAccounts = [NSMutableArray new];
[self _appendSystemMailAccount]; [self _appendSystemMailAccountWithDelegatedIdentities: appendDeletegatedIdentities];
if ([[self domainDefaults] mailAuxiliaryUserAccountsEnabled]) if ([[self domainDefaults] mailAuxiliaryUserAccountsEnabled])
{ {
auxAccounts = [[self userDefaults] auxiliaryMailAccounts]; auxAccounts = [[self userDefaults] auxiliaryMailAccounts];