X-Git-Url: http://cgit.babelmonkeys.de/?p=jubjub.git;a=blobdiff_plain;f=src%2Fcore%2Fmain.m;h=659414bf349d4d2e886d0eb793b2956cbac51668;hp=9ec84951de2042dbace938b3e7411768e11e2efe;hb=0daa7a1cf98c6281dd7ba09baf0bf36cd1e154f7;hpb=68a17f7fc1f5fe8c2fee68ff35e672af4fd1e2f2 diff --git a/src/core/main.m b/src/core/main.m index 9ec8495..659414b 100644 --- a/src/core/main.m +++ b/src/core/main.m @@ -3,12 +3,11 @@ #import "JubGtkUI.h" #import "JubConfig.h" +#import "JubChatClient.h" -@interface AppDelegate: OFObject - +@interface AppDelegate: OFObject { - XMPPConnection *connection; - XMPPRoster *roster; + JubChatClient *client; id ui; } @end @@ -18,44 +17,19 @@ OF_APPLICATION_DELEGATE(AppDelegate) @implementation AppDelegate - (void)applicationDidFinishLaunching { - id rosterDelegate; - JubConfig *config = [[JubConfig alloc] initWithFile: @"config.xml"]; + JubConfig *config = [[[JubConfig alloc] initWithFile: @"config.xml"] + autorelease]; - connection = [[XMPPConnection alloc] init]; - [connection addDelegate: self]; + client = [[JubChatClient alloc] initWithConfig: config]; - connection.domain = config.domain; - connection.server = config.server; - connection.username = config.username; - connection.password = config.password; + ui = [[JubGtkUI alloc] initWithClient: client]; - ui = [[JubGtkUI alloc] initWithConnection: connection]; - rosterDelegate = [ui rosterDelegate]; - - [connection addDelegate: rosterDelegate]; - - roster = [[XMPPRoster alloc] initWithConnection: connection]; - [roster addDelegate: rosterDelegate]; - [roster addDelegate: self]; - - [connection asyncConnectAndHandle]; + client.ui = ui; + [client.connection addDelegate: self]; [ui startUIThread]; } -- (void)connection: (XMPPConnection*)conn_ - wasBoundToJID: (XMPPJID*)jid -{ - of_log(@"Bound to JID: %@", [jid fullJID]); - - [roster requestRoster]; -} - -- (void)rosterWasReceived: (XMPPRoster*)roster -{ - [connection sendStanza: [XMPPPresence presence]]; -} - - (void)connection: (XMPPConnection*)conn didReceiveElement: (OFXMLElement*)element {