mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-29 08:49:27 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user