Changeset 194

Show
Ignore:
Timestamp:
28-01-2008 11:39:39 (5 years ago)
Author:
jppavao
Message:

Fixed the color of our own messages on a group-chat. They're now always displayed using a distinctive color. Fixes #156.

Location:
trunk/lilypad/Sources
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/lilypad/Sources/LPAccount.h

    r152 r194  
    2424 
    2525 
    26 @class LPRoster, LPChat, LPGroupChat, LPContact, LPContactEntry, LPFileTransfer; 
     26@class LPRoster; 
    2727@class LPServerItemsInfo, LPSapoAgents; 
    2828@class LPPubManager; 
  • trunk/lilypad/Sources/LPGroupChat.m

    r147 r194  
    257257        LPGroupChatContact *contact = [m_participantsByNickname objectForKey:oldNickname]; 
    258258         
     259        [contact retain]; 
    259260        [m_participantsByNickname removeObjectForKey:oldNickname]; 
    260261        [contact handleChangedNickname:newNickname]; 
    261262        [m_participantsByNickname setObject:contact forKey:newNickname]; 
     263        [contact release]; 
    262264} 
    263265 
  • trunk/lilypad/Sources/LPGroupChatController.m

    r189 r194  
    3333 
    3434// KVO Contexts 
     35static NSString *LPGroupChatContext                                     = @"GroupChatContext"; 
    3536static NSString *LPGroupChatParticipantsContext         = @"ParticipantsContext"; 
    3637static NSString *LPParticipantsAttribsContext           = @"PartAttributesContext"; 
     
    9091                NSUserDefaultsController *prefsCtrl = [NSUserDefaultsController sharedUserDefaultsController]; 
    9192                 
    92                 [m_groupChat addObserver:self forKeyPath:@"active" options:0 context:NULL]; 
    93                 [m_groupChat addObserver:self forKeyPath:@"nickname" options:0 context:NULL]; 
    94                 [m_groupChat addObserver:self forKeyPath:@"myGroupChatContact.affiliation" options:0 context:NULL]; 
     93                [m_groupChat addObserver:self forKeyPath:@"active" options:0 context:LPGroupChatContext]; 
     94                [m_groupChat addObserver:self forKeyPath:@"nickname" options:0 context:LPGroupChatContext]; 
     95                [m_groupChat addObserver:self forKeyPath:@"myGroupChatContact" options:0 context:LPGroupChatContext]; 
     96                [m_groupChat addObserver:self forKeyPath:@"myGroupChatContact.affiliation" options:0 context:LPGroupChatContext]; 
    9597                [prefsCtrl addObserver:self forKeyPath:@"values.DisplayEmoticonImages" options:0 context:NULL]; 
    9698                 
     
    114116        [prefsCtrl removeObserver:self forKeyPath:@"values.DisplayEmoticonImages"]; 
    115117        [m_groupChat removeObserver:self forKeyPath:@"myGroupChatContact.affiliation"]; 
     118        [m_groupChat removeObserver:self forKeyPath:@"myGroupChatContact"]; 
    116119        [m_groupChat removeObserver:self forKeyPath:@"nickname"]; 
    117120        [m_groupChat removeObserver:self forKeyPath:@"active"]; 
     
    210213- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context 
    211214{ 
    212         if ([keyPath isEqualToString:@"active"] || [keyPath isEqualToString:@"myGroupChatContact.affiliation"]) { 
    213                 // Update menus and the toolbar as action validation results may have changed 
    214                 [NSApp setWindowsNeedUpdate:YES]; 
    215         } 
    216         else if ([keyPath isEqualToString:@"nickname"]) { 
    217                 // Our nickname in the group chat has just changed 
    218                 [m_chatViewsController setOwnerName:[[m_groupChat myGroupChatContact] userPresentableNickname]]; 
     215        if (context == LPGroupChatContext) { 
     216                if ([keyPath isEqualToString:@"active"] || [keyPath isEqualToString:@"myGroupChatContact.affiliation"]) { 
     217                        // Update menus and the toolbar as action validation results may have changed 
     218                        [NSApp setWindowsNeedUpdate:YES]; 
     219                } 
     220                else if ([keyPath isEqualToString:@"myGroupChatContact"] || [keyPath isEqualToString:@"nickname"]) { 
     221                        // Our nickname in the group chat has just changed 
     222                        LPGroupChatContact *myGroupChatContact = [m_groupChat myGroupChatContact]; 
     223                        if (myGroupChatContact != nil) { 
     224                                [m_chatViewsController setOwnerName:[myGroupChatContact userPresentableNickname]]; 
     225                        } 
     226                } 
    219227        } 
    220228        else if (context == LPGroupChatParticipantsContext) {