]> cgit.babelmonkeys.de Git - jubjub.git/blobdiff - src/core/JubChatClient.m
Prefix ivars with an underscore
[jubjub.git] / src / core / JubChatClient.m
index 3c563f5e9dd1a9f267b9b09ad63787a8be9de1ea..9acdf3935addec8aed8df165bcb5630eb0208893 100644 (file)
@@ -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;
 
 - (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];
 }
        OFAutoreleasePool *pool = [OFAutoreleasePool new];
        OFString *bareJID = [contact.rosterItem.JID bareJID];
 
-       id<JubChatUI> chat = [chatMap objectForKey: bareJID];
+       id<JubChatUI> 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];
        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);
        }
 }
 
 {
        XMPPPresence *pres = [XMPPPresence presence];
        [pres setStatus: @"Hello from JubJub"];
-       [connection sendStanza: pres];
+       [_connection sendStanza: pres];
 }
 @end