From a9c20a36cac14e4ecee6dd64e3de57524ed5a67a Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 10 Sep 2007 21:57:12 +0000 Subject: [PATCH] the text-copy of the message log is sorted by date --- macosx/MessageWindowController.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/macosx/MessageWindowController.m b/macosx/MessageWindowController.m index f7383612f..ba0874be3 100644 --- a/macosx/MessageWindowController.m +++ b/macosx/MessageWindowController.m @@ -194,10 +194,15 @@ - (void) writeToFile: (id) sender { + //make the array sorted by date + NSSortDescriptor * descriptor = [[[NSSortDescriptor alloc] initWithKey: @"Date" ascending: YES] autorelease]; + NSArray * descriptors = [[NSArray alloc] initWithObjects: descriptor, nil]; + NSArray * sortedMessages = [fMessages sortedArrayUsingDescriptors: descriptors]; + [descriptors release]; + //create the text to output NSMutableArray * messageStrings = [NSMutableArray arrayWithCapacity: [fMessages count]]; - - NSEnumerator * enumerator = [fMessages objectEnumerator]; + NSEnumerator * enumerator = [sortedMessages objectEnumerator]; NSDictionary * message; while ((message = [enumerator nextObject])) [messageStrings addObject: [self stringForMessage: message]];