adium 2970:e8bcc642a927: Replace the (Authorize/Deny/Ignore).png...

commits at adium.im commits at adium.im
Thu Nov 26 03:59:20 UTC 2009


details:	http://hg.adium.im/adium/rev/e8bcc642a927
revision:	2970:e8bcc642a927
author:		Zachary West <zacw at adium.im>
date:		Wed Nov 25 20:44:24 2009 -0500

Replace the (Authorize/Deny/Ignore).png images with (Authorize/Deny/Ignore).tiff images, with multiple sizes. From George Lambrou.
(transplanted from d525fccd2bcb061597107e35f404fed1ef5b7416)
Subject: adium 2971:7a2849d365cb: Code simplification; remove the old preferences, and don't use a static variable to count the lines. Refs #13362.

details:	http://hg.adium.im/adium/rev/7a2849d365cb
revision:	2971:7a2849d365cb
author:		Zachary West <zacw at adium.im>
date:		Wed Nov 25 22:28:47 2009 -0500

Code simplification; remove the old preferences, and don't use a static variable to count the lines. Refs #13362.

I can't imagine using a static variable like this wouldn't cause problems, especially with "save chats" enabled; we'd be messing with the same static variable like crazy. I'm betting this explains some weird context problems, so let's see if this helps #13362.
(transplanted from 37f86ef91f6444487aafbe1af64a74f2a088fd9b)
Subject: adium 2972:47be9c84a2d8: Don't deal with autorelease pools on the file level; deal with it in terms of chats. Refs #13362.

details:	http://hg.adium.im/adium/rev/47be9c84a2d8
revision:	2972:47be9c84a2d8
author:		Zachary West <zacw at adium.im>
date:		Wed Nov 25 22:34:07 2009 -0500

Don't deal with autorelease pools on the file level; deal with it in terms of chats. Refs #13362.
(transplanted from fa988de96a942c5f209a86b73e849b8996c10752)
Subject: adium 2973:fa5dd8f81f12: Don't use any instance variables to control parsing, use the parser's context info. Refs #13362.

details:	http://hg.adium.im/adium/rev/fa5dd8f81f12
revision:	2973:fa5dd8f81f12
author:		Zachary West <zacw at adium.im>
date:		Wed Nov 25 22:41:51 2009 -0500

Don't use any instance variables to control parsing, use the parser's context info. Refs #13362.
(transplanted from 2a385da3eace06fe7a7dee95bef5971428b33b8c)
Subject: adium 2974:fd33a63c20a4: Avoid draining items we're still using; fix for some reason putting "Value" in this context object. Refs #13362.

details:	http://hg.adium.im/adium/rev/fd33a63c20a4
revision:	2974:fd33a63c20a4
author:		Zachary West <zacw at adium.im>
date:		Wed Nov 25 22:55:50 2009 -0500

Avoid draining items we're still using; fix for some reason putting "Value" in this context object. Refs #13362.
(transplanted from 24c471ce6c9e88a9809f376dc5525ac85a0cc97a)

diffs (450 lines):

diff -r 736e72538d4d -r fd33a63c20a4 Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj	Wed Nov 25 20:27:44 2009 -0500
+++ b/Adium.xcodeproj/project.pbxproj	Wed Nov 25 22:55:50 2009 -0500
@@ -156,8 +156,10 @@
 		118A44540FEEA82E008153C0 /* libjson-glib.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 118A444F0FEEA828008153C0 /* libjson-glib.framework */; };
 		1192E6D90FD3056F003CAEF5 /* AIAnnoyingIRCMessagesHiderPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 1192E6B10FD30307003CAEF5 /* AIAnnoyingIRCMessagesHiderPlugin.h */; };
 		1192E6DA0FD30578003CAEF5 /* AIAnnoyingIRCMessagesHiderPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 1192E6B20FD30307003CAEF5 /* AIAnnoyingIRCMessagesHiderPlugin.m */; };
-		11945F400F7935A2002A54B3 /* Ignore.png in Resources */ = {isa = PBXBuildFile; fileRef = 11945F3F0F7935A2002A54B3 /* Ignore.png */; };
 		1197F6710FCF8D180032F19B /* AITwitterStatusFollowup.m in Sources */ = {isa = PBXBuildFile; fileRef = 1197F6700FCF8D180032F19B /* AITwitterStatusFollowup.m */; };
+		1199AB0610BE13E600646322 /* Authorize.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1199AB0310BE13E600646322 /* Authorize.tiff */; };
+		1199AB0710BE13E600646322 /* Deny.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1199AB0410BE13E600646322 /* Deny.tiff */; };
+		1199AB0810BE13E600646322 /* Ignore.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1199AB0510BE13E600646322 /* Ignore.tiff */; };
 		11A2F10A0FC8FC1A00C3F05C /* AIMessageAlertsAdvancedPreferences.nib in Resources */ = {isa = PBXBuildFile; fileRef = 11A2F1090FC8FC1A00C3F05C /* AIMessageAlertsAdvancedPreferences.nib */; };
 		11A2F1220FC8FC9D00C3F05C /* AIMessageAlertsAdvancedPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 11A2F1210FC8FC9D00C3F05C /* AIMessageAlertsAdvancedPreferences.m */; };
 		11AA10130FCE0969003908B6 /* AIProgressDataUploader.h in Headers */ = {isa = PBXBuildFile; fileRef = 11AA10110FCE0969003908B6 /* AIProgressDataUploader.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -197,8 +199,6 @@
 		11EE1CD50CDD01120097F246 /* libpurple.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 1172FBC90CDAA8D400B8E233 /* libpurple.framework */; };
 		11F145F00B546AC500CA91F6 /* Menu Bar Icons in Copy Built-in Xtras */ = {isa = PBXBuildFile; fileRef = 11F145C70B546A6D00CA91F6 /* Menu Bar Icons */; };
 		11F1460C0B546C1200CA91F6 /* AIMenuBarIcons.m in Sources */ = {isa = PBXBuildFile; fileRef = 11F1460A0B546C1200CA91F6 /* AIMenuBarIcons.m */; };
-		11F5E7810F78A39400837A0B /* Authorize.png in Resources */ = {isa = PBXBuildFile; fileRef = 11F5E7800F78A39400837A0B /* Authorize.png */; };
-		11F5E7840F78A3AA00837A0B /* Deny.png in Resources */ = {isa = PBXBuildFile; fileRef = 11F5E7830F78A3AA00837A0B /* Deny.png */; };
 		11F5E7910F78A41700837A0B /* GetInfo.png in Resources */ = {isa = PBXBuildFile; fileRef = 11F5E7900F78A41700837A0B /* GetInfo.png */; };
 		11F738F20F58D12200B3285B /* AITwitterAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = 11F738F10F58D12200B3285B /* AITwitterAccount.m */; };
 		11F738F90F58D18700B3285B /* AITwitterService.m in Sources */ = {isa = PBXBuildFile; fileRef = 11F738F80F58D18700B3285B /* AITwitterService.m */; };
@@ -1957,9 +1957,11 @@
 		118A444F0FEEA828008153C0 /* libjson-glib.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "libjson-glib.framework"; path = "Frameworks/libjson-glib.framework"; sourceTree = "<group>"; };
 		1192E6B10FD30307003CAEF5 /* AIAnnoyingIRCMessagesHiderPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIAnnoyingIRCMessagesHiderPlugin.h; path = "Plugins/Purple Service/AIAnnoyingIRCMessagesHiderPlugin.h"; sourceTree = "<group>"; };
 		1192E6B20FD30307003CAEF5 /* AIAnnoyingIRCMessagesHiderPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIAnnoyingIRCMessagesHiderPlugin.m; path = "Plugins/Purple Service/AIAnnoyingIRCMessagesHiderPlugin.m"; sourceTree = "<group>"; };
-		11945F3F0F7935A2002A54B3 /* Ignore.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Ignore.png; path = "Frameworks/Adium Framework/Resources/Ignore.png"; sourceTree = "<group>"; };
 		1197F66F0FCF8D180032F19B /* AITwitterStatusFollowup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AITwitterStatusFollowup.h; path = "Plugins/Twitter Plugin/AITwitterStatusFollowup.h"; sourceTree = "<group>"; };
 		1197F6700FCF8D180032F19B /* AITwitterStatusFollowup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AITwitterStatusFollowup.m; path = "Plugins/Twitter Plugin/AITwitterStatusFollowup.m"; sourceTree = "<group>"; };
+		1199AB0310BE13E600646322 /* Authorize.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Authorize.tiff; path = "Frameworks/Adium Framework/Resources/Authorize.tiff"; sourceTree = "<group>"; };
+		1199AB0410BE13E600646322 /* Deny.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Deny.tiff; path = "Frameworks/Adium Framework/Resources/Deny.tiff"; sourceTree = "<group>"; };
+		1199AB0510BE13E600646322 /* Ignore.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Ignore.tiff; path = "Frameworks/Adium Framework/Resources/Ignore.tiff"; sourceTree = "<group>"; };
 		11A2F1090FC8FC1A00C3F05C /* AIMessageAlertsAdvancedPreferences.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = AIMessageAlertsAdvancedPreferences.nib; path = Resources/AIMessageAlertsAdvancedPreferences.nib; sourceTree = "<group>"; };
 		11A2F1200FC8FC9D00C3F05C /* AIMessageAlertsAdvancedPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIMessageAlertsAdvancedPreferences.h; path = Source/AIMessageAlertsAdvancedPreferences.h; sourceTree = "<group>"; };
 		11A2F1210FC8FC9D00C3F05C /* AIMessageAlertsAdvancedPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIMessageAlertsAdvancedPreferences.m; path = Source/AIMessageAlertsAdvancedPreferences.m; sourceTree = "<group>"; };
@@ -2023,8 +2025,6 @@
 		11F145C70B546A6D00CA91F6 /* Menu Bar Icons */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "Menu Bar Icons"; path = "Resources/Menu Bar Icons"; sourceTree = "<group>"; };
 		11F146090B546C1200CA91F6 /* AIMenuBarIcons.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AIMenuBarIcons.h; path = Source/AIMenuBarIcons.h; sourceTree = "<group>"; };
 		11F1460A0B546C1200CA91F6 /* AIMenuBarIcons.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AIMenuBarIcons.m; path = Source/AIMenuBarIcons.m; sourceTree = "<group>"; };
-		11F5E7800F78A39400837A0B /* Authorize.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Authorize.png; path = "Frameworks/Adium Framework/Resources/Authorize.png"; sourceTree = "<group>"; };
-		11F5E7830F78A3AA00837A0B /* Deny.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Deny.png; path = "Frameworks/Adium Framework/Resources/Deny.png"; sourceTree = "<group>"; };
 		11F5E7900F78A41700837A0B /* GetInfo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = GetInfo.png; path = "Frameworks/Adium Framework/Resources/GetInfo.png"; sourceTree = "<group>"; };
 		11F738F00F58D12200B3285B /* AITwitterAccount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AITwitterAccount.h; path = "Plugins/Twitter Plugin/AITwitterAccount.h"; sourceTree = "<group>"; };
 		11F738F10F58D12200B3285B /* AITwitterAccount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AITwitterAccount.m; path = "Plugins/Twitter Plugin/AITwitterAccount.m"; sourceTree = "<group>"; };
@@ -7226,10 +7226,10 @@
 		4BE5AC7F07AFD46800422AD5 /* Interface */ = {
 			isa = PBXGroup;
 			children = (
-				11945F3F0F7935A2002A54B3 /* Ignore.png */,
-				11F5E7800F78A39400837A0B /* Authorize.png */,
+				1199AB0310BE13E600646322 /* Authorize.tiff */,
+				1199AB0410BE13E600646322 /* Deny.tiff */,
+				1199AB0510BE13E600646322 /* Ignore.tiff */,
 				11F5E7900F78A41700837A0B /* GetInfo.png */,
-				11F5E7830F78A3AA00837A0B /* Deny.png */,
 				114849BB0F78420300EA5264 /* AIAuthorizationRequestsWindow.nib */,
 				114849B70F7841C600EA5264 /* AIAuthorizationRequestsWindowController.h */,
 				114849B80F7841C600EA5264 /* AIAuthorizationRequestsWindowController.m */,
@@ -9960,10 +9960,10 @@
 				34F144430BA8FF3C000473DE /* EmoticonNames.strings in Resources */,
 				34A1A8E70DFB276E00AC78CF /* SocialNetworkingCustomStatus.nib in Resources */,
 				114849BC0F78420300EA5264 /* AIAuthorizationRequestsWindow.nib in Resources */,
-				11F5E7810F78A39400837A0B /* Authorize.png in Resources */,
-				11F5E7840F78A3AA00837A0B /* Deny.png in Resources */,
 				11F5E7910F78A41700837A0B /* GetInfo.png in Resources */,
-				11945F400F7935A2002A54B3 /* Ignore.png in Resources */,
+				1199AB0610BE13E600646322 /* Authorize.tiff in Resources */,
+				1199AB0710BE13E600646322 /* Deny.tiff in Resources */,
+				1199AB0810BE13E600646322 /* Ignore.tiff in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff -r 736e72538d4d -r fd33a63c20a4 Frameworks/Adium Framework/Resources/Authorize.png
Binary file Frameworks/Adium Framework/Resources/Authorize.png has changed
diff -r 736e72538d4d -r fd33a63c20a4 Frameworks/Adium Framework/Resources/Authorize.tiff
Binary file Frameworks/Adium Framework/Resources/Authorize.tiff has changed
diff -r 736e72538d4d -r fd33a63c20a4 Frameworks/Adium Framework/Resources/Deny.png
Binary file Frameworks/Adium Framework/Resources/Deny.png has changed
diff -r 736e72538d4d -r fd33a63c20a4 Frameworks/Adium Framework/Resources/Deny.tiff
Binary file Frameworks/Adium Framework/Resources/Deny.tiff has changed
diff -r 736e72538d4d -r fd33a63c20a4 Frameworks/Adium Framework/Resources/Ignore.png
Binary file Frameworks/Adium Framework/Resources/Ignore.png has changed
diff -r 736e72538d4d -r fd33a63c20a4 Frameworks/Adium Framework/Resources/Ignore.tiff
Binary file Frameworks/Adium Framework/Resources/Ignore.tiff has changed
diff -r 736e72538d4d -r fd33a63c20a4 Plugins/General Preferences/ESGeneralPreferences.m
--- a/Plugins/General Preferences/ESGeneralPreferences.m	Wed Nov 25 20:27:44 2009 -0500
+++ b/Plugins/General Preferences/ESGeneralPreferences.m	Wed Nov 25 22:55:50 2009 -0500
@@ -110,11 +110,7 @@
 	[popUp_tabPositionMenu setMenu:[self tabPositionMenu]];
 	[popUp_tabPositionMenu selectItemWithTag:[[adium.preferenceController preferenceForKey:KEY_TABBAR_POSITION
 																								 group:PREF_GROUP_DUAL_WINDOW_INTERFACE] intValue]];
-	
-	//Quit
-	//[checkBox_confirmOnQuit setState:[[adium.preferenceController preferenceForKey:KEY_CONFIRM_QUIT
-	//																			group:PREF_GROUP_CONFIRMATIONS] boolValue]];
-	
+
 	//Global hotkey
 	TISInputSourceRef currentLayout = TISCopyCurrentKeyboardLayoutInputSource();
 	
diff -r 736e72538d4d -r fd33a63c20a4 Source/DCMessageContextDisplayPlugin.h
--- a/Source/DCMessageContextDisplayPlugin.h	Wed Nov 25 20:27:44 2009 -0500
+++ b/Source/DCMessageContextDisplayPlugin.h	Wed Nov 25 22:55:50 2009 -0500
@@ -21,49 +21,19 @@
 
 // Pref keys
 #define KEY_DISPLAY_CONTEXT			@"Display Message Context"
-#define	KEY_DIM_RECENT_CONTEXT		@"Dim Recent Context"
 #define KEY_DISPLAY_LINES			@"Lines to Display"
-#define KEY_DISPLAY_MODE			@"Display Mode"
-#define KEY_HAVE_TALKED_DAYS		@"Have Talked Days"
-#define KEY_HAVE_NOT_TALKED_DAYS	@"Have Not Talked Days"
-#define KEY_HAVE_TALKED_UNITS		@"Have Talked Units"
-#define KEY_HAVE_NOT_TALKED_UNITS   @"Have Not Talked Units"
 
 #define CONTEXT_DISPLAY_DEFAULTS	@"MessageContextDisplayDefaults"
 
-// Possible Display Modes
-typedef enum AIMessageHistoryDisplayModes {
-	MODE_ALWAYS = 0,
-	MODE_HAVE_TALKED,
-	MODE_HAVE_NOT_TALKED
-} AIMessageHistoryDisplayModes;
-
-// Possible Units
-typedef enum AIMessageHistoryDisplayUnits {
-	UNIT_DAYS = 0,
-	UNIT_HOURS
-} AIMessageHistoryDisplayUnits;
-
 @class DCMessageContextDisplayPreferences, SMSQLiteLoggerPlugin;
 
 @interface DCMessageContextDisplayPlugin : AIPlugin {	
 	BOOL							isObserving;
 	BOOL							shouldDisplay;
 	BOOL							dimRecentContext;
-	NSInteger								linesToDisplay;
-	
-	NSInteger								displayMode;
-	NSInteger								haveTalkedDays;
-	NSInteger								haveNotTalkedDays;
-	
-	NSInteger								haveTalkedUnits;
-	NSInteger								haveNotTalkedUnits;
+	NSInteger						linesToDisplay;
 	
 	DCMessageContextDisplayPreferences  *preferences;
-	
-	NSMutableArray	  *foundMessages;
-	NSMutableArray	  *elementStack;
-	NSAutoreleasePool *parsingAutoreleasePool;
 }
 
 @end
diff -r 736e72538d4d -r fd33a63c20a4 Source/DCMessageContextDisplayPlugin.m
--- a/Source/DCMessageContextDisplayPlugin.m	Wed Nov 25 20:27:44 2009 -0500
+++ b/Source/DCMessageContextDisplayPlugin.m	Wed Nov 25 22:55:50 2009 -0500
@@ -22,9 +22,6 @@
 #import <Adium/AIContentContext.h>
 #import <Adium/AIService.h>
 
-//#import "SMSQLiteLoggerPlugin.h"
-//#import "AICoreComponentLoader.h"
-
 //Old school
 #import <Adium/AIListContact.h>
 #import <AIUtilities/AIAttributedStringAdditions.h>
@@ -53,9 +50,6 @@
 @interface DCMessageContextDisplayPlugin ()
 - (void)preferencesChangedForGroup:(NSString *)group key:(NSString *)key
 							object:(AIListObject *)object preferenceDict:(NSDictionary *)prefDict firstTime:(BOOL)firstTime;
-- (void)old_preferencesChangedForGroup:(NSString *)group key:(NSString *)key
-								object:(AIListObject *)object preferenceDict:(NSDictionary *)prefDict firstTime:(BOOL)firstTime;
-- (BOOL)contextShouldBeDisplayed:(NSCalendarDate *)inDate;
 - (NSArray *)contextForChat:(AIChat *)chat;
 @end
 
@@ -72,14 +66,6 @@
     [adium.preferenceController registerDefaults:[NSDictionary dictionaryNamed:CONTEXT_DISPLAY_DEFAULTS
 																		forClass:[self class]] 
 										  forGroup:PREF_GROUP_CONTEXT_DISPLAY];
-		
-	//Obtain the default preferences and use them - Adium 1.1 experiment to see if people use these prefs
-	[self old_preferencesChangedForGroup:PREF_GROUP_CONTEXT_DISPLAY
-								 key:nil
-							  object:nil
-					  preferenceDict:[NSDictionary dictionaryNamed:CONTEXT_DISPLAY_DEFAULTS
-														  forClass:[self class]]
-						   firstTime:YES];
 	
 	//Observe preference changes for whether or not to display message history
 	[adium.preferenceController registerPreferenceObserver:self forGroup:PREF_GROUP_CONTEXT_DISPLAY];
@@ -117,23 +103,6 @@
 		}
 	}
 }
-/**
- * @brief Preferences for when to display history changed
- *
- * Only change our preferences in response to global preference notifications; specific objects use this group as well.
- */
-- (void)old_preferencesChangedForGroup:(NSString *)group key:(NSString *)key
-							object:(AIListObject *)object preferenceDict:(NSDictionary *)prefDict firstTime:(BOOL)firstTime
-{
-	if (!object) {
-		haveTalkedDays = [[prefDict objectForKey:KEY_HAVE_TALKED_DAYS] integerValue];
-		haveNotTalkedDays = [[prefDict objectForKey:KEY_HAVE_NOT_TALKED_DAYS] integerValue];
-		displayMode = [[prefDict objectForKey:KEY_DISPLAY_MODE] integerValue];
-		
-		haveTalkedUnits = [[prefDict objectForKey:KEY_HAVE_TALKED_UNITS] integerValue];
-		haveNotTalkedUnits = [[prefDict objectForKey:KEY_HAVE_NOT_TALKED_UNITS] integerValue];		
-	}
-}
 
 /**
  * @brief Retrieve and display in-window message history
@@ -147,75 +116,23 @@
 	NSArray	*context = [self contextForChat:chat];
 
 	if (context && [context count] > 0 && shouldDisplay) {
-		//Check if the history fits the date restrictions
+		AIContentContext	*contextMessage;
+
+		for(contextMessage in context) {
+			/* Don't display immediately, so the message view can aggregate multiple message history items.
+			 * As required, we post Content_ChatDidFinishAddingUntrackedContent when finished adding. */
+			[contextMessage setDisplayContentImmediately:NO];
 		
-		//The most recent message is what determines whether we have "chatted in the last X days", "not chatted in the last X days", etc.
-		NSCalendarDate *mostRecentMessage = [[(AIContentContext *)[context lastObject] date] dateWithCalendarFormat:nil timeZone:nil];
-		if ([self contextShouldBeDisplayed:mostRecentMessage]) {
-			AIContentContext	*contextMessage;
+			[adium.contentController displayContentObject:contextMessage
+										usingContentFilters:YES
+												immediately:YES];
+		}
 
-			for(contextMessage in context) {
-				/* Don't display immediately, so the message view can aggregate multiple message history items.
-				 * As required, we post Content_ChatDidFinishAddingUntrackedContent when finished adding. */
-				[contextMessage setDisplayContentImmediately:NO];
-			
-				[adium.contentController displayContentObject:contextMessage
-											usingContentFilters:YES
-													immediately:YES];
-			}
-
-			//We finished adding untracked content
-			[[NSNotificationCenter defaultCenter] postNotificationName:Content_ChatDidFinishAddingUntrackedContent
-												  	  object:chat];
-		}
+		//We finished adding untracked content
+		[[NSNotificationCenter defaultCenter] postNotificationName:Content_ChatDidFinishAddingUntrackedContent
+												  object:chat];
 	}
 }
-
-/**
- * @brief Does a specified date match our criteria for display?
- *
- * The date passed should be the date of the _most recent_ stored message history item
- *
- * @result YES if the mesage history should be displayed
- */
-- (BOOL)contextShouldBeDisplayed:(NSCalendarDate *)inDate
-{
-	BOOL dateIsGood = YES;
-	NSInteger thresholdDays = 0;
-	NSInteger thresholdHours = 0;
-	
-	if (displayMode != MODE_ALWAYS) {
-		
-		if (displayMode == MODE_HAVE_TALKED) {
-			if (haveTalkedUnits == UNIT_DAYS)
-				thresholdDays = haveTalkedDays;
-			
-			else if (haveTalkedUnits == UNIT_HOURS)
-				thresholdHours = haveTalkedDays;
-			
-		} else if (displayMode == MODE_HAVE_NOT_TALKED) {
-			if ( haveTalkedUnits == UNIT_DAYS )
-				thresholdDays = haveNotTalkedDays;
-			else if (haveTalkedUnits == UNIT_HOURS)
-				thresholdHours = haveNotTalkedDays;
-		}
-		
-		// Take the most recent message's date, add our limits to it
-		// See if the new date is earlier or later than today's date
-		NSCalendarDate *newDate = [inDate dateByAddingYears:0 months:0 days:thresholdDays hours:thresholdHours minutes:0 seconds:0];
-
-		NSComparisonResult comparison = [newDate compare:[NSDate date]];
-		
-		if (((displayMode == MODE_HAVE_TALKED) && (comparison == NSOrderedAscending)) ||
-			((displayMode == MODE_HAVE_NOT_TALKED) && (comparison == NSOrderedDescending)) ) {
-			dateIsGood = NO;
-		}
-	}
-	
-	return dateIsGood;
-}
-
-static NSInteger linesLeftToFind = 0;
 /*!
  * @brief Retrieve the message history for a particular chat
  *
@@ -226,6 +143,8 @@
 	//If there's no log there, there's no message history. Bail out.
 	NSArray *logPaths = [AILoggerPlugin sortedArrayOfLogFilesForChat:chat];
 	if(!logPaths) return nil;
+	
+	NSInteger linesLeftToFind = 0;
 
 	AIHTMLDecoder *decoder = [AIHTMLDecoder decoder];
 
@@ -237,7 +156,7 @@
 		[AILoggerPlugin relativePathForLogWithObject:logObjectUID onAccount:chat.account]];	
 
 	if ([chat boolValueForProperty:@"Restored Chat"] && linesToDisplay < RESTORED_CHAT_CONTEXT_LINE_NUMBER) {
-		linesLeftToFind = RESTORED_CHAT_CONTEXT_LINE_NUMBER;
+		linesLeftToFind = MAX(linesLeftToFind, RESTORED_CHAT_CONTEXT_LINE_NUMBER);
 	} else {
 		linesLeftToFind = linesToDisplay;		
 	}
@@ -274,8 +193,8 @@
 		}
 
 		//Initialize the found messages array and element stack for us-as-delegate
-		foundMessages = [NSMutableArray arrayWithCapacity:linesLeftToFind];
-		elementStack = [NSMutableArray array];
+		NSMutableArray *foundMessages = [NSMutableArray arrayWithCapacity:linesLeftToFind];
+		NSMutableArray *elementStack = [NSMutableArray array];
 
 		//Create the parser and set ourselves as the delegate
 		LMXParser *parser = [LMXParser parser];
@@ -296,6 +215,9 @@
 						   accountID, @"Account ID",
 						   chat, @"Chat",
 						   decoder, @"AIHTMLDecoder",
+						   [NSValue valueWithPointer:&linesLeftToFind], @"LinesLeftToFindValue",
+						   foundMessages, @"FoundMessages",
+						   elementStack, @"ElementStack",
 						   nil];
 			[parser setContextInfo:(void *)contextInfo];
 		}
@@ -312,8 +234,9 @@
 		off_t offset = [file offsetInFile];
 		enum LMXParseResult result = LMXParsedIncomplete;
 
-		parsingAutoreleasePool = [[NSAutoreleasePool alloc] init];
-
+		// These set of file's autorelease pool.
+		NSAutoreleasePool *parsingAutoreleasePool = [[NSAutoreleasePool alloc] init];
+		
 		do {
 			//Calculate the new offset
 			offset = (offset <= readSize) ? 0 : offset - readSize;
@@ -332,8 +255,8 @@
 		//Continue to parse as long as we need more elements, we have data to read, and LMX doesn't think we're done.
 		} while ([foundMessages count] < linesLeftToFind && offset > 0 && result != LMXParsedCompletely);
 
-		//Pop our autorelease pool.
-		[parsingAutoreleasePool release]; parsingAutoreleasePool = nil;
+		//Drain our autorelease pool.
+		[parsingAutoreleasePool release];
 
 		//Be a good citizen and close the file
 		[file closeFile];
@@ -342,6 +265,11 @@
 		[outerFoundContentContexts replaceObjectsInRange:NSMakeRange(0, 0) withObjectsFromArray:foundMessages];
 		linesLeftToFind -= [outerFoundContentContexts count];
 	}
+		
+	if (linesLeftToFind > 0) {
+		AILogWithSignature(@"Unable to find %d logs for %@", linesLeftToFind, chat);
+	}
+	
 	return outerFoundContentContexts;
 }
 
@@ -349,6 +277,9 @@
 
 - (void)parser:(LMXParser *)parser elementEnded:(NSString *)elementName
 {
+	NSMutableDictionary *contextInfo = [parser contextInfo];
+	NSMutableArray *elementStack = [contextInfo objectForKey:@"ElementStack"];
+	
 	if ([elementName isEqualToString:@"message"]) {
 		[elementStack insertObject:[AIXMLElement elementWithName:elementName] atIndex:0U];
 	}
@@ -361,20 +292,27 @@
 
 - (void)parser:(LMXParser *)parser foundCharacters:(NSString *)string
 {
+	NSMutableDictionary *contextInfo = [parser contextInfo];
+	NSMutableArray *elementStack = [contextInfo objectForKey:@"ElementStack"];
+	
 	if ([elementStack count])
 		[(AIXMLElement *)[elementStack objectAtIndex:0U] insertObject:string atIndex:0U];
 }
 
 - (void)parser:(LMXParser *)parser elementStarted:(NSString *)elementName attributes:(NSDictionary *)attributes
 {
+	NSMutableDictionary *contextInfo = [parser contextInfo];
+	NSMutableArray *elementStack = [contextInfo objectForKey:@"ElementStack"];
+	
 	if ([elementStack count]) {
 		AIXMLElement *element = [elementStack objectAtIndex:0U];
 		if (attributes) {
 			[element setAttributeNames:[attributes allKeys] values:[attributes allValues]];
 		}
 		
-		NSMutableDictionary *contextInfo = [parser contextInfo];
-
+		NSMutableArray	*foundMessages = [contextInfo objectForKey:@"FoundMessages"];
+		NSInteger	 *linesLeftToFind = [[contextInfo objectForKey:@"LinesLeftToFindValue"] pointerValue];
+		
 		if ([elementName isEqualToString:@"message"]) {
 			//A message element has started!
 			//This means that we have all of this message now, and therefore can create a single content object from the AIXMLElement tree and then throw away that tree.
@@ -384,7 +322,7 @@
 			AIListObject *account     = [contextInfo objectForKey:@"Account"];
 			NSString     *accountID   = [contextInfo objectForKey:@"Account ID"];
 			AIChat       *chat        = [contextInfo objectForKey:@"Chat"];
-
+			
 			//Set up some doohickers.
 			NSDictionary	*attributes = [element attributes];
 			NSString		*timeString = [attributes objectForKey:@"time"];
@@ -427,17 +365,11 @@
 				NSLog(@"Null message context display time for %@",element);
 			}
 		}
-
+		
 		[elementStack removeObjectAtIndex:0U];
-		if ([foundMessages count] == linesLeftToFind) {
+		if ([foundMessages count] == *linesLeftToFind) {
 			if ([elementStack count]) [elementStack removeAllObjects];
 			[parser abortParsing];
-		} else {
-			//We're still looking for more messages in this file.
-			//Pop the current autorelease pool and start a new one.
-			//This frees the most recent tree of autoreleased AIXMLElements.
-			[parsingAutoreleasePool release];
-			parsingAutoreleasePool = [[NSAutoreleasePool alloc] init];
 		}
 	}
 }




More information about the commits mailing list