This commit is contained in:
giuseppenuc committed 2016-02-24 16:56:39 +01:00
1 parent d281d765ea
commit 5b074a5176
1261 files changed
+199158 -7303

No files matched your search

@@ -0,0 +1,35 @@
#import <Foundation/Foundation.h>
#import "XMPPElement.h"
/**
* An outgoing stanza.
*
* The translation from element to stanzaId may be an asynchronous process,
* so this structure is used to assist in the process.
**/
@interface XMPPStreamManagementOutgoingStanza : NSObject <NSCopying, NSCoding>
- (instancetype)initAwaitingStanzaId;
- (instancetype)initWithStanzaId:(id)stanzaId;
@property (nonatomic, strong, readwrite) id stanzaId;
@property (nonatomic, assign, readwrite) BOOL awaitingStanzaId;
@end
#pragma mark -
/**
* An incoming stanza.
*
* The translation from element to stanzaId may be an asynchronous process,
* so this structure is used to assist in the process.
**/
@interface XMPPStreamManagementIncomingStanza : NSObject
- (instancetype)initWithStanzaId:(id)stanzaId isHandled:(BOOL)isHandled;
@property (nonatomic, strong, readwrite) id stanzaId;
@property (nonatomic, assign, readwrite) BOOL isHandled;
@end
@@ -0,0 +1,85 @@
#import "XMPPStreamManagementStanzas.h"
@implementation XMPPStreamManagementOutgoingStanza
@synthesize awaitingStanzaId = awaitingStanzaId;
@synthesize stanzaId = stanzaId;
/**
* Use when the stanzaId is unknown, and we are awaiting a stanzaId from the delegate(s).
**/
- (instancetype)initAwaitingStanzaId
{
if ((self = [super init]))
{
awaitingStanzaId = YES;
}
return self;
}
/**
* Use when the stanzaId is known, meaning we are NOT awaiting a stanzaId from the delegate(s).
* The stanzaId may be nil.
**/
- (instancetype)initWithStanzaId:(id)inStanzaId
{
if ((self = [super init]))
{
stanzaId = inStanzaId;
awaitingStanzaId = NO;
}
return self;
}
/* NSCopying */
- (id)copyWithZone:(NSZone *)zone
{
XMPPStreamManagementOutgoingStanza *copy = [[XMPPStreamManagementOutgoingStanza alloc] init];
copy->awaitingStanzaId = awaitingStanzaId;
copy->stanzaId = stanzaId;
return copy;
}
/* NSCoding */
- (id)initWithCoder:(NSCoder *)decoder
{
if ((self = [super init]))
{
awaitingStanzaId = [decoder decodeBoolForKey:@"awaitingStanzaId"];
stanzaId = [decoder decodeObjectForKey:@"stanzaId"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeBool:awaitingStanzaId forKey:@"awaitingStanzaId"];
[coder encodeObject:stanzaId forKey:@"stanzaId"];
}
@end
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@implementation XMPPStreamManagementIncomingStanza
@synthesize stanzaId = stanzaId;
@synthesize isHandled = isHandled;
- (instancetype)initWithStanzaId:(id)inStanzaId isHandled:(BOOL)inIsHandled
{
if ((self = [super init]))
{
stanzaId = inStanzaId;
isHandled = inIsHandled;
}
return self;
}
@end