| | 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; |
|---|