X-Git-Url: http://cgit.babelmonkeys.de/?p=jubjub.git;a=blobdiff_plain;f=src%2Fcore%2Fmain.m;h=fda8c5f96b5d59b229afed59b7f745fe9b75eb05;hp=459a15c9a898f0ab126b50aad6a81019a97e8a46;hb=d4efe21c5972e934b33fd70d42a407124c8a746b;hpb=bfecc06eee92ced72c224a4d2c98dbdb8f08d3f2 diff --git a/src/core/main.m b/src/core/main.m index 459a15c..fda8c5f 100644 --- a/src/core/main.m +++ b/src/core/main.m @@ -2,6 +2,7 @@ #import #import "JubGtkUI.h" +#import "JubCLIUI.h" #import "JubConfig.h" #import "JubChatClient.h" @@ -22,11 +23,21 @@ OF_APPLICATION_DELEGATE(AppDelegate) _client = [[JubChatClient alloc] initWithConfig: config]; - _ui = [[JubGtkUI alloc] initWithClient: _client]; + if ([config.frontend isEqual: @"gtk"]) + _ui = [[JubGtkUI alloc] initWithClient: _client]; + else if ([config.frontend isEqual: @"cli"]) + _ui = [[JubCLIUI alloc] initWithClient: _client]; + else { + [of_stderr writeFormat: @"Unknown frontend '%@', known " + @"frontends are 'gtk' and 'cli'\n", config.frontend]; + [OFApplication terminate]; + } _client.ui = _ui; [_client.connection addDelegate: self]; + [_client.connection asyncConnectAndHandle]; + [_ui startUIThread]; }