X-Git-Url: http://cgit.babelmonkeys.de/?a=blobdiff_plain;f=src%2Fcore%2FJubChatClient.m;fp=src%2Fcore%2FJubChatClient.m;h=9acdf3935addec8aed8df165bcb5630eb0208893;hb=62fb875be3885fcecbed4f614f01975cd200c9c8;hp=3c563f5e9dd1a9f267b9b09ad63787a8be9de1ea;hpb=f2af67c5eefd2239f7c3cc7688896bd3258bb7ec;p=jubjub.git diff --git a/src/core/JubChatClient.m b/src/core/JubChatClient.m index 3c563f5..9acdf39 100644 --- a/src/core/JubChatClient.m +++ b/src/core/JubChatClient.m @@ -1,37 +1,37 @@ #import "JubChatClient.h" @implementation JubChatClient -@synthesize connection; -@synthesize roster; -@synthesize contactManager; -@synthesize presence; -@synthesize ui; +@synthesize connection = _connection; +@synthesize roster = _roster; +@synthesize contactManager = _contactManager; +@synthesize presence = _presence; +@synthesize ui = _ui; - initWithConfig: (JubConfig*)config { self = [super init]; @try { - chatMap = [[OFMutableDictionary alloc] init]; + _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]; + _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]; + _roster = [[XMPPRoster alloc] initWithConnection: _connection]; + [_roster addDelegate: self]; - contactManager = [[XMPPContactManager alloc] - initWithConnection: connection - roster: roster]; + _contactManager = [[XMPPContactManager alloc] + initWithConnection: _connection + roster: _roster]; - streamManagement = [[XMPPStreamManagement alloc] - initWithConnection: connection]; + _streamManagement = [[XMPPStreamManagement alloc] + initWithConnection: _connection]; - [connection asyncConnectAndHandle]; + [_connection asyncConnectAndHandle]; } @catch (id e) { [self release]; @throw e; @@ -42,12 +42,12 @@ - (void)dealloc { - [roster release]; - [contactManager release]; - [streamManagement release]; - [connection release]; - [presence release]; - [chatMap release]; + [_roster release]; + [_contactManager release]; + [_streamManagement release]; + [_connection release]; + [_presence release]; + [_chatMap release]; [super dealloc]; } @@ -57,27 +57,27 @@ OFAutoreleasePool *pool = [OFAutoreleasePool new]; OFString *bareJID = [contact.rosterItem.JID bareJID]; - id chat = [chatMap objectForKey: bareJID]; + id chat = [_chatMap objectForKey: bareJID]; if (chat == nil) { OFString * title = [@"Chat with " stringByAppendingString: bareJID]; - chat = [[[[ui chatUIClass] alloc] + chat = [[[[_ui chatUIClass] alloc] initWithTitle: title closeBlock: ^{ - [chatMap removeObjectForKey: bareJID]; + [_chatMap removeObjectForKey: bareJID]; } sendBlock: ^(OFString *text) { XMPPMessage *msg = [XMPPMessage messageWithType: @"chat"]; msg.body = text; [contact sendMessage: msg - connection: connection]; + connection: _connection]; } ] autorelease]; - [chatMap setObject: chat - forKey: bareJID]; + [_chatMap setObject: chat + forKey: bareJID]; } [pool release]; @@ -85,21 +85,21 @@ return chat; } -- (void)connection: (XMPPConnection*)connection_ +- (void)connection: (XMPPConnection*)connection wasBoundToJID: (XMPPJID*)jid { of_log(@"Bound to JID: %@", [jid fullJID]); - [roster requestRoster]; + [_roster requestRoster]; } -- (void)connection: (XMPPConnection*)connection_ - didReceivePresence: (XMPPPresence*)presence_ +- (void)connection: (XMPPConnection*)connection + didReceivePresence: (XMPPPresence*)presence { - if ([presence_.from isEqual: connection.JID]) { - [ui client: self - didChangePresence: presence_]; - OF_SETTER(presence, presence_, YES, 0); + if ([presence.from isEqual: connection.JID]) { + [_ui client: self + didChangePresence: presence]; + OF_SETTER(_presence, presence, YES, 0); } } @@ -107,6 +107,6 @@ { XMPPPresence *pres = [XMPPPresence presence]; [pres setStatus: @"Hello from JubJub"]; - [connection sendStanza: pres]; + [_connection sendStanza: pres]; } @end