adium 5749:1521cab508bf: Fix Adium not storing timestamps with m...
commits at adium.im
commits at adium.im
Wed Oct 30 17:35:21 UTC 2013
details: http://hg.adium.im/adium/rev/1521cab508bf
revision: 5749:1521cab508bf
branch: adium-1.5.9
author: Thijs Alkemade <me at thijsalkema.de>
date: Wed Oct 30 18:34:07 2013 +0100
Fix Adium not storing timestamps with messages. Setting NSDateFormatterBehavior10_4 was not the solution, all included time format strings are now 10.4 style.
Message styles can still contain old style format strings, causing _NSDateFormatter_Log_New_Methods_On_Old_Formatters to be hit. We probably need to update the included ones and deprecate their usage in Adium.
diffs (81 lines):
diff -r 44b2eacffae5 -r 1521cab508bf Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Unparsing.m
--- a/Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Unparsing.m Wed Oct 23 14:22:49 2013 -0500
+++ b/Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Unparsing.m Wed Oct 30 18:34:07 2013 +0100
@@ -40,10 +40,10 @@
#pragma mark Public methods
- (NSString *)ISO8601DateStringWithTime:(BOOL)includeTime timeSeparator:(unichar)timeSep {
- NSString *dateFormat = [(includeTime ? @"%Y-%m-%dT%H:%M:%S" : @"%Y-%m-%d") prepareDateFormatWithTimeSeparator:timeSep];
- NSDateFormatter *formatter = [[NSDateFormatter alloc] initWithDateFormat:dateFormat allowNaturalLanguage:NO];
- [formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
- NSString *str = [formatter stringForObjectValue:self];
+ NSString *dateFormat = [(includeTime ? @"yyyy'-'MM'-'dd'T'HH':'mm':'ss" : @"yyyy'-'MM'-'dd") prepareDateFormatWithTimeSeparator:timeSep];
+ NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+ formatter.dateFormat = dateFormat;
+ NSString *str = [formatter stringFromDate:self];
[formatter release];
if(includeTime) {
NSInteger offset = [[self timeZone] secondsFromGMT];
@@ -106,8 +106,8 @@
NSString *timeString;
if(includeTime) {
- NSDateFormatter *formatter = [[NSDateFormatter alloc] initWithDateFormat:[@"T%H:%M:%S%z" prepareDateFormatWithTimeSeparator:timeSep] allowNaturalLanguage:NO];
- [formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
+ NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+ formatter.dateFormat = [@"'T'HH':'mm':'ssZ" prepareDateFormatWithTimeSeparator:timeSep];
timeString = [formatter stringForObjectValue:self];
[formatter release];
} else
@@ -118,8 +118,8 @@
- (NSString *)ISO8601OrdinalDateStringWithTime:(BOOL)includeTime timeSeparator:(unichar)timeSep {
NSString *timeString;
if(includeTime) {
- NSDateFormatter *formatter = [[NSDateFormatter alloc] initWithDateFormat:[@"T%H:%M:%S%z" prepareDateFormatWithTimeSeparator:timeSep] allowNaturalLanguage:NO];
- [formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
+ NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+ formatter.dateFormat = [@"'T'HH':'mm':'ssZ" prepareDateFormatWithTimeSeparator:timeSep];
timeString = [formatter stringForObjectValue:self];
[formatter release];
} else
diff -r 44b2eacffae5 -r 1521cab508bf Other/Adium Spotlight Importer/GetMetadataForFile.m
--- a/Other/Adium Spotlight Importer/GetMetadataForFile.m Wed Oct 23 14:22:49 2013 -0500
+++ b/Other/Adium Spotlight Importer/GetMetadataForFile.m Wed Oct 30 18:34:07 2013 +0100
@@ -242,8 +242,8 @@
//pick the first author for this. likely a bad idea
if (startDate && [otherAuthors count]) {
NSString *toUID = [otherAuthors objectAtIndex:0];
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] initWithDateFormat:@"%Y-%m-%d" allowNaturalLanguage:NO];
- [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ dateFormatter.dateFormat = @"yyyy'-'MM'-'dd";
[attributes setObject:[NSString stringWithFormat:@"%@ on %@",toUID,[dateFormatter stringFromDate:startDate]]
forKey:(NSString *)kMDItemDisplayName];
diff -r 44b2eacffae5 -r 1521cab508bf Plugins/WebKit Message View/AIWebkitMessageViewStyle.m
--- a/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m Wed Oct 23 14:22:49 2013 -0500
+++ b/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m Wed Oct 30 18:34:07 2013 +0100
@@ -334,7 +334,6 @@
if ([format rangeOfString:@"%"].location != NSNotFound) {
/* Support strftime-style format strings, which old message styles may use */
timeStampFormatter = [[NSDateFormatter alloc] initWithDateFormat:format allowNaturalLanguage:NO];
- [timeStampFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
} else {
timeStampFormatter = [[NSDateFormatter alloc] init];
[timeStampFormatter setDateFormat:format];
@@ -853,7 +852,6 @@
if ([timeFormat rangeOfString:@"%"].location != NSNotFound) {
/* Support strftime-style format strings, which old message styles may use */
dateFormatter = [[NSDateFormatter alloc] initWithDateFormat:timeFormat allowNaturalLanguage:NO];
- [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
} else {
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:timeFormat];
@@ -1273,7 +1271,6 @@
if ([timeFormat rangeOfString:@"%"].location != NSNotFound) {
/* Support strftime-style format strings, which old message styles may use */
dateFormatter = [[NSDateFormatter alloc] initWithDateFormat:timeFormat allowNaturalLanguage:NO];
- [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
} else {
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:timeFormat];
More information about the commits
mailing list