1 #import <ObjFW/ObjFW.h>
2 #import <ObjXMPP/ObjXMPP.h>
6 @interface AppDelegate: OFObject
7 <OFApplicationDelegate, XMPPConnectionDelegate>
9 XMPPConnection *connection;
15 OF_APPLICATION_DELEGATE(AppDelegate)
17 @implementation AppDelegate
18 - (void)applicationDidFinishLaunching
20 ui = [[JubGtkUI alloc] init];
22 connection = [[XMPPConnection alloc] init];
23 [connection addDelegate: self];
25 connection.domain = @"localhost";
26 connection.username = @"alice";
27 connection.password = @"test";
30 [connection handleConnection];
32 roster = [[XMPPRoster alloc] initWithConnection: connection];
33 [roster addDelegate: [ui rosterDelegate]];
38 - (void)connection: (XMPPConnection*)conn_
39 wasBoundToJID: (XMPPJID*)jid
41 of_log(@"Bound to JID: %@", [jid fullJID]);
43 [roster requestRoster];
46 - (void)connection: (XMPPConnection*)conn
47 didReceiveElement: (OFXMLElement*)element
49 of_log(@"In: %@", element);
52 - (void)connection: (XMPPConnection*)conn
53 didSendElement: (OFXMLElement*)element
55 of_log(@"Out: %@", element);