--- /dev/null
+#import "JubChatClient.h"
+
+@implementation JubChatClient
+@synthesize connection;
+@synthesize roster;
+@synthesize ui;
+
+- initWithConfig: (JubConfig*)config
+{
+ self = [super init];
+
+ @try {
+ connection = [XMPPConnection new];
+
+ connection.username = config.username;
+ connection.domain = config.domain;
+ connection.server = config.server;
+ connection.password = config.password;
+ [connection addDelegate: self];
+
+ roster = [[XMPPRoster alloc] initWithConnection: connection];
+ [roster addDelegate: self];
+
+ streamManagement = [[XMPPStreamManagement alloc]
+ initWithConnection: connection];
+
+ [connection asyncConnectAndHandle];
+ } @catch (id e) {
+ [self release];
+ @throw e;
+ }
+
+ return self;
+}
+
+- (void)dealloc
+{
+ [roster release];
+ [streamManagement release];
+ [connection release];
+
+ [super dealloc];
+}
+
+- (void)connection: (XMPPConnection*)conn_
+ wasBoundToJID: (XMPPJID*)jid
+{
+ of_log(@"Bound to JID: %@", [jid fullJID]);
+
+ [roster requestRoster];
+}
+
+- (void)rosterWasReceived: (XMPPRoster*)roster
+{
+ [connection sendStanza: [XMPPPresence presence]];
+}
+@end