Monotone-Parent: 166aef5ba4c5699c0bde50ef5dddb543641e5c67

Monotone-Revision: e5f7bc9b668fc4dd36afd650762d96297397bacf

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-11-06T21:22:10
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2007-11-06 21:22:10 +00:00
parent f2b6271cef
commit 57f174e2f0
2 changed files with 28 additions and 6 deletions

View File

@ -1,5 +1,9 @@
2007-11-06 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailerUI/UIxMailToSelection.m ([UIxMailToSelection
-getAddressesFromFormValues:_dict]): take NSString and NSArray
values. Ignore addresses with a length of 0.
* SoObjects/SOGo/SOGoUser.m ([SOGoUser -mailAccounts]): we now
fetch the accounts from the user defaults and create default
values if missing.

View File

@ -285,11 +285,31 @@ static NSArray *headers = nil;
/* handling requests */
- (void) _fillAddresses: (NSMutableArray *) addresses
withObject: (id) object
{
NSEnumerator *list;
NSString *currentAddress;
if ([object isKindOfClass: [NSString class]])
[addresses addObject: object];
else if ([object isKindOfClass: [NSArray class]])
{
list = [object objectEnumerator];
while ((currentAddress
= [[list nextObject] stringByTrimmingSpaces]))
if ([currentAddress length])
[addresses addObject: currentAddress];
}
}
- (void) getAddressesFromFormValues: (NSDictionary *) _dict
{
NSMutableArray *rawTo, *rawCc, *rawBcc;
NSString *idx, *popupKey, *popupValue;
NSArray *keys;
unsigned i, count;
id addr;
rawTo = [NSMutableArray arrayWithCapacity:4];
rawCc = [NSMutableArray arrayWithCapacity:4];
@ -304,18 +324,16 @@ static NSArray *headers = nil;
key = [keys objectAtIndex:i];
if ([key hasPrefix:@"addr_"])
{
NSString *idx, *addr, *popupKey, *popupValue;
addr = [[_dict objectForKey:key] lastObject];
addr = [_dict objectForKey:key];
idx = [self getIndexFromIdentifier:key];
popupKey = [NSString stringWithFormat:@"popup_%@", idx];
popupValue = [[_dict objectForKey:popupKey] lastObject];
if([popupValue isEqualToString:@"0"])
[rawTo addObject:addr];
[self _fillAddresses: rawTo withObject: addr];
else if([popupValue isEqualToString:@"1"])
[rawCc addObject:addr];
[self _fillAddresses: rawCc withObject: addr];
else
[rawBcc addObject:addr];
[self _fillAddresses: rawBcc withObject: addr];
}
}