ObjXMPP  Check-in [5f55161423]

Overview
Comment:Prevent changing the data storage after the roster has been requested.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5f55161423985b6d7829c41fb23d383663bd0117f75a2b0772149321455332ce
User & Date: js on 2012-02-06 14:23:26
Other Links: manifest | tags
Context
2012-02-06
15:17
Implement roster versioning.
Still needs some testing.
check-in: e6237b123a user: js tags: trunk
14:23
Prevent changing the data storage after the roster has been requested. check-in: 5f55161423 user: js tags: trunk
14:18
Add missing method in interface. check-in: 4c222a8b70 user: js tags: trunk
Changes

Modified src/XMPPRoster.h from [d4d891ac82] to [c00194e1a0].

69
70
71
72
73
74
75

76
77
78
79
80
81
82
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83







+







#endif
{
/// \cond internal
	XMPPConnection *connection;
	OFMutableDictionary *rosterItems;
	XMPPMulticastDelegate *delegates;
	id <XMPPStorage> dataStorage;
	BOOL rosterRequested;
/// \endcond
}

#ifdef OF_HAVE_PROPERTIES
/**
 * \brief An object for data storage, conforming to the XMPPStorage protocol.
 *

Modified src/XMPPRoster.m from [96a5c55573] to [ab74131ad5].

25
26
27
28
29
30
31


32
33
34
35
36
37
38
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40







+
+







# include "config.h"
#endif

#define XMPP_ROSTER_M

#include <assert.h>

#import <ObjFW/OFInvalidArgumentException.h>

#import "XMPPRoster.h"
#import "XMPPRosterItem.h"
#import "XMPPConnection.h"
#import "XMPPIQ.h"
#import "XMPPJID.h"
#import "XMPPMulticastDelegate.h"
#import "namespaces.h"
69
70
71
72
73
74
75


76
77
78
79
80
81
82
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86







+
+







{
	return [[rosterItems copy] autorelease];
}

- (void)requestRoster
{
	XMPPIQ *iq;

	rosterRequested = YES;

	iq = [XMPPIQ IQWithType: @"get"
			     ID: [connection generateStanzaID]];
	[iq addChild: [OFXMLElement elementWithName: @"query"
					  namespace: XMPP_NS_ROSTER]];
	[connection     sendIQ: iq
	    withCallbackObject: self
184
185
186
187
188
189
190


191

192
193
194
195
196
197
198
188
189
190
191
192
193
194
195
196

197
198
199
200
201
202
203
204







+
+
-
+







- (void)removeDelegate: (id <XMPPRosterDelegate>)delegate
{
	[delegates removeDelegate: delegate];
}

- (void)setDataStorage: (id <XMPPStorage>)dataStorage_
{
	if (rosterRequested)
		@throw [OFInvalidArgumentException exceptionWithClass: isa];
	/* TODO: Prevent changing it after it has been used */

	dataStorage = dataStorage_;
}

- (id <XMPPStorage>)dataStorage
{
	return dataStorage;
}