Changes in Trunk/AILogSizeSort.m [19:28]
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
Trunk/AILogSizeSort.m
r19 r28 20 20 */ 21 21 22 #import "AILogSizeSort.h" 23 #import "AILoggerPlugin.h" 24 22 #import <Adium/AIPlugin.h> 25 23 #import <Adium/AISharedAdium.h> 26 24 27 #import <AIUtilities/AITigerCompatibility.h>28 25 #import <AIUtilities/AIStringUtilities.h> 29 26 … … 38 35 #import <Adium/AIContentMessage.h> 39 36 37 #import "AILogSizeSort.h" 38 #import "AILoggerPlugin.h" 39 40 40 @implementation AILogSizeSort 41 41 … … 52 52 53 53 // Listen for content addition notifications 54 [[ adium notificationCenter] addObserver:self55 56 57 object:nil];54 [[NSNotificationCenter defaultCenter] addObserver:self 55 selector:@selector(contentObjectAdded:) 56 name:Content_ContentObjectAdded 57 object:nil]; 58 58 } 59 59 … … 160 160 id contact; 161 161 162 NSEnumerator *contactEnumerator = [[(AIMetaContact *)listContact listContacts] objectEnumerator];162 NSEnumerator *contactEnumerator = [[(AIMetaContact *)listContact uniqueContainedObjects] objectEnumerator]; 163 163 164 164 while(contact = [contactEnumerator nextObject]) … … 229 229 unsigned long long size = 0; 230 230 231 NSEnumerator *contactEnumerator = [[(AIMetaContact *)listContact listContacts] objectEnumerator];231 NSEnumerator *contactEnumerator = [[(AIMetaContact *)listContact uniqueContainedObjects] objectEnumerator]; 232 232 233 233 while(contact = [contactEnumerator nextObject]) … … 272 272 * @brief Sort by log size 273 273 */ 274 int logSizeSort(id objectA, id objectB, BOOL groups) 275 { 276 if(groups) 274 NSComparisonResult logSizeSort(id objectA, id objectB, BOOL groups, id<AIContainingObject> container) 275 { 276 // Borrowed from AISortController.m 277 BOOL objectAIsGroup = [objectA isKindOfClass:[AIListGroup class]]; 278 BOOL objectBIsGroup = [objectB isKindOfClass:[AIListGroup class]]; 279 280 if(groups || (objectAIsGroup && objectBIsGroup)) 277 281 { 278 282 // Keep groups in manual order (borrowed from ESStatusSort) 279 if ([ objectA orderIndex] > [objectB orderIndex])283 if ([container orderIndexForObject:objectA] > [container orderIndexForObject:objectB]) 280 284 { 281 285 return NSOrderedDescending; … … 285 289 return NSOrderedAscending; 286 290 } 291 } 292 293 // Catch cases where only one of the objects is a group 294 if(objectAIsGroup && !objectBIsGroup) 295 { 296 return NSOrderedAscending; 297 } 298 else if(!objectAIsGroup && objectBIsGroup) 299 { 300 return NSOrderedDescending; 287 301 } 288 302 289 303 // Get a reference to one and only AILogSizeSort instance. If this sorting method is being 290 304 // called, it should always be the case that AILogSizeSort is the active sort controller. 291 AISortController *sortController = [ [adium contactController]activeSortController];305 AISortController *sortController = [AISortController activeSortController]; 292 306 293 307 unsigned long long sizeA = 0;