- chatMap = [[OFMutableDictionary alloc] init];
-
- 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];
-
- contactManager = [[XMPPContactManager alloc]
- initWithConnection: connection
- roster: roster];
-
- streamManagement = [[XMPPStreamManagement alloc]
- initWithConnection: connection];
-
- [connection asyncConnectAndHandle];
+ _chatMap = [[OFMutableDictionary alloc] init];
+
+ _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];
+
+ _discoEntity =
+ [[XMPPDiscoEntity alloc] initWithConnection: _connection
+ capsNode: JUB_CLIENT_URI];
+
+ XMPPDiscoIdentity *identity =
+ [XMPPDiscoIdentity identityWithCategory: @"client"
+ type: @"pc"
+ name: @"JubJub"];
+ [_discoEntity addIdentity: identity];
+ [_discoEntity addFeature: XMPP_NS_CAPS];
+
+ _avatarManager =
+ [[JubAvatarManager alloc] initWithClient: self];
+
+ _contactManager = [[XMPPContactManager alloc]
+ initWithConnection: _connection
+ roster: _roster];
+ [_contactManager addDelegate: self];
+
+ _streamManagement = [[XMPPStreamManagement alloc]
+ initWithConnection: _connection];