]> cgit.babelmonkeys.de Git - jubjub.git/blobdiff - src/core/main.m
Open new chat windows when activating a roster row
[jubjub.git] / src / core / main.m
index ff97a3b602b56b98e01f071e7c3040923f23e912..c01a5ccecfe3da16797eff965ab93177e74e0f93 100644 (file)
@@ -17,7 +17,7 @@ OF_APPLICATION_DELEGATE(AppDelegate)
 @implementation AppDelegate
 - (void)applicationDidFinishLaunching
 {
-       ui = [[JubGtkUI alloc] init];
+       id<XMPPRosterDelegate, XMPPConnectionDelegate> rosterDelegate;
 
        connection = [[XMPPConnection alloc] init];
        [connection addDelegate: self];
@@ -26,15 +26,17 @@ OF_APPLICATION_DELEGATE(AppDelegate)
        connection.username = @"alice";
        connection.password = @"test";
 
-       [connection connect];
-       [connection handleConnection];
+       ui = [[JubGtkUI alloc] initWithConnection: connection];
+       rosterDelegate = [ui rosterDelegate];
 
-       [connection addDelegate: [ui rosterDelegate]];
+       [connection addDelegate: rosterDelegate];
 
        roster = [[XMPPRoster alloc] initWithConnection: connection];
-       [roster addDelegate: [ui rosterDelegate]];
+       [roster addDelegate: rosterDelegate];
        [roster addDelegate: self];
 
+       [connection asyncConnectAndHandle];
+
        [ui startUIThread];
 }