Rename XMPPJSONFileStorage to XMPPFileStorage.

It uses BinaryPack instead of JSON now.
This commit is contained in:
Jonathan Schleifer 2013-02-22 00:46:03 +01:00
parent d80dbedd1b
commit 005771ec2e
6 changed files with 19 additions and 17 deletions

View file

@ -14,7 +14,7 @@ SRCS = XMPPAuthenticator.m \
XMPPEXTERNALAuth.m \
XMPPIQ.m \
XMPPJID.m \
XMPPJSONFileStorage.m \
XMPPFileStorage.m \
XMPPMessage.m \
XMPPMulticastDelegate.m \
XMPPPLAINAuth.m \

View file

@ -26,7 +26,7 @@
@class OFMutableDictionary;
@interface XMPPJSONFileStorage: OFObject <XMPPStorage>
@interface XMPPFileStorage: OFObject <XMPPStorage>
{
OFString *_file;
OFMutableDictionary *_data;

View file

@ -28,13 +28,14 @@
#import <ObjFW/OFArray.h>
#import <ObjFW/OFDictionary.h>
#import <ObjFW/OFNumber.h>
#import <ObjFW/OFDataArray.h>
#import <ObjFW/OFAutoreleasePool.h>
#import <ObjFW/OFNotImplementedException.h>
#import "XMPPJSONFileStorage.h"
#import "XMPPFileStorage.h"
@implementation XMPPJSONFileStorage
@implementation XMPPFileStorage
- init
{
Class c = [self class];
@ -43,17 +44,17 @@
selector: _cmd];
}
- initWithFile: (OFString*)file_
- initWithFile: (OFString*)file
{
self = [super init];
@try {
OFAutoreleasePool *pool = [OFAutoreleasePool new];
_file = [file_ copy];
_file = [file copy];
@try {
_data = [[[OFString stringWithContentsOfFile:
_file] JSONValue] retain];
_data = [[[OFDataArray dataArrayWithContentsOfFile:
file] binaryPackValue] retain];
} @catch (id e) {
_data = [OFMutableDictionary new];
}
@ -77,7 +78,7 @@
- (void)save
{
[[_data JSONRepresentation] writeToFile: _file];
[[_data binaryPackRepresentation] writeToFile: _file];
}
- (void)XMPP_setObject: (id)object

View file

@ -305,17 +305,17 @@
return rosterItem;
}
- (void)XMPP_handleInitialRosterForConnection: (XMPPConnection*)connection_
IQ: (XMPPIQ*)iq
- (void)XMPP_handleInitialRosterForConnection: (XMPPConnection*)connection
IQ: (XMPPIQ*)IQ
{
OFXMLElement *rosterElement;
OFEnumerator *enumerator;
OFXMLElement *element;
rosterElement = [iq elementForName: @"query"
rosterElement = [IQ elementForName: @"query"
namespace: XMPP_NS_ROSTER];
if ([_connection supportsRosterVersioning]) {
if ([connection supportsRosterVersioning]) {
if (rosterElement == nil) {
OFDictionary *items = [_dataStorage
dictionaryForPath: @"roster.items"];
@ -361,7 +361,7 @@
[pool release];
}
if ([_connection supportsRosterVersioning] && rosterElement != nil) {
if ([connection supportsRosterVersioning] && rosterElement != nil) {
OFString *ver =
[[rosterElement attributeForName: @"ver"] stringValue];
[_dataStorage setStringValue: ver