XMPPStreamManagementStanzas.m
1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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