Changeset 229

Show
Ignore:
Timestamp:
05-03-2008 16:54:37 (5 years ago)
Author:
jppavao
Message:

When none of the connected accounts contains a valid user full name in the owner vCard, we now display the JID in the chat window message headers. Fixes #186.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lilypad/Sources/LPChatController.m

    r214 r229  
    88// 
    99//      For more information on licensing, read the README file. 
    10 //      Para mais informações sobre o licenciamento, leia o ficheiro README. 
     10//      Para mais informa›es sobre o licenciamento, leia o ficheiro README. 
    1111// 
    1212 
     
    5555 
    5656@interface LPChatController (Private) 
     57- (void)p_syncChatOwnerName; 
     58- (void)p_syncViewsWithContact; 
    5759 
    5860- (void)p_setChat:(LPChat *)chat; 
     
    231233 
    232234 
     235- (void)p_syncChatOwnerName 
     236{ 
     237         
     238        NSString        *currentOwnerName = [m_chatViewsController ownerName]; 
     239        NSString        *globalName = [[LPAccountsController sharedAccountsController] name]; 
     240        NSString        *newOwnerName = ( [globalName length] > 0 ? 
     241                                                                  globalName : 
     242                                                                  [[[m_chat activeContactEntry] account] JID] ); 
     243         
     244        if (![currentOwnerName isEqualToString:newOwnerName]) 
     245                [m_chatViewsController setOwnerName:newOwnerName]; 
     246} 
     247 
     248 
    233249- (void)p_syncViewsWithContact 
    234250{ 
     
    238254                 
    239255                [m_chatWebView setChat:m_chat]; 
    240                  
    241                 [m_chatViewsController setOwnerName:[[LPAccountsController sharedAccountsController] name]]; 
     256                [self p_syncChatOwnerName]; 
    242257                 
    243258                [m_topControlsBar setBackgroundColor: 
     
    482497        else if ([keyPath isEqualToString:@"name"]) { 
    483498                // [LPAccountsController sharedAccountsController] name 
    484                 [m_chatViewsController setOwnerName:[[LPAccountsController sharedAccountsController] name]]; 
     499                [self p_syncChatOwnerName]; 
    485500        } 
    486501        else if ([keyPath isEqualToString:@"contactEntries"]) { 
     
    14981513- (void)p_appendStandardMessageBlockWithInnerHTML:(NSString *)innerHTML timestamp:(NSDate *)timestamp inbound:(BOOL)isInbound saveInHistory:(BOOL)shouldSave scrollMode:(LPScrollToVisibleMode)scrollMode 
    14991514{ 
    1500         NSString *authorName = (isInbound ? [m_contact name] : [[LPAccountsController sharedAccountsController] name]); 
     1515        NSString *authorName = nil; 
     1516        if (isInbound) { 
     1517                authorName = [m_contact name]; 
     1518        } else { 
     1519                NSString *globalName = [[LPAccountsController sharedAccountsController] name]; 
     1520                authorName = ( [globalName length] > 0 ? 
     1521                                           globalName : 
     1522                                           [[[[self chat] activeContactEntry] account] JID] ); 
     1523        } 
     1524         
    15011525        NSString *htmlString = [m_chatViewsController HTMLStringForStandardBlockWithInnerHTML:innerHTML timestamp:timestamp authorName:authorName]; 
    15021526