Adium

Ticket #3548: zephyr-class.diff

File zephyr-class.diff, 1.3 kB (added by rwbarton, 8 months ago)

Better formatting of sender in zephyr classes

  • a/Plugins/Purple

    old new  
    5959        return NO; 
    6060} 
    6161 
     62// Parse sourceUIDs of the form "username instance", produced by libpurple in group chats (classes) 
     63// It seems this function never gets called for a non-group chat, but we check for a space to be safe 
     64- (AIListContact *)contactWithUID:(NSString *)sourceUID 
     65{ 
     66        NSRange firstSpace = [sourceUID rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@" "]]; 
     67        if (firstSpace.location == NSNotFound) 
     68                return [super contactWithUID:sourceUID];        // it's a non-group sourceUID 
     69         
     70        NSString *username = [sourceUID substringToIndex:firstSpace.location]; 
     71        AIListContact *contact = [super contactWithUID:username]; 
     72        NSString *contactWithInstance = [NSString stringWithFormat:@"%@ / %@", 
     73                                                                                                [contact displayName], 
     74                                                                                                [[sourceUID substringFromIndex:(firstSpace.location+1)] lowercaseString]]; 
     75        return [[adium contactController] contactWithService:service account:self UID:contactWithInstance]; 
     76} 
     77 
    6278/*! 
    6379 * @brief Return the purple status ID to be used for a status 
    6480 *