mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-02 13:46:23 +00:00
Monotone-Parent: d20b6efa6a8c415c1db8ca849c311e740a312646
Monotone-Revision: 1dda8463cbff42910b1cacd540a640120d4d4939 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-06T17:12:37 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2007-11-06 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoUser.m ([SOGoUser -mailAccounts]): we now
|
||||
fetch the accounts from the user defaults and create default
|
||||
values if missing.
|
||||
|
||||
2007-11-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/MailPartViewers/UIxMailPartTextViewer.m
|
||||
|
||||
@@ -368,44 +368,58 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||
}
|
||||
|
||||
/* mail */
|
||||
- (NSArray *) mailAccounts
|
||||
- (void) _prepareDefaultMailAccounts
|
||||
{
|
||||
#warning should be implemented with the user defaults interfaces
|
||||
NSMutableDictionary *mailAccount, *identity;
|
||||
NSMutableArray *identities;
|
||||
NSString *name, *fullName;
|
||||
NSArray *mails;
|
||||
unsigned int count, max;
|
||||
|
||||
mailAccount = [NSMutableDictionary dictionary];
|
||||
name = [NSString stringWithFormat: @"%@@%@",
|
||||
login, fallbackIMAP4Server];
|
||||
[mailAccount setObject: login forKey: @"userName"];
|
||||
[mailAccount setObject: fallbackIMAP4Server forKey: @"serverName"];
|
||||
[mailAccount setObject: name forKey: @"name"];
|
||||
|
||||
identities = [NSMutableArray array];
|
||||
mails = [self allEmails];
|
||||
|
||||
max = [mails count];
|
||||
if (max > 1)
|
||||
max--;
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
identity = [NSMutableDictionary dictionary];
|
||||
fullName = [self cn];
|
||||
if (![fullName length])
|
||||
fullName = login;
|
||||
[identity setObject: fullName forKey: @"fullName"];
|
||||
[identity setObject: [mails objectAtIndex: count] forKey: @"email"];
|
||||
[identities addObject: identity];
|
||||
}
|
||||
[[identities objectAtIndex: 0] setObject: [NSNumber numberWithBool: YES]
|
||||
forKey: @"isDefault"];
|
||||
|
||||
[mailAccount setObject: identities forKey: @"identities"];
|
||||
|
||||
mailAccounts = [NSMutableArray new];
|
||||
[mailAccounts addObject: mailAccount];
|
||||
}
|
||||
|
||||
- (NSArray *) mailAccounts
|
||||
{
|
||||
NSUserDefaults *ud;
|
||||
|
||||
if (!mailAccounts)
|
||||
{
|
||||
NSArray *mails;
|
||||
int i;
|
||||
|
||||
mailAccount = [NSMutableDictionary dictionary];
|
||||
name = [NSString stringWithFormat: @"%@@%@", login, fallbackIMAP4Server];
|
||||
[mailAccount setObject: login forKey: @"userName"];
|
||||
[mailAccount setObject: fallbackIMAP4Server forKey: @"serverName"];
|
||||
[mailAccount setObject: name forKey: @"name"];
|
||||
|
||||
identities = [NSMutableArray array];
|
||||
mails = [self allEmails];
|
||||
|
||||
for (i = 0; i < [mails count]; i++)
|
||||
{
|
||||
identity = [NSMutableDictionary dictionary];
|
||||
fullName = [self cn];
|
||||
if (![fullName length])
|
||||
fullName = login;
|
||||
[identity setObject: fullName forKey: @"fullName"];
|
||||
[identity setObject: [mails objectAtIndex: i] forKey: @"email"];
|
||||
|
||||
if (i == 0) [identity setObject: [NSNumber numberWithBool: YES] forKey: @"isDefault"];
|
||||
[identities addObject: identity];
|
||||
}
|
||||
|
||||
[mailAccount setObject: identities forKey: @"identities"];
|
||||
|
||||
mailAccounts = [NSMutableArray new];
|
||||
[mailAccounts addObject: mailAccount];
|
||||
ud = [self userDefaults];
|
||||
mailAccounts = [ud objectForKey: @"MailAccounts"];
|
||||
if (mailAccounts)
|
||||
[mailAccounts retain];
|
||||
else
|
||||
[self _prepareDefaultMailAccounts];
|
||||
}
|
||||
|
||||
return mailAccounts;
|
||||
|
||||
Reference in New Issue
Block a user