@implementation AppDelegate
- (void)applicationDidFinishLaunching
{
- ui = [[JubGtkUI alloc] init];
+ id<XMPPRosterDelegate, XMPPConnectionDelegate> rosterDelegate;
connection = [[XMPPConnection alloc] init];
[connection addDelegate: self];
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];
}