Other/Adium Spotlight Importer/GetMetadataForHTMLLog.m
branchadium-1.5.10
changeset 5844 aed198ae15cb
parent 5750 dad5f3048dc3
child 5889 a36d15e8612a
equal deleted inserted replaced
5843:9b4717820ead 5844:aed198ae15cb
    28 {
    28 {
    29 	ISO8601DateFormatter *formatter = [[[ISO8601DateFormatter alloc] init] autorelease];
    29 	ISO8601DateFormatter *formatter = [[[ISO8601DateFormatter alloc] init] autorelease];
    30 	formatter.timeSeparator = '.';
    30 	formatter.timeSeparator = '.';
    31 	NSRange openParenRange, closeParenRange;
    31 	NSRange openParenRange, closeParenRange;
    32 	
    32 	
    33 	if ([pathToFile hasSuffix:@".chatlog"] && (openParenRange = [pathToFile rangeOfString:@"(" options:NSBackwardsSearch]).location != NSNotFound) {
    33 	if ((openParenRange = [pathToFile rangeOfString:@"(" options:NSBackwardsSearch]).location != NSNotFound) {
    34 		openParenRange = NSMakeRange(openParenRange.location, [pathToFile length] - openParenRange.location);
    34 		openParenRange = NSMakeRange(openParenRange.location, [pathToFile length] - openParenRange.location);
    35 		if ((closeParenRange = [pathToFile rangeOfString:@")" options:0 range:openParenRange]).location != NSNotFound) {
    35 		if ((closeParenRange = [pathToFile rangeOfString:@")" options:0 range:openParenRange]).location != NSNotFound) {
    36 			//Add and subtract one to remove the parenthesis
    36 			//Add and subtract one to remove the parenthesis
    37 			NSString *dateString = [pathToFile substringWithRange:NSMakeRange(openParenRange.location + 1, (closeParenRange.location - openParenRange.location))];
    37 			NSString *dateString = [pathToFile substringWithRange:NSMakeRange(openParenRange.location + 1, (closeParenRange.location - openParenRange.location))];
    38 			return [formatter dateFromString:dateString];
    38 			return [formatter dateFromString:[dateString stringByReplacingOccurrencesOfString:@"|" withString:@"-"]];
    39 		}
    39 		}
    40 	}
    40 	}
    41 	return nil;
    41 	return nil;
    42 }
    42 }
    43 
    43