@@ -32,16 +32,16 @@ roster: (XMPPRoster*)roster_ { self = [super init]; @try { - connection = connection_; - [connection addDelegate: self]; - roster = roster_; - [roster addDelegate: self]; - contacts = [[OFMutableDictionary alloc] init]; - delegates = [[XMPPMulticastDelegate alloc] init]; + _connection = connection_; + [_connection addDelegate: self]; + _roster = roster_; + [_roster addDelegate: self]; + _contacts = [[OFMutableDictionary alloc] init]; + _delegates = [[XMPPMulticastDelegate alloc] init]; } @catch (id e) { [self release]; @throw e; } @@ -48,31 +48,31 @@ return self; } - (void)dealloc { - [connection removeDelegate: self]; - [roster removeDelegate: self]; - [delegates release]; - [contacts release]; + [_connection removeDelegate: self]; + [_roster removeDelegate: self]; + [_delegates release]; + [_contacts release]; [super dealloc]; } - (void)addDelegate: (id )delegate { - [delegates addDelegate: delegate]; + [_delegates addDelegate: delegate]; } - (void)removeDelegate: (id )delegate { - [delegates removeDelegate: delegate]; + [_delegates removeDelegate: delegate]; } - (OFDictionary*)contacts { - OF_GETTER(contacts, YES); + OF_GETTER(_contacts, YES); } - (void)rosterWasReceived: (XMPPRoster*)roster_ { OFEnumerator *contactEnumerator; @@ -79,64 +79,64 @@ XMPPContact *contact; OFDictionary *rosterItems; OFEnumerator *rosterItemEnumerator; OFString *bareJID; - contactEnumerator = [contacts objectEnumerator]; + contactEnumerator = [_contacts objectEnumerator]; while ((contact = [contactEnumerator nextObject]) != nil) { - [delegates broadcastSelector: @selector(contactManager: - didRemoveContact:) - withObject: self - withObject: contact]; - } - [contacts release]; - - contacts = [[OFMutableDictionary alloc] init]; + [_delegates broadcastSelector: @selector(contactManager: + didRemoveContact:) + withObject: self + withObject: contact]; + } + [_contacts release]; + + _contacts = [[OFMutableDictionary alloc] init]; rosterItems = [roster_ rosterItems]; rosterItemEnumerator = [rosterItems keyEnumerator]; while ((bareJID = [rosterItemEnumerator nextObject]) != nil) { contact = [[XMPPContact new] autorelease]; [contact XMPP_setRosterItem: [rosterItems objectForKey: bareJID]]; - [contacts setObject: contact - forKey: bareJID]; - [delegates broadcastSelector: @selector(contactManager: - didAddContact:) - withObject: self - withObject: contact]; + [_contacts setObject: contact + forKey: bareJID]; + [_delegates broadcastSelector: @selector(contactManager: + didAddContact:) + withObject: self + withObject: contact]; } } - (void)roster: (XMPPRoster*)roster didReceiveRosterItem: (XMPPRosterItem*)rosterItem { XMPPContact *contact; OFString *bareJID = [[rosterItem JID] bareJID]; - contact = [contacts objectForKey: bareJID]; + contact = [_contacts objectForKey: bareJID]; if ([[rosterItem subscription] isEqual: @"remove"]) { - [contacts removeObjectForKey: bareJID]; + [_contacts removeObjectForKey: bareJID]; if (contact != nil) - [delegates broadcastSelector: @selector(contactManager: + [_delegates broadcastSelector: @selector(contactManager: didRemoveContact:) withObject: self withObject: contact]; return; } if (contact == nil) { contact = [[XMPPContact new] autorelease]; [contact XMPP_setRosterItem: rosterItem]; - [contacts setObject: contact + [_contacts setObject: contact forKey: bareJID]; - [delegates broadcastSelector: @selector(contactManager: + [_delegates broadcastSelector: @selector(contactManager: didAddContact:) withObject: self withObject: contact]; } else { - [delegates broadcastSelector: @selector(contact: + [_delegates broadcastSelector: @selector(contact: willUpdateWithRosterItem:) withObject: contact withObject: rosterItem]; [contact XMPP_setRosterItem: rosterItem]; } @@ -144,43 +144,43 @@ - (void)connection: (XMPPConnection*)connection didReceivePresence: (XMPPPresence*)presence { XMPPJID *JID = [presence from]; - XMPPContact *contact = [contacts objectForKey: [JID bareJID]]; + XMPPContact *contact = [_contacts objectForKey: [JID bareJID]]; if (contact == nil) return; // We only care for available and unavailable here, not subscriptions if ([[presence type] isEqual: @"available"]) { [contact XMPP_setPresence: presence resource: [JID resource]]; - [delegates broadcastSelector: @selector(contact: + [_delegates broadcastSelector: @selector(contact: didSendPresence:) withObject: contact withObject: presence]; } else if ([[presence type] isEqual: @"unavailable"]) { [contact XMPP_removePresenceForResource: [JID resource]]; - [delegates broadcastSelector: @selector(contact: - didSendPresence:) - withObject: contact - withObject: presence]; + [_delegates broadcastSelector: @selector(contact: + didSendPresence:) + withObject: contact + withObject: presence]; } } - (void)connection: (XMPPConnection*)connection didReceiveMessage: (XMPPMessage*)message { XMPPJID *JID = [message from]; - XMPPContact *contact = [contacts objectForKey: [JID bareJID]]; + XMPPContact *contact = [_contacts objectForKey: [JID bareJID]]; if (contact == nil) return; [contact XMPP_setLockedOnJID: JID]; - [delegates broadcastSelector: @selector(contact:didSendMessage:) - withObject: contact - withObject: message]; + [_delegates broadcastSelector: @selector(contact:didSendMessage:) + withObject: contact + withObject: message]; } @end