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;
|
||||
XMPPMulticastDelegate *delegates;
|
||||
id <XMPPStorage> dataStorage;
|
||||
BOOL rosterRequested;
|
||||
/// \endcond
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#import <ObjFW/OFInvalidArgumentException.h>
|
||||
|
||||
#import "XMPPRoster.h"
|
||||
#import "XMPPRosterItem.h"
|
||||
#import "XMPPConnection.h"
|
||||
|
@ -74,6 +76,8 @@
|
|||
{
|
||||
XMPPIQ *iq;
|
||||
|
||||
rosterRequested = YES;
|
||||
|
||||
iq = [XMPPIQ IQWithType: @"get"
|
||||
ID: [connection generateStanzaID]];
|
||||
[iq addChild: [OFXMLElement elementWithName: @"query"
|
||||
|
@ -188,7 +192,9 @@
|
|||
|
||||
- (void)setDataStorage: (id <XMPPStorage>)dataStorage_
|
||||
{
|
||||
/* TODO: Prevent changing it after it has been used */
|
||||
if (rosterRequested)
|
||||
@throw [OFInvalidArgumentException exceptionWithClass: isa];
|
||||
|
||||
dataStorage = dataStorage_;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue