mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-07 04:47:14 +00:00
Monotone-Parent: 652fb1324338399d044d5f01bb158d94080a27c0
Monotone-Revision: ea84b0da49761a54044bb70c2502171c1b981e86 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-10-26T18:20:46 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
25fa112832
commit
3743b78fff
11 files changed
+49
-41
No files matched your search
@@ -34,6 +34,7 @@
|
||||
#import "NSArray+Utilities.h"
|
||||
#import "NSDictionary+BSJSONAdditions.h"
|
||||
#import "NSDictionary+URL.h"
|
||||
#import "NSScanner+BSJSONAdditions.h"
|
||||
|
||||
#import "NSString+Utilities.h"
|
||||
|
||||
@@ -505,9 +506,28 @@ static NSMutableCharacterSet *safeLDIFStartChars = nil;
|
||||
NSDictionary *jsonData;
|
||||
|
||||
#warning this method is a quick and dirty way of detecting the file-format
|
||||
jsonData = [NSMutableDictionary dictionaryWithJSONString: self];
|
||||
jsonData = [self objectFromJSONString];
|
||||
|
||||
return (jsonData != nil);
|
||||
}
|
||||
|
||||
- (id) objectFromJSONString
|
||||
{
|
||||
NSScanner *scanner;
|
||||
NSObject *object;
|
||||
|
||||
object = nil;
|
||||
|
||||
if ([self length] > 0)
|
||||
{
|
||||
scanner = [[NSScanner alloc] initWithString: self];
|
||||
if (![scanner scanJSONValue: &object])
|
||||
object = nil;
|
||||
[scanner autorelease];
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user