Changeset 6 for Trunk/AILogSizeSort.m

Show
Ignore:
Timestamp:
09/28/08 22:53:31 (16 years ago)
Author:
jon
Message:

Log sizes are now cached into a reasonable dictionary structure.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Trunk/AILogSizeSort.m

    r5 r6  
    3030- (void)didBecomeActiveFirstTime 
    3131{ 
     32        logSizeCache = [NSMutableDictionary dictionaryWithCapacity:64]; 
     33         
    3234        NSEnumerator *groupEnumerator = [[[[adium contactController] contactList] listContacts] objectEnumerator]; 
    3335         
     
    3638    while(group = [groupEnumerator nextObject]) 
    3739        { 
    38                 AILog(@"%@", group); 
     40                NSEnumerator *contactEnumerator = [[group listContacts] objectEnumerator]; 
    3941                 
    40                 NSEnumerator *contactEnumerator = [[group listContacts] objectEnumerator]; 
     42                NSMutableDictionary *sizes = [NSMutableDictionary dictionaryWithCapacity:64]; 
    4143                 
    4244                while(contact = [contactEnumerator nextObject]) 
    4345                { 
    44                         AILog(@"\t%@: %lld", contact, [AILogSizeSort getContactLogSize:contact]); 
     46                        [sizes setValue:[NSNumber numberWithUnsignedLongLong:[AILogSizeSort getContactLogSize:contact]] forKey:[contact UID]]; 
    4547                } 
     48 
     49                [logSizeCache setValue:sizes forKey:[group UID]]; 
    4650    } 
     51         
     52        AILog(@"Log size cache:"); 
     53        AILog(@"%@", logSizeCache); 
    4754} 
    4855 
     
    114121int logSizeSort(id objectA, id objectB, BOOL groups) 
    115122{ 
    116         // Not real excited about doing this with an implicit definition, but seems to be 
    117         // the only option for now. 
    118         //AILog([objectA formattedUID]); 
    119123        return NSOrderedAscending; 
    120124}