ObjXMPP  Check-in [c9bb52e823]

Overview
Comment:Rename XMPPJSONFileStorage to XMPPFileStorage.

It uses BinaryPack instead of JSON now.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c9bb52e8239a7748bb46fcbde137df14dce4e67030b75d86086667dc3872b0e4
User & Date: js on 2013-02-23 13:49:32
Other Links: manifest | tags
Context
2013-03-03
16:30
Fix up -[XMPPJID isEqual:] and -[XMPPJID hash] check-in: 8bc32c2743 user: florob@babelmonkeys.de tags: trunk
2013-02-23
13:49
Rename XMPPJSONFileStorage to XMPPFileStorage. check-in: c9bb52e823 user: js tags: trunk
2013-02-18
23:16
Adjust to recent ObjFW changes. check-in: e81a369270 user: js tags: trunk
Changes

Modified .gitignore from [2fa598a929] to [25d2864b5c].

15
16
17
18
19
20
21

docs
extra.mk
ObjXMPP.xcodeproj/*.mode1v3
ObjXMPP.xcodeproj/*.pbxuser
ObjXMPP.xcodeproj/project.xcworkspace
ObjXMPP.xcodeproj/xcuserdata
tests/tests








>
15
16
17
18
19
20
21
22
docs
extra.mk
ObjXMPP.xcodeproj/*.mode1v3
ObjXMPP.xcodeproj/*.pbxuser
ObjXMPP.xcodeproj/project.xcworkspace
ObjXMPP.xcodeproj/xcuserdata
tests/tests
tests/storage.binarypack

Modified src/Makefile from [0633fdc12c] to [ad510f6243].

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
       XMPPConnection.m		\
       XMPPContact.m		\
       XMPPContactManager.m	\
       XMPPExceptions.m		\
       XMPPEXTERNALAuth.m	\
       XMPPIQ.m			\
       XMPPJID.m		\
       XMPPJSONFileStorage.m	\
       XMPPMessage.m		\
       XMPPMulticastDelegate.m	\
       XMPPPLAINAuth.m		\
       XMPPPresence.m		\
       XMPPRoster.m		\
       XMPPRosterItem.m		\
       XMPPSCRAMAuth.m		\







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
       XMPPConnection.m		\
       XMPPContact.m		\
       XMPPContactManager.m	\
       XMPPExceptions.m		\
       XMPPEXTERNALAuth.m	\
       XMPPIQ.m			\
       XMPPJID.m		\
       XMPPFileStorage.m	\
       XMPPMessage.m		\
       XMPPMulticastDelegate.m	\
       XMPPPLAINAuth.m		\
       XMPPPresence.m		\
       XMPPRoster.m		\
       XMPPRosterItem.m		\
       XMPPSCRAMAuth.m		\

Added src/XMPPFileStorage.h version [add2d8e5da].

Added src/XMPPFileStorage.m version [b5f01ad0ba].

Deleted src/XMPPJSONFileStorage.h version [5505b46086].

Deleted src/XMPPJSONFileStorage.m version [0ded529f90].

Modified src/XMPPRoster.m from [025bb21619] to [1fa0d01ca6].

301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325

	if ([groups count] > 0)
		[rosterItem setGroups: groups];

	return rosterItem;
}

- (void)XMPP_handleInitialRosterForConnection: (XMPPConnection*)connection_
					   IQ: (XMPPIQ*)iq
{
	OFXMLElement *rosterElement;
	OFEnumerator *enumerator;
	OFXMLElement *element;

	rosterElement = [iq elementForName: @"query"
				 namespace: XMPP_NS_ROSTER];

	if ([_connection supportsRosterVersioning]) {
		if (rosterElement == nil) {
			OFDictionary *items = [_dataStorage
			    dictionaryForPath: @"roster.items"];
			OFEnumerator *enumerator = [items objectEnumerator];
			OFDictionary *item;

			while ((item = [enumerator nextObject]) != nil) {







|
|





|


|







301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325

	if ([groups count] > 0)
		[rosterItem setGroups: groups];

	return rosterItem;
}

- (void)XMPP_handleInitialRosterForConnection: (XMPPConnection*)connection
					   IQ: (XMPPIQ*)IQ
{
	OFXMLElement *rosterElement;
	OFEnumerator *enumerator;
	OFXMLElement *element;

	rosterElement = [IQ elementForName: @"query"
				 namespace: XMPP_NS_ROSTER];

	if ([connection supportsRosterVersioning]) {
		if (rosterElement == nil) {
			OFDictionary *items = [_dataStorage
			    dictionaryForPath: @"roster.items"];
			OFEnumerator *enumerator = [items objectEnumerator];
			OFDictionary *item;

			while ((item = [enumerator nextObject]) != nil) {
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
		pool = [OFAutoreleasePool new];
		rosterItem = [self XMPP_rosterItemWithXMLElement: element];

		[self XMPP_updateRosterItem: rosterItem];
		[pool release];
	}

	if ([_connection supportsRosterVersioning] && rosterElement != nil) {
		OFString *ver =
		    [[rosterElement attributeForName: @"ver"] stringValue];
		[_dataStorage setStringValue: ver
				     forPath: @"roster.ver"];
		[_dataStorage save];
	}

	[_delegates broadcastSelector: @selector(rosterWasReceived:)
			   withObject: self];
}
@end







|











357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
		pool = [OFAutoreleasePool new];
		rosterItem = [self XMPP_rosterItemWithXMLElement: element];

		[self XMPP_updateRosterItem: rosterItem];
		[pool release];
	}

	if ([connection supportsRosterVersioning] && rosterElement != nil) {
		OFString *ver =
		    [[rosterElement attributeForName: @"ver"] stringValue];
		[_dataStorage setStringValue: ver
				     forPath: @"roster.ver"];
		[_dataStorage save];
	}

	[_delegates broadcastSelector: @selector(rosterWasReceived:)
			   withObject: self];
}
@end

Modified tests/test.m from [1cf3c54e24] to [ef9f547a18].

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#import "XMPPJID.h"
#import "XMPPStanza.h"
#import "XMPPIQ.h"
#import "XMPPMessage.h"
#import "XMPPPresence.h"
#import "XMPPRoster.h"
#import "XMPPStreamManagement.h"
#import "XMPPJSONFileStorage.h"

@interface AppDelegate: OFObject
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
    <OFApplicationDelegate, XMPPConnectionDelegate, XMPPRosterDelegate>
#endif
{
	XMPPConnection *conn;







|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#import "XMPPJID.h"
#import "XMPPStanza.h"
#import "XMPPIQ.h"
#import "XMPPMessage.h"
#import "XMPPPresence.h"
#import "XMPPRoster.h"
#import "XMPPStreamManagement.h"
#import "XMPPFileStorage.h"

@interface AppDelegate: OFObject
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
    <OFApplicationDelegate, XMPPConnectionDelegate, XMPPRosterDelegate>
#endif
{
	XMPPConnection *conn;
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	    [[stanza from] fullJID], [[stanza to] fullJID], [stanza type],
	    [stanza ID]] isEqual: @"bob@localhost, alice@localhost, get, 42"]));


	conn = [[XMPPConnection alloc] init];
	[conn addDelegate: self];

	XMPPJSONFileStorage *storage =
	    [[XMPPJSONFileStorage alloc] initWithFile: @"storage.json"];
	[conn setDataStorage: storage];

	roster = [[XMPPRoster alloc] initWithConnection: conn];
	[roster addDelegate: self];

	[[XMPPStreamManagement alloc] initWithConnection: conn];








|
|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	    [[stanza from] fullJID], [[stanza to] fullJID], [stanza type],
	    [stanza ID]] isEqual: @"bob@localhost, alice@localhost, get, 42"]));


	conn = [[XMPPConnection alloc] init];
	[conn addDelegate: self];

	XMPPFileStorage *storage =
	    [[XMPPFileStorage alloc] initWithFile: @"storage.binarypack"];
	[conn setDataStorage: storage];

	roster = [[XMPPRoster alloc] initWithConnection: conn];
	[roster addDelegate: self];

	[[XMPPStreamManagement alloc] initWithConnection: conn];