Changeset 15 for Trunk

Show
Ignore:
Timestamp:
09/29/08 23:42:07 (16 years ago)
Author:
jon
Message:

Simplified the comparison routine to just use primitive numbers instead of NSNumbers. Changed the description string to use more Adium-y terminology.

Location:
Trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • Trunk/ABSortByLogSizePlugin.m

    r11 r15  
    4141- (NSString *)pluginDescription 
    4242{ 
    43         return @"Allows the contact list to be sorted by transcript file size."; 
     43        return @"Allows the Adium contact list to be sorted by chat transcript file size."; 
    4444} 
    4545 
  • Trunk/AILogSizeSort.m

    r11 r15  
    175175        } 
    176176         
     177        unsigned long long sizeA = [AILogSizeSort getContactLogSize:objectA]; 
     178        unsigned long long sizeB = [AILogSizeSort getContactLogSize:objectB]; 
    177179         
    178         NSNumber *sizeA = [NSNumber numberWithUnsignedLongLong:[AILogSizeSort getContactLogSize:objectA]]; 
    179         NSNumber *sizeB = [NSNumber numberWithUnsignedLongLong:[AILogSizeSort getContactLogSize:objectB]]; 
    180          
    181         if([sizeB compare:sizeA] == NSOrderedSame) 
     180        if(sizeB == sizeA) 
    182181        { 
    183182                // Fall back to basic alphabetical sorting in the event of a tie. 
    184183                return [[objectA displayName] caseInsensitiveCompare:[objectB displayName]]; 
    185184        } 
     185        else if(sizeA > sizeB) 
     186        { 
     187                // There's a clear winner; run with it. 
     188                return NSOrderedAscending; 
     189        } 
    186190        else 
    187191        { 
    188                 // There's a clear winner; run with it. 
    189                 return [sizeB compare:sizeA]; 
     192                return NSOrderedDescending; 
    190193        } 
    191194}