Prevent changing the data storage after the roster has been requested.
This commit is contained in:
parent
d0a3e35780
commit
04b9740263
2 changed files with 8 additions and 1 deletions
|
@ -73,6 +73,7 @@
|
||||||
OFMutableDictionary *rosterItems;
|
OFMutableDictionary *rosterItems;
|
||||||
XMPPMulticastDelegate *delegates;
|
XMPPMulticastDelegate *delegates;
|
||||||
id <XMPPStorage> dataStorage;
|
id <XMPPStorage> dataStorage;
|
||||||
|
BOOL rosterRequested;
|
||||||
/// \endcond
|
/// \endcond
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#import <ObjFW/OFInvalidArgumentException.h>
|
||||||
|
|
||||||
#import "XMPPRoster.h"
|
#import "XMPPRoster.h"
|
||||||
#import "XMPPRosterItem.h"
|
#import "XMPPRosterItem.h"
|
||||||
#import "XMPPConnection.h"
|
#import "XMPPConnection.h"
|
||||||
|
@ -74,6 +76,8 @@
|
||||||
{
|
{
|
||||||
XMPPIQ *iq;
|
XMPPIQ *iq;
|
||||||
|
|
||||||
|
rosterRequested = YES;
|
||||||
|
|
||||||
iq = [XMPPIQ IQWithType: @"get"
|
iq = [XMPPIQ IQWithType: @"get"
|
||||||
ID: [connection generateStanzaID]];
|
ID: [connection generateStanzaID]];
|
||||||
[iq addChild: [OFXMLElement elementWithName: @"query"
|
[iq addChild: [OFXMLElement elementWithName: @"query"
|
||||||
|
@ -188,7 +192,9 @@
|
||||||
|
|
||||||
- (void)setDataStorage: (id <XMPPStorage>)dataStorage_
|
- (void)setDataStorage: (id <XMPPStorage>)dataStorage_
|
||||||
{
|
{
|
||||||
/* TODO: Prevent changing it after it has been used */
|
if (rosterRequested)
|
||||||
|
@throw [OFInvalidArgumentException exceptionWithClass: isa];
|
||||||
|
|
||||||
dataStorage = dataStorage_;
|
dataStorage = dataStorage_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue