adium 5844:aed198ae15cb: Fix the missing dates in the chat log v...

commits at adium.im commits at adium.im
Fri Feb 21 12:16:12 UTC 2014


details:	http://hg.adium.im/adium/rev/aed198ae15cb
revision:	5844:aed198ae15cb
branch:		adium-1.5.10
author:		Thijs Alkemade <me at thijsalkema.de>
date:		Fri Feb 21 13:15:39 2014 +0100

Fix the missing dates in the chat log viewer for old AdiumHTMLLogs.

diffs (37 lines):

diff -r 9b4717820ead -r aed198ae15cb Other/Adium Spotlight Importer/GetMetadataForHTMLLog.m
--- a/Other/Adium Spotlight Importer/GetMetadataForHTMLLog.m	Fri Feb 21 12:39:21 2014 +0100
+++ b/Other/Adium Spotlight Importer/GetMetadataForHTMLLog.m	Fri Feb 21 13:15:39 2014 +0100
@@ -30,12 +30,12 @@
 	formatter.timeSeparator = '.';
 	NSRange openParenRange, closeParenRange;
 	
-	if ([pathToFile hasSuffix:@".chatlog"] && (openParenRange = [pathToFile rangeOfString:@"(" options:NSBackwardsSearch]).location != NSNotFound) {
+	if ((openParenRange = [pathToFile rangeOfString:@"(" options:NSBackwardsSearch]).location != NSNotFound) {
 		openParenRange = NSMakeRange(openParenRange.location, [pathToFile length] - openParenRange.location);
 		if ((closeParenRange = [pathToFile rangeOfString:@")" options:0 range:openParenRange]).location != NSNotFound) {
 			//Add and subtract one to remove the parenthesis
 			NSString *dateString = [pathToFile substringWithRange:NSMakeRange(openParenRange.location + 1, (closeParenRange.location - openParenRange.location))];
-			return [formatter dateFromString:dateString];
+			return [formatter dateFromString:[dateString stringByReplacingOccurrencesOfString:@"|" withString:@"-"]];
 		}
 	}
 	return nil;
diff -r 9b4717820ead -r aed198ae15cb Source/AIChatLog.m
--- a/Source/AIChatLog.m	Fri Feb 21 12:39:21 2014 +0100
+++ b/Source/AIChatLog.m	Fri Feb 21 13:15:39 2014 +0100
@@ -308,12 +308,13 @@
 	formatter.timeSeparator = '.';
 	NSRange openParenRange, closeParenRange;
 	
-	if ([fileName hasSuffix:@".chatlog"] && (openParenRange = [fileName rangeOfString:@"(" options:NSBackwardsSearch]).location != NSNotFound) {
+	if ((openParenRange = [fileName rangeOfString:@"(" options:NSBackwardsSearch]).location != NSNotFound) {
 		openParenRange = NSMakeRange(openParenRange.location, [fileName length] - openParenRange.location);
 		if ((closeParenRange = [fileName rangeOfString:@")" options:0 range:openParenRange]).location != NSNotFound) {
 			//Add and subtract one to remove the parenthesis
 			NSString *dateString = [fileName substringWithRange:NSMakeRange(openParenRange.location + 1, (closeParenRange.location - openParenRange.location))];
-			return [formatter dateFromString:dateString];
+			// Fix really old chatlogs which use "(2005|05|07)".
+			return [formatter dateFromString:[dateString stringByReplacingOccurrencesOfString:@"|" withString:@"-"]];
 		}
 	}
 	return nil;




More information about the commits mailing list