@interface AppDelegate: OFObject <OFApplicationDelegate, XMPPConnectionDelegate>
{
-OFString *discoID;
-PEPThread *pepper;
+ PEPThread *pepper;
}
@end
{
XMPPPresence *pres;
XMPPIQ *disco;
+ OFString *discoID;
[of_stdout writeFormat: @"Bound to JID: %@\n", [jid fullJID]];
elementWithName: @"query"
namespace: NS_DISCO_INFO]];
- [conn sendStanza: disco];
+ [conn sendIQ: disco
+ withCallbackObject: self
+ selector: @selector(mpdbot_handleDiscoForConnection:withIQ:)];
}
-- (BOOL)connection: (XMPPConnection*)conn
- didReceiveIQ: (XMPPIQ*)iq
+- (BOOL)mpdbot_handleDiscoForConnection: (XMPPConnection*)conn
+ withIQ: (XMPPIQ*)iq
{
OFXMLElement *query = [iq elementForName: @"query"
namespace: NS_DISCO_INFO];
- if ([iq.ID isEqual: discoID]) {
- for (OFXMLElement *identity
- in [query elementsForName: @"identity"
- namespace: NS_DISCO_INFO]) {
- if ([[[identity attributeForName: @"category"]
- stringValue] isEqual: @"pubsub"] &&
- [[[identity attributeForName: @"type"] stringValue]
- isEqual: @"pep"]) {
- pepper = [[PEPThread alloc]
- initWithObject: conn];
- [pepper start];
-
- return YES;
- }
+ for (OFXMLElement *identity in [query elementsForName: @"identity"
+ namespace: NS_DISCO_INFO]) {
+ if ([[[identity attributeForName: @"category"]
+ stringValue] isEqual: @"pubsub"] &&
+ [[[identity attributeForName: @"type"] stringValue]
+ isEqual: @"pep"]) {
+ pepper = [[PEPThread alloc]
+ initWithObject: conn];
+ [pepper start];
+
+ return YES;
}
- [of_stderr writeLine: @"Server does NOT support PEP"];
}
+ [of_stderr writeLine: @"Server does NOT support PEP"];
return NO;
}