Monotone-Parent: d63a2f0e9c958ba01af4295fd9477e41e87bd84e

Monotone-Revision: e9ca26d51aa3d10c2258ad11e5ed08cf1cdc234c

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-08-03T18:54:49
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-08-03 18:54:49 +00:00
parent b58b956b48
commit 2f69dee9d6
3 changed files with 46 additions and 40 deletions

View File

@@ -1,5 +1,8 @@
2010-08-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoUser.m (-_appendSystemMailAccount): new
private method with the mailbox code split from -[mailAccounts].
* UI/WebServerResources/MailerUI.js (composeNewMessage): the first
account is always identified as "0".

View File

@@ -40,7 +40,6 @@
@class NSMutableArray;
@class NSMutableDictionary;
@class NSString;
@class NSURL;
@class WOContext;
@@ -69,7 +68,7 @@
NSString *domainId;
NSString *language;
NSArray *allEmails;
NSArray *mailAccounts;
NSMutableArray *mailAccounts;
NSString *cn;
BOOL propagateCache;
}

View File

@@ -436,7 +436,7 @@
}
/* mail */
- (NSArray *) mailAccounts
- (void) _appendSystemMailAccount
{
NSMutableDictionary *mailAccount, *identity;
NSMutableArray *identities;
@@ -444,45 +444,49 @@
NSArray *mails;
unsigned int count, max;
mailAccount = [NSMutableDictionary new];
imapLogin = [[SOGoUserManager sharedUserManager]
getImapLoginForUID: login];
imapServer = [self _fetchFieldForUser: @"c_imaphostname"];
if (!imapServer)
imapServer = [[self domainDefaults] imapServer];
[mailAccount setObject: imapLogin forKey: @"userName"];
[mailAccount setObject: imapServer forKey: @"serverName"];
identities = [NSMutableArray new];
mails = [self allEmails];
[mailAccount setObject: [mails objectAtIndex: 0] forKey: @"name"];
max = [mails count];
if (max > 1)
max--;
for (count = 0; count < max; count++)
{
identity = [NSMutableDictionary new];
fullName = [self cn];
if (![fullName length])
fullName = login;
[identity setObject: fullName forKey: @"fullName"];
[identity setObject: [mails objectAtIndex: count] forKey: @"email"];
[identities addObject: identity];
[identity release];
}
[[identities objectAtIndex: 0] setObject: [NSNumber numberWithBool: YES]
forKey: @"isDefault"];
[mailAccount setObject: identities forKey: @"identities"];
[identities release];
[mailAccounts addObject: mailAccount];
[mailAccount release];
}
- (NSArray *) mailAccounts
{
if (!mailAccounts)
{
imapLogin = [[SOGoUserManager sharedUserManager]
getImapLoginForUID: login];
imapServer = [self _fetchFieldForUser: @"c_imaphostname"];
if (!imapServer)
imapServer = [[self domainDefaults] imapServer];
mailAccount = [NSMutableDictionary new];
[mailAccount setObject: imapLogin forKey: @"userName"];
[mailAccount setObject: imapServer forKey: @"serverName"];
identities = [NSMutableArray new];
mails = [self allEmails];
[mailAccount setObject: [mails objectAtIndex: 0]
forKey: @"name"];
max = [mails count];
if (max > 1)
max--;
for (count = 0; count < max; count++)
{
identity = [NSMutableDictionary new];
fullName = [self cn];
if (![fullName length])
fullName = login;
[identity setObject: fullName forKey: @"fullName"];
[identity setObject: [mails objectAtIndex: count] forKey: @"email"];
[identities addObject: identity];
[identity release];
}
[[identities objectAtIndex: 0] setObject: [NSNumber numberWithBool: YES]
forKey: @"isDefault"];
[mailAccount setObject: identities forKey: @"identities"];
[identities release];
mailAccounts = [NSArray arrayWithObject: mailAccount];
[mailAccounts retain];
[mailAccount release];
mailAccounts = [NSMutableArray new];
[self _appendSystemMailAccount];
}
return mailAccounts;