26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#import "namespaces.h"
@implementation XMPPDiscoEntity
+ discoEntityWithConnection: (XMPPConnection*)connection
{
return [[[self alloc] initWithConnection: connection] autorelease];
}
- initWithConnection: (XMPPConnection*)connection
{
self = [super initWithJID: [connection JID]
node: nil];
@try {
_discoNodes = [OFMutableDictionary new];
_connection = connection;
[_connection addDelegate: self];
} @catch (id e) {
[self release];
@throw e;
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
|
#import "namespaces.h"
@implementation XMPPDiscoEntity
+ discoEntityWithConnection: (XMPPConnection*)connection
{
return [[[self alloc] initWithConnection: connection] autorelease];
}
+ discoEntityWithConnection: (XMPPConnection*)connection
capsNode: (OFString*)capsNode
{
return [[[self alloc] initWithConnection: connection
capsNode: capsNode] autorelease];
}
- initWithConnection: (XMPPConnection*)connection
{
return [self initWithConnection: connection
capsNode: nil];
}
- initWithConnection: (XMPPConnection*)connection
capsNode: (OFString*)capsNode
{
self = [super initWithJID: [connection JID]
node: nil];
@try {
_discoNodes = [OFMutableDictionary new];
_connection = connection;
_capsNode = [capsNode copy];
[_connection addDelegate: self];
} @catch (id e) {
[self release];
@throw e;
}
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
}
- (void)addDiscoNode: (XMPPDiscoNode*)node
{
[_discoNodes setObject: node
forKey: [node node]];
}
- (OFString*)capsHash
{
OFMutableString *caps = [OFMutableString string];
OFEnumerator *enumerator;
XMPPDiscoIdentity *identity;
OFString *feature;
|
>
>
>
>
>
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
}
- (void)addDiscoNode: (XMPPDiscoNode*)node
{
[_discoNodes setObject: node
forKey: [node node]];
}
- (OFString*)capsNode
{
OF_GETTER(_capsNode, YES);
}
- (OFString*)capsHash
{
OFMutableString *caps = [OFMutableString string];
OFEnumerator *enumerator;
XMPPDiscoIdentity *identity;
OFString *feature;
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
query = [IQ elementForName: @"query"
namespace: XMPP_NS_DISCO_INFO];
if (query != nil) {
OFString *node =
[[query attributeForName: @"node"] stringValue];
if (node == nil)
return [self XMPP_handleInfoIQ: IQ
connection: connection];
XMPPDiscoNode *responder = [_discoNodes objectForKey: node];
if (responder != nil)
return [responder XMPP_handleInfoIQ: IQ
connection: connection];
|
>
>
>
>
>
>
>
|
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
query = [IQ elementForName: @"query"
namespace: XMPP_NS_DISCO_INFO];
if (query != nil) {
OFString *node =
[[query attributeForName: @"node"] stringValue];
if (node == nil)
return [self XMPP_handleInfoIQ: IQ
connection: connection];
OFString *capsNode = [_capsNode stringByAppendingFormat: @"#%@",
[self capsHash]];
if ([capsNode isEqual: node])
return [self XMPP_handleInfoIQ: IQ
connection: connection];
XMPPDiscoNode *responder = [_discoNodes objectForKey: node];
if (responder != nil)
return [responder XMPP_handleInfoIQ: IQ
connection: connection];
|