Monotone-Parent: bcd29d180f0f481f03088f9e1fcb3066dcfdbcc9

Monotone-Revision: 367e72af9d08f48f2e598a1e344c784b6bc4ffac

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-11-26T19:31:07
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2009-11-26 19:31:07 +00:00
parent b0446051d3
commit 09e4c3f2a9
7 changed files with 29 additions and 15 deletions

View File

@@ -1,3 +1,9 @@
2009-11-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/NSDictionary+BSJSONAdditions.m
(+dictionaryWithJSONString:): method moved from NSDictionary into
NSMutableDictionary for consistency.
2009-11-26 Ludovic Marcotte <lmarcotte@inverse.ca>
* SoObjects/Mailer/SOGoMailObject+Draft.m

View File

@@ -28,12 +28,10 @@ extern const int jsonDoNotIndent;
@interface NSDictionary (BSJSONAdditions)
+ (NSMutableDictionary *)dictionaryWithJSONString:(NSString *)jsonString;
- (NSString *)jsonStringValue;
@end
@interface NSDictionary (PrivateBSJSONAdditions)
- (NSString *)jsonStringValueWithIndentLevel:(int)level;
@@ -43,3 +41,9 @@ extern const int jsonDoNotIndent;
- (NSString *)jsonIndentStringForLevel:(int)level;
@end
@interface NSMutableDictionary (BSJSONAdditions)
+ (NSMutableDictionary *)dictionaryWithJSONString:(NSString *)jsonString;
@end

View File

@@ -35,15 +35,6 @@ const int jsonDoNotIndent = -1;
@implementation NSDictionary (BSJSONAdditions)
+ (NSMutableDictionary *)dictionaryWithJSONString:(NSString *)jsonString
{
NSScanner *scanner = [[NSScanner alloc] initWithString:jsonString];
NSMutableDictionary *dictionary = nil;
[scanner scanJSONObject:&dictionary];
[scanner release];
return dictionary;
}
- (NSString *)jsonStringValue
{
return [self jsonStringValueWithIndentLevel:0];
@@ -197,3 +188,16 @@ const int jsonDoNotIndent = -1;
}
@end
@implementation NSMutableDictionary (BSJSONAdditions)
+ (NSMutableDictionary *)dictionaryWithJSONString:(NSString *)jsonString
{
NSScanner *scanner = [[NSScanner alloc] initWithString:jsonString];
NSMutableDictionary *dictionary = nil;
[scanner scanJSONObject:&dictionary];
[scanner release];
return dictionary;
}
@end

View File

@@ -428,7 +428,7 @@ static NSMutableCharacterSet *safeLDIFStartChars = nil;
NSDictionary *jsonData;
#warning this method is a quick and dirty way of detecting the file-format
jsonData = [NSDictionary dictionaryWithJSONString: self];
jsonData = [NSMutableDictionary dictionaryWithJSONString: self];
return (jsonData != nil);
}

View File

@@ -234,7 +234,7 @@ static NSString *uidColumnName = @"c_uid";
defFlags.modified = NO;
[values release];
jsonValue = [self jsonRepresentation];
values = [NSDictionary dictionaryWithJSONString: jsonValue];
values = [NSMutableDictionary dictionaryWithJSONString: jsonValue];
if (values)
[values retain];
else

View File

@@ -499,7 +499,7 @@ static NSLock *lock = nil;
aUID = [uid hasPrefix: @"@"] ? [uid substringFromIndex: 1] : uid;
contactInfos = [NSMutableDictionary dictionary];
jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: aUID];
currentUser = [NSDictionary dictionaryWithJSONString: jsonUser];
currentUser = [NSMutableDictionary dictionaryWithJSONString: jsonUser];
#if defined(THREADSAFE)
[lock lock];
#endif

View File

@@ -1496,7 +1496,7 @@ RANGE(2);
if ([json length])
{
attendees = [NSArray array];
attendeesData = [NSDictionary dictionaryWithJSONString: json];
attendeesData = [NSMutableDictionary dictionaryWithJSONString: json];
if (attendeesData)
{
newAttendees = [NSMutableArray array];