Adium

Changeset 24439

Show
Ignore:
Timestamp:
07/20/2008 11:15:41 AM (6 months ago)
Author:
evands
Message:

Improved display of Zephyr contacts in group chats. Patch from rwbarton, thanks. Fixes #3548

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Plugins/Purple Service/ESPurpleZephyrAccount.m

    r21876 r24439  
    5252{ 
    5353        return NO; 
     54} 
     55 
     56// Improve the formatting of displayed names in zephyr group chats (classes). 
     57- (AIListContact *)contactWithUID:(NSString *)sourceUID 
     58{ 
     59        AIListContact *contact = [super contactWithUID:sourceUID]; 
     60 
     61        NSRange firstSpace = [sourceUID rangeOfString:@" "]; 
     62        if (firstSpace.location != NSNotFound) { 
     63                // sourceUID is of the form "username instance". 
     64                // Set the displayName of contact to "realname / instance", 
     65                // where realname is the displayName of the contact with UID "username". 
     66                // Also convert the instance to all lowercase, like owl does. 
     67                NSString *username = [sourceUID substringToIndex:firstSpace.location]; 
     68                NSString *realname = [[[adium contactController] contactWithService:service account:self UID:username] displayName]; 
     69                NSString *instance = [[sourceUID substringFromIndex:(firstSpace.location+1)] lowercaseString]; 
     70                NSString *display = [NSString stringWithFormat:@"%@ / %@", realname, instance]; 
     71                [contact setDisplayName:display]; 
     72        } 
     73         
     74        return contact; 
    5475} 
    5576