diff --git a/ChangeLog b/ChangeLog index ff80de526..b28a78fcf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,16 @@ 2009-09-22 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoMailObject.m (-fetchPlainTextParts:): + handle the fact that the "fetch" key in a RawResponse (NGHashMap) + may not be the only response. Since [NGHashMap objectForKey:] + returns only the first one, we use the new "flattenedDictionaries" + to make sure we can retrieve all requested keys. + + * SoObjects/SOGo/NSArray+Utilities.m (-flattenedDictionaries): new + method that merges the keys and values of all contained + dictionaries into one single dictionary. + * Tests/webdavlib.py (_WD_XMLTreeElement.__init__): added a new optional parameter "attributes" that enables the setting of element attributes during the rendering of the element. diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index cb4a4da61..585605f8f 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -33,6 +33,7 @@ #import #import #import +#import #import #import #import @@ -613,6 +614,7 @@ static BOOL debugSoParts = NO; // TODO: is the name correct or does it also fetch other parts? NSMutableDictionary *flatContents; unsigned i, count; + NSArray *results; id result; [self debugWithFormat: @"fetch keys: %@", _fetchKeys]; @@ -622,8 +624,9 @@ static BOOL debugSoParts = NO; result = [result valueForKey: @"RawResponse"]; // hackish // Note: -valueForKey: doesn't work! - result = [(NSDictionary *)result objectForKey: @"fetch"]; - + results = [(NGHashMap *)result objectsForKey: @"fetch"]; + result = [results flattenedDictionaries]; + count = [_fetchKeys count]; flatContents = [NSMutableDictionary dictionaryWithCapacity:count]; for (i = 0; i < count; i++) { diff --git a/SoObjects/SOGo/NSArray+Utilities.h b/SoObjects/SOGo/NSArray+Utilities.h index 48417ac26..147261ced 100644 --- a/SoObjects/SOGo/NSArray+Utilities.h +++ b/SoObjects/SOGo/NSArray+Utilities.h @@ -38,6 +38,7 @@ - (NSArray *) objectsForKey: (NSString *) key notFoundMarker: (id) marker; - (NSArray *) flattenedArray; +- (NSDictionary *) flattenedDictionaries; - (NSArray *) uniqueObjects; diff --git a/SoObjects/SOGo/NSArray+Utilities.m b/SoObjects/SOGo/NSArray+Utilities.m index d5f8443c0..8416046d1 100644 --- a/SoObjects/SOGo/NSArray+Utilities.m +++ b/SoObjects/SOGo/NSArray+Utilities.m @@ -121,6 +121,24 @@ return flattenedArray; } +- (NSDictionary *) flattenedDictionaries +{ + NSMutableDictionary *newDict; + NSDictionary *currentDictionary; + int count, max; + + newDict = [NSMutableDictionary dictionary]; + + max = [self count]; + for (count = 0; count < max; count++) + { + currentDictionary = [self objectAtIndex: count]; + [newDict addEntriesFromDictionary: currentDictionary]; + } + + return newDict; +} + - (NSArray *) uniqueObjects { NSMutableArray *newArray;