#define NS_DISCO_INFO @"http://jabber.org/protocol/disco#info"
-@interface AppDelegate: OFObject
-#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
- <OFApplicationDelegate, XMPPConnectionDelegate>
-#endif
-
+@interface AppDelegate: OFObject <OFApplicationDelegate, XMPPConnectionDelegate>
OFString *discoID;
PEPThread *pepper;
@end
OFArray *arguments = [OFApplication arguments];
conn = [[XMPPConnection alloc] init];
- [conn setDelegate: self];
+ conn.delegate = self;
- if ([arguments count] != 3) {
+ if (arguments.count != 3) {
[of_stdout writeFormat: @"Usage: %@ <server> <user> <passwd>\n",
[OFApplication programName]];
[OFApplication terminateWithStatus: 1];
}
- [conn setDomain: [arguments objectAtIndex: 0]];
- [conn setUsername: [arguments objectAtIndex: 1]];
- [conn setPassword: [arguments objectAtIndex: 2]];
- [conn setResource: @"ObjXMPP"];
+ conn.domain = [arguments objectAtIndex: 0];
+ conn.username = [arguments objectAtIndex: 1];
+ conn.password = [arguments objectAtIndex: 2];
+ conn.resource = @"ObjXMPP";
@try {
[conn connect];
ID: discoID];
disco.to = [XMPPJID JIDWithString: [[conn JID] bareJID]];
[disco addChild: [OFXMLElement
- elementWithName: @"query"
- namespace: NS_DISCO_INFO]];
+ elementWithName: @"query"
+ namespace: NS_DISCO_INFO]];
[conn sendStanza: disco];
}
{
OFXMLElement *query = [iq elementForName: @"query"
namespace: NS_DISCO_INFO];
- if ([[iq ID] isEqual: discoID]) {
+ if ([iq.ID isEqual: discoID]) {
for (OFXMLElement *identity
in [query elementsForName: @"identity"
namespace: NS_DISCO_INFO]) {
pepper = [[PEPThread alloc]
initWithObject: conn];
[pepper start];
+
return YES;
}
}