Adium

Changeset 23540

Show
Ignore:
Timestamp:
05/21/2008 08:15:44 PM (6 months ago)
Author:
evands
Message:

Special case handling of services for 'to' groups and AIChatLogs to know about jabber/gtalk/livejournal and aim/icq/.mac. This isn't perfect (and the code remains really complicated), but it achieves the desired result. Fixes #9725

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/AIAbstractLogViewerWindowController.h

    r23076 r23540  
    191191 
    192192@end 
     193 
     194NSString *handleSpecialCasesForUIDAndServiceClass(NSString *contactUID, NSString *serviceClass); 
  • trunk/Source/AIAbstractLogViewerWindowController.m

    r23500 r23540  
    312312                NSEnumerator    *toEnum; 
    313313                AILogToGroup    *currentToGroup; 
    314                 NSString                *serviceClass = [logFromGroup serviceClass]; 
    315314 
    316315                //Add the 'to' for each grouping on this account 
     
    320319                         
    321320                        if ((currentTo = [currentToGroup to])) { 
     321                                NSString *serviceClass = [currentToGroup serviceClass]; 
    322322                                AIListObject *listObject = ((serviceClass && currentTo) ? 
    323323                                                                                        [[adium contactController] existingListObjectWithUniqueID:[AIListObject internalObjectIDForServiceID:serviceClass 
     
    27192719} 
    27202720 
     2721#pragma Transcript services special-casing 
     2722NSString *handleSpecialCasesForUIDAndServiceClass(NSString *contactUID, NSString *serviceClass) 
     2723{ 
     2724        /* Jabber and its specified derivative services need special handling; 
     2725         * this is cross-contamination from ESPurpleJabberAccount. 
     2726         */ 
     2727        if ([serviceClass isEqualToString:@"Jabber"] || 
     2728                [serviceClass isEqualToString:@"GTalk"] || 
     2729                [serviceClass isEqualToString:@"LiveJournal"]) { 
     2730                 
     2731                if ([contactUID hasSuffix:@"@gmail.com"] || 
     2732                        [contactUID hasSuffix:@"@googlemail.com"]) { 
     2733                        serviceClass = @"GTalk"; 
     2734                         
     2735                } else if ([contactUID hasSuffix:@"@livejournal.com"]){ 
     2736                        serviceClass = @"LiveJournal"; 
     2737                         
     2738                } else { 
     2739                        serviceClass = @"Jabber"; 
     2740                }        
     2741                 
     2742                /* OSCAR and its specified derivative services need special handling; 
     2743                 *  this is cross-contamination from CBPurpleOscarAccount. 
     2744                 */ 
     2745        } else if ([serviceClass isEqualToString:@"AIM"] || 
     2746                           [serviceClass isEqualToString:@"ICQ"] || 
     2747                           [serviceClass isEqualToString:@"Mac"]) { 
     2748                const char      firstCharacter = ([contactUID length] ? [contactUID characterAtIndex:0] : '\0'); 
     2749                 
     2750                //Determine service based on UID 
     2751                if ([contactUID hasSuffix:@"@mac.com"]) { 
     2752                        serviceClass = @"Mac"; 
     2753                } else if (firstCharacter && (firstCharacter >= '0' && firstCharacter <= '9')) { 
     2754                        serviceClass = @"ICQ"; 
     2755                } else { 
     2756                        serviceClass = @"AIM"; 
     2757                } 
     2758        } 
     2759         
     2760        return serviceClass; 
     2761} 
     2762 
    27212763@end 
  • trunk/Source/AIChatLog.m

    r19643 r23540  
    5050         
    5151        if ([serviceAndFromUIDArray count] >= 2) { 
    52                 myServiceClass = [serviceAndFromUIDArray objectAtIndex:0]
     52                myServiceClass = handleSpecialCasesForUIDAndServiceClass(toUID, [serviceAndFromUIDArray objectAtIndex:0])
    5353                 
    5454                //Use substringFromIndex so we include the rest of the string in the case of a UID with a . in it 
  • trunk/Source/AILoggerPlugin.m

    r23504 r23540  
    13921392 
    13931393@end 
    1394  
    1395  
  • trunk/Source/AILogToGroup.m

    r23500 r23540  
    1818#import "AILogToGroup.h" 
    1919#import "AIChatLog.h" 
     20#import "AIAbstractLogViewerWindowController.h" 
    2021#import <AIUtilities/AIFileManagerAdditions.h> 
    2122 
     
    3536                from = [inFrom retain]; 
    3637                to = [inTo retain]; 
    37                 serviceClass = [inServiceClass retain]; 
     38                serviceClass = [handleSpecialCasesForUIDAndServiceClass(to, inServiceClass) retain]; 
    3839                logDict = nil; 
    3940                partialLogDict = nil;