]> cgit.babelmonkeys.de Git - jubjub.git/blob - src/core/main.m
Prefix ivars with an underscore
[jubjub.git] / src / core / main.m
1 #import <ObjFW/ObjFW.h>
2 #import <ObjXMPP/ObjXMPP.h>
3
4 #import "JubGtkUI.h"
5 #import "JubConfig.h"
6 #import "JubChatClient.h"
7
8 @interface AppDelegate: OFObject <OFApplicationDelegate, XMPPConnectionDelegate>
9 {
10         JubChatClient *_client;
11         id<JubUI> _ui;
12 }
13 @end
14
15 OF_APPLICATION_DELEGATE(AppDelegate)
16
17 @implementation AppDelegate
18 - (void)applicationDidFinishLaunching
19 {
20         JubConfig *config = [[[JubConfig alloc] initWithFile: @"config.xml"]
21             autorelease];
22
23         _client = [[JubChatClient alloc] initWithConfig: config];
24
25         _ui = [[JubGtkUI alloc] initWithClient: _client];
26
27         _client.ui = _ui;
28         [_client.connection addDelegate: self];
29
30         [_ui startUIThread];
31 }
32
33 -  (void)connection: (XMPPConnection*)connection
34   didReceiveElement: (OFXMLElement*)element
35 {
36         of_log(@"In:  %@", element);
37 }
38
39 - (void)connection: (XMPPConnection*)connection
40     didSendElement: (OFXMLElement*)element
41 {
42         of_log(@"Out: %@", element);
43 }
44
45 -  (void)connection: (XMPPConnection*)connection
46   didThrowException: (id)e
47 {
48         @throw e;
49 }
50 @end