Index: /Trunk/AILogSizeSort.m
===================================================================
--- /Trunk/AILogSizeSort.m	(revision 7)
+++ /Trunk/AILogSizeSort.m	(revision 8)
@@ -17,5 +17,4 @@
 
 #import <Adium/AIContactControllerProtocol.h>
-#import <Adium/AIPreferenceControllerProtocol.h>
 #import <Adium/AIListObject.h>
 #import <Adium/AIMetaContact.h>
@@ -68,5 +67,5 @@
  */
 - (NSString *)configureSortWindowTitle{
-	return AILocalizedString(@"Configure Sort by Log Size",nil);	
+	return nil;
 }
 
@@ -75,5 +74,5 @@
  */
 - (NSString *)configureNibName{
-	return @"LogSizeSortConfiguration";
+	return nil;
 }
 
@@ -91,4 +90,61 @@
 - (IBAction)changePreference:(id)sender
 {
+}
+
+/**
+ * Returns the total aggregate log size for a contact.  For meta-contacts, the
+ * total log file size of all sub-contacts is returned.  If no log exists or if
+ * something else goes wrong, 0 is returned.
+ *
+ * @param listObject an AIListContact for which to retrieve a total log file size
+ * @return the total log file size in bytes or 0 if an error occurred
+ */
++(unsigned long long)getContactLogSize:(AIListContact *)listObject
+{
+	NSFileManager *fileManager = [NSFileManager defaultManager];
+	
+	if([listObject isMemberOfClass:[AIMetaContact class]])
+	{
+		// Recurse through all sub-contacts
+		
+		id contact;
+		unsigned long long size = 0;
+		
+		NSEnumerator *contactEnumerator = [[listObject listContacts] objectEnumerator];
+
+		while(contact = [contactEnumerator nextObject])
+		{
+			size += [AILogSizeSort getContactLogSize:contact];
+		}
+		
+		return size;
+	}
+	else
+	{
+		// Find the path to the directory containing the log files for this contact
+		NSString *path = [[AILoggerPlugin logBasePath] stringByAppendingPathComponent:[AILoggerPlugin relativePathForLogWithObject:[listObject UID] onAccount: [listObject account]]];
+		
+		// Grab an enumerator for all log files for this contact
+		NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:path];
+		NSString *file;
+		
+		unsigned long long size = 0;
+		
+		while(file = [dirEnum nextObject])
+		{
+			NSDictionary *fileAttributes = [fileManager fileAttributesAtPath:[path stringByAppendingPathComponent:file] traverseLink:YES];
+			
+			if (fileAttributes != nil)
+			{
+				NSNumber *fileSize;
+				if(fileSize = [fileAttributes objectForKey:NSFileSize])
+				{
+					size += [fileSize unsignedLongLongValue];
+				}
+			}
+		}
+		
+		return size;
+	}
 }
 
@@ -132,50 +188,3 @@
 	return &logSizeSort;
 }
-
-+(unsigned long long)getContactLogSize:(AIListContact *)listObject
-{
-	NSFileManager *fileManager = [NSFileManager defaultManager];
-
-	if([listObject isMemberOfClass:[AIMetaContact class]])
-	{
-		unsigned long long size = 0;
-		
-		NSEnumerator *contactEnumerator = [[listObject listContacts] objectEnumerator];
-		
-		id contact;
-		
-		while(contact = [contactEnumerator nextObject])
-		{
-			size += [AILogSizeSort getContactLogSize:contact];
-		}
-		
-		return size;
-	}
-	else
-	{
-		NSString *path = [[AILoggerPlugin logBasePath] stringByAppendingPathComponent:[AILoggerPlugin relativePathForLogWithObject:[listObject UID] onAccount: [listObject account]]];
-
-		NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:path];
-		NSString *file;
-		
-		unsigned long long size = 0;
-		
-		while(file = [dirEnum nextObject])
-		{
-			NSDictionary *fileAttributes = [fileManager fileAttributesAtPath:[path stringByAppendingPathComponent:file] traverseLink:YES];
-
-			if (fileAttributes != nil)
-			{
-				NSNumber *fileSize;
-				if(fileSize = [fileAttributes objectForKey:NSFileSize])
-				{
-					size += [fileSize unsignedLongLongValue];
-				}
-			}
-		}
-		
-		return size;
-	}
-}
-
 @end
Index: /Trunk/SortByLogSizePlugin.xcodeproj/jon.mode1v3
===================================================================
--- /Trunk/SortByLogSizePlugin.xcodeproj/jon.mode1v3	(revision 7)
+++ /Trunk/SortByLogSizePlugin.xcodeproj/jon.mode1v3	(revision 8)
@@ -337,5 +337,5 @@
 										<integer>0</integer>
 										<key>bookmark</key>
-										<string>FC1986940E9085C50021C71E</string>
+										<string>FC1986990E9088A00021C71E</string>
 										<key>history</key>
 										<array>
Index: /Trunk/SortByLogSizePlugin.xcodeproj/jon.pbxuser
===================================================================
--- /Trunk/SortByLogSizePlugin.xcodeproj/jon.pbxuser	(revision 7)
+++ /Trunk/SortByLogSizePlugin.xcodeproj/jon.pbxuser	(revision 8)
@@ -272,4 +272,6 @@
 			FC1986920E9085690021C71E /* PBXTextBookmark */ = FC1986920E9085690021C71E /* PBXTextBookmark */;
 			FC1986940E9085C50021C71E /* PBXTextBookmark */ = FC1986940E9085C50021C71E /* PBXTextBookmark */;
+			FC1986970E90879B0021C71E /* PBXTextBookmark */ = FC1986970E90879B0021C71E /* PBXTextBookmark */;
+			FC1986990E9088A00021C71E /* PBXTextBookmark */ = FC1986990E9088A00021C71E /* PBXTextBookmark */;
 			FCB319800E8FF8EB00D88232 = FCB319800E8FF8EB00D88232 /* PBXTextBookmark */;
 			FCB319830E8FF8EB00D88232 = FCB319830E8FF8EB00D88232 /* PBXTextBookmark */;
@@ -309,7 +311,7 @@
 	FC19835F0E900AF10021C71E /* AILogSizeSort.m */ = {
 		uiCtxt = {
-			sepNavIntBoundsRect = "{{0, 0}, {670, 2590}}";
-			sepNavSelRange = "{2597, 0}";
-			sepNavVisRange = "{2191, 689}";
+			sepNavIntBoundsRect = "{{0, 0}, {1104, 2728}}";
+			sepNavSelRange = "{2662, 0}";
+			sepNavVisRange = "{3568, 669}";
 			sepNavWindowFrame = "{{88, 252}, {750, 558}}";
 		};
@@ -408,5 +410,5 @@
 		name = "AILogSizeSort.m: 100";
 		rLen = 0;
-		rLoc = 3865;
+		rLoc = 4287;
 		rType = 0;
 		vrLen = 444;
@@ -721,5 +723,5 @@
 		name = "AILogSizeSort.m: 46";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 889;
@@ -741,5 +743,5 @@
 		name = "AILogSizeSort.m: 32";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 756;
@@ -761,5 +763,5 @@
 		name = "AILogSizeSort.m: 46";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 874;
@@ -791,5 +793,5 @@
 		name = "AILogSizeSort.m: 46";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 889;
@@ -811,5 +813,5 @@
 		fRef = FC19835F0E900AF10021C71E /* AILogSizeSort.m */;
 		rLen = 1;
-		rLoc = 180;
+		rLoc = 189;
 		rType = 1;
 	};
@@ -819,5 +821,5 @@
 		name = "AILogSizeSort.m: 147";
 		rLen = 5;
-		rLoc = 3865;
+		rLoc = 4287;
 		rType = 0;
 		vrLen = 208;
@@ -849,5 +851,5 @@
 		name = "AILogSizeSort.m: 147";
 		rLen = 0;
-		rLoc = 2690;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 578;
@@ -879,5 +881,5 @@
 		name = "AILogSizeSort.m: 59";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 789;
@@ -899,5 +901,5 @@
 		name = "AILogSizeSort.m: 147";
 		rLen = 0;
-		rLoc = 2690;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 549;
@@ -919,5 +921,5 @@
 		name = "AILogSizeSort.m: 147";
 		rLen = 0;
-		rLoc = 3863;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 501;
@@ -929,5 +931,5 @@
 		name = "AILogSizeSort.m: 147";
 		rLen = 0;
-		rLoc = 3863;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 501;
@@ -949,5 +951,5 @@
 		name = "AILogSizeSort.m: 147";
 		rLen = 0;
-		rLoc = 3863;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 501;
@@ -969,5 +971,5 @@
 		name = "AILogSizeSort.m: 149";
 		rLen = 5;
-		rLoc = 3865;
+		rLoc = 4287;
 		rType = 0;
 		vrLen = 223;
@@ -987,5 +989,5 @@
 		name = "AILogSizeSort.m: 149";
 		rLen = 5;
-		rLoc = 3865;
+		rLoc = 4287;
 		rType = 0;
 		vrLen = 223;
@@ -1173,5 +1175,5 @@
 		fRef = FC19835F0E900AF10021C71E /* AILogSizeSort.m */;
 		rLen = 1;
-		rLoc = 180;
+		rLoc = 189;
 		rType = 1;
 	};
@@ -1201,5 +1203,5 @@
 		name = "AILogSizeSort.m: 149";
 		rLen = 5;
-		rLoc = 3865;
+		rLoc = 4287;
 		rType = 0;
 		vrLen = 80;
@@ -1281,5 +1283,5 @@
 		name = "AILogSizeSort.m: 44";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 629;
@@ -1301,5 +1303,5 @@
 		name = "AILogSizeSort.m: 46";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 628;
@@ -1341,5 +1343,5 @@
 		name = "AILogSizeSort.m: 130";
 		rLen = 0;
-		rLoc = 2742;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 845;
@@ -1351,5 +1353,5 @@
 		name = "AILogSizeSort.m: 135";
 		rLen = 0;
-		rLoc = 2877;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 626;
@@ -1381,5 +1383,5 @@
 		name = "AILogSizeSort.m: 130";
 		rLen = 0;
-		rLoc = 2742;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 702;
@@ -1401,5 +1403,5 @@
 		name = "AILogSizeSort.m: 130";
 		rLen = 0;
-		rLoc = 2742;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 750;
@@ -1421,5 +1423,5 @@
 		name = "AILogSizeSort.m: 159";
 		rLen = 0;
-		rLoc = 3837;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 742;
@@ -1441,5 +1443,5 @@
 		name = "AILogSizeSort.m: 144";
 		rLen = 0;
-		rLoc = 3336;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 809;
@@ -1461,5 +1463,5 @@
 		name = "AILogSizeSort.m: 142";
 		rLen = 0;
-		rLoc = 3335;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 813;
@@ -1481,5 +1483,5 @@
 		name = "AILogSizeSort.m: 142";
 		rLen = 0;
-		rLoc = 3335;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 618;
@@ -1501,5 +1503,5 @@
 		name = "AILogSizeSort.m: 142";
 		rLen = 0;
-		rLoc = 3335;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 628;
@@ -1521,5 +1523,5 @@
 		name = "AILogSizeSort.m: 141";
 		rLen = 0;
-		rLoc = 3237;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 635;
@@ -1541,5 +1543,5 @@
 		fRef = FC19835F0E900AF10021C71E /* AILogSizeSort.m */;
 		rLen = 0;
-		rLoc = 174;
+		rLoc = 188;
 		rType = 1;
 	};
@@ -1549,5 +1551,5 @@
 		name = "AILogSizeSort.m: 152";
 		rLen = 0;
-		rLoc = 3837;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 239;
@@ -1569,5 +1571,5 @@
 		name = "AILogSizeSort.m: 130";
 		rLen = 0;
-		rLoc = 2709;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 817;
@@ -1589,5 +1591,5 @@
 		name = "AILogSizeSort.m: 151";
 		rLen = 0;
-		rLoc = 3837;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 804;
@@ -1619,5 +1621,5 @@
 		name = "AILogSizeSort.m: 130";
 		rLen = 0;
-		rLoc = 2709;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 812;
@@ -1629,5 +1631,5 @@
 		name = "AILogSizeSort.m: 130";
 		rLen = 0;
-		rLoc = 2709;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 812;
@@ -1649,5 +1651,5 @@
 		name = "AILogSizeSort.m: 151";
 		rLen = 0;
-		rLoc = 3837;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 831;
@@ -1669,5 +1671,5 @@
 		name = "AILogSizeSort.m: 44";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 789;
@@ -1689,5 +1691,5 @@
 		name = "AILogSizeSort.m: 145";
 		rLen = 0;
-		rLoc = 3522;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 704;
@@ -1709,5 +1711,5 @@
 		name = "AILogSizeSort.m: 142";
 		rLen = 0;
-		rLoc = 3335;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 764;
@@ -1729,5 +1731,5 @@
 		name = "AILogSizeSort.m: 159";
 		rLen = 0;
-		rLoc = 3826;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 885;
@@ -1749,5 +1751,5 @@
 		name = "AILogSizeSort.m: 158";
 		rLen = 0;
-		rLoc = 3826;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 913;
@@ -1799,5 +1801,5 @@
 		name = "AILogSizeSort.m: 138";
 		rLen = 0;
-		rLoc = 2975;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 1038;
@@ -1809,5 +1811,5 @@
 		name = "AILogSizeSort.m: 138";
 		rLen = 0;
-		rLoc = 2975;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 1038;
@@ -1849,5 +1851,5 @@
 		name = "AILogSizeSort.m: 144";
 		rLen = 0;
-		rLoc = 3070;
+		rLoc = 4286;
 		rType = 0;
 		vrLen = 734;
@@ -1869,5 +1871,5 @@
 		name = "AILogSizeSort.m: 119";
 		rLen = 0;
-		rLoc = 2568;
+		rLoc = 4167;
 		rType = 0;
 		vrLen = 661;
@@ -1889,5 +1891,5 @@
 		name = "AILogSizeSort.m: 116";
 		rLen = 0;
-		rLoc = 2568;
+		rLoc = 4167;
 		rType = 0;
 		vrLen = 556;
@@ -1919,5 +1921,5 @@
 		name = "AILogSizeSort.m: 116";
 		rLen = 0;
-		rLoc = 2568;
+		rLoc = 4167;
 		rType = 0;
 		vrLen = 556;
@@ -1929,5 +1931,5 @@
 		name = "AILogSizeSort.m: 116";
 		rLen = 0;
-		rLoc = 2568;
+		rLoc = 4167;
 		rType = 0;
 		vrLen = 556;
@@ -1949,5 +1951,5 @@
 		name = "AILogSizeSort.m: 32";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 753;
@@ -1969,5 +1971,5 @@
 		name = "AILogSizeSort.m: 46";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 828;
@@ -1989,5 +1991,5 @@
 		name = "AILogSizeSort.m: 48";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 876;
@@ -2009,5 +2011,5 @@
 		name = "AILogSizeSort.m: 53";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 758;
@@ -2029,5 +2031,5 @@
 		name = "AILogSizeSort.m: 56";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 854;
@@ -2049,5 +2051,5 @@
 		name = "AILogSizeSort.m: 52";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 812;
@@ -2069,5 +2071,5 @@
 		name = "AILogSizeSort.m: 40";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 814;
@@ -2157,5 +2159,5 @@
 		name = "AILogSizeSort.m: 136";
 		rLen = 0;
-		rLoc = 2567;
+		rLoc = 4166;
 		rType = 0;
 		vrLen = 553;
@@ -2167,5 +2169,5 @@
 		name = "AILogSizeSort.m: 135";
 		rLen = 0;
-		rLoc = 2567;
+		rLoc = 4166;
 		rType = 0;
 		vrLen = 552;
@@ -2235,5 +2237,5 @@
 		name = "AILogSizeSort.m: 136";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 495;
@@ -2255,5 +2257,5 @@
 		name = "AILogSizeSort.m: 136";
 		rLen = 0;
-		rLoc = 2567;
+		rLoc = 4166;
 		rType = 0;
 		vrLen = 553;
@@ -2275,5 +2277,5 @@
 		name = "AILogSizeSort.m: 139";
 		rLen = 0;
-		rLoc = 2440;
+		rLoc = 4039;
 		rType = 0;
 		vrLen = 623;
@@ -2285,5 +2287,5 @@
 		name = "AILogSizeSort.m: 142";
 		rLen = 0;
-		rLoc = 2568;
+		rLoc = 4167;
 		rType = 0;
 		vrLen = 763;
@@ -2295,5 +2297,5 @@
 		name = "AILogSizeSort.m: 138";
 		rLen = 0;
-		rLoc = 737;
+		rLoc = 688;
 		rType = 0;
 		vrLen = 718;
@@ -2305,5 +2307,5 @@
 		name = "AILogSizeSort.m: 140";
 		rLen = 0;
-		rLoc = 2440;
+		rLoc = 4039;
 		rType = 0;
 		vrLen = 811;
@@ -2315,5 +2317,5 @@
 		name = "AILogSizeSort.m: 30";
 		rLen = 0;
-		rLoc = 734;
+		rLoc = 685;
 		rType = 0;
 		vrLen = 852;
@@ -2325,5 +2327,5 @@
 		name = "AILogSizeSort.m: 148";
 		rLen = 0;
-		rLoc = 2663;
+		rLoc = 4262;
 		rType = 0;
 		vrLen = 768;
@@ -2345,5 +2347,5 @@
 		name = "AILogSizeSort.m: 148";
 		rLen = 0;
-		rLoc = 2663;
+		rLoc = 4262;
 		rType = 0;
 		vrLen = 583;
@@ -2355,5 +2357,5 @@
 		name = "AILogSizeSort.m: 148";
 		rLen = 0;
-		rLoc = 2663;
+		rLoc = 4262;
 		rType = 0;
 		vrLen = 586;
@@ -2375,5 +2377,5 @@
 		name = "AILogSizeSort.m: 31";
 		rLen = 0;
-		rLoc = 735;
+		rLoc = 686;
 		rType = 0;
 		vrLen = 698;
@@ -2385,5 +2387,5 @@
 		name = "AILogSizeSort.m: 120";
 		rLen = 0;
-		rLoc = 2555;
+		rLoc = 4154;
 		rType = 0;
 		vrLen = 586;
@@ -2395,8 +2397,28 @@
 		name = "AILogSizeSort.m: 124";
 		rLen = 0;
-		rLoc = 2597;
+		rLoc = 4196;
 		rType = 0;
 		vrLen = 689;
 		vrLoc = 2191;
+	};
+	FC1986970E90879B0021C71E /* PBXTextBookmark */ = {
+		isa = PBXTextBookmark;
+		fRef = FC19835F0E900AF10021C71E /* AILogSizeSort.m */;
+		name = "AILogSizeSort.m: 76";
+		rLen = 0;
+		rLoc = 1570;
+		rType = 0;
+		vrLen = 625;
+		vrLoc = 1050;
+	};
+	FC1986990E9088A00021C71E /* PBXTextBookmark */ = {
+		isa = PBXTextBookmark;
+		fRef = FC19835F0E900AF10021C71E /* AILogSizeSort.m */;
+		name = "AILogSizeSort.m: 124";
+		rLen = 0;
+		rLoc = 2662;
+		rType = 0;
+		vrLen = 669;
+		vrLoc = 3568;
 	};
 	FC880A0B0E8FF7640064FEBE /* Source Control */ = {
