DiscoEntity: Answer to requests send to the caps node
This commit is contained in:
parent
56e3aef482
commit
441a9e4472
3 changed files with 55 additions and 6 deletions
|
@ -31,7 +31,21 @@
|
|||
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];
|
||||
|
@ -39,6 +53,7 @@
|
|||
@try {
|
||||
_discoNodes = [OFMutableDictionary new];
|
||||
_connection = connection;
|
||||
_capsNode = [capsNode copy];
|
||||
|
||||
[_connection addDelegate: self];
|
||||
} @catch (id e) {
|
||||
|
@ -68,6 +83,11 @@
|
|||
forKey: [node node]];
|
||||
}
|
||||
|
||||
- (OFString*)capsNode
|
||||
{
|
||||
OF_GETTER(_capsNode, YES);
|
||||
}
|
||||
|
||||
- (OFString*)capsHash
|
||||
{
|
||||
OFMutableString *caps = [OFMutableString string];
|
||||
|
@ -117,10 +137,17 @@
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue