adium 3025:2e656c0a7558: Only check if a cached user icon exists...

commits at adium.im commits at adium.im
Sat Dec 5 18:14:50 UTC 2009


details:	http://hg.adium.im/adium/rev/2e656c0a7558
revision:	3025:2e656c0a7558
author:		Zachary West <zacw at adium.im>
date:		Sat Dec 05 13:09:19 2009 -0500

Only check if a cached user icon exists, instead of reading it in. Fixes #13551.

This *significantly* speeds up Twitter accounts.
(transplanted from c756003473acc280a6560a59349a481cdf65120c)

diffs (67 lines):

diff -r d85214653b95 -r 2e656c0a7558 Frameworks/Adium Framework/Source/AICachedUserIconSource.h
--- a/Frameworks/Adium Framework/Source/AICachedUserIconSource.h	Fri Dec 04 08:37:56 2009 -0600
+++ b/Frameworks/Adium Framework/Source/AICachedUserIconSource.h	Sat Dec 05 13:09:19 2009 -0500
@@ -13,5 +13,6 @@
 
 + (BOOL)cacheUserIconData:(NSData *)inData forObject:(AIListObject *)inObject;
 - (NSData *)cachedUserIconDataForObject:(AIListObject *)inObject;
+- (BOOL)cachedUserIconExistsForObject:(AIListObject *)inObject;
 
 @end
diff -r d85214653b95 -r 2e656c0a7558 Frameworks/Adium Framework/Source/AICachedUserIconSource.m
--- a/Frameworks/Adium Framework/Source/AICachedUserIconSource.m	Fri Dec 04 08:37:56 2009 -0600
+++ b/Frameworks/Adium Framework/Source/AICachedUserIconSource.m	Sat Dec 05 13:09:19 2009 -0500
@@ -118,6 +118,16 @@
 }
 
 /*!
+ * @brief Returns if a cached user icon exists.
+ *
+ * @result YES if a cached user icon exists, NO otherwise.
+ */
+- (BOOL)cachedUserIconExistsForObject:(AIListObject *)inObject
+{
+	return ([[NSFileManager defaultManager] fileExistsAtPath:[[self class] _cachedImagePathForObject:inObject]]);
+}
+
+/*!
  * @brief The priority at which this source should be used. See the #defines in AIUserIcons.h for posible values.
  */
 - (AIUserIconPriority)priority
diff -r d85214653b95 -r 2e656c0a7558 Frameworks/Adium Framework/Source/AIUserIcons.h
--- a/Frameworks/Adium Framework/Source/AIUserIcons.h	Fri Dec 04 08:37:56 2009 -0600
+++ b/Frameworks/Adium Framework/Source/AIUserIcons.h	Sat Dec 05 13:09:19 2009 -0500
@@ -103,6 +103,13 @@
 + (NSData *)cachedUserIconDataForObject:(AIListObject *)inObject;
 
 /*!
+ * @brief Returns if a cached user icon exists.
+ *
+ * @result YES if a cached user icon exists, NO otherwise.
+ */
++ (BOOL)cachedUserIconExistsForObject:(AIListObject *)inObject;
+
+/*!
  * @brief Retreive the serverside icon for an object, if there is one.
  */
 + (NSData *)serversideUserIconDataForObject:(AIListObject *)inObject;
diff -r d85214653b95 -r 2e656c0a7558 Frameworks/Adium Framework/Source/AIUserIcons.m
--- a/Frameworks/Adium Framework/Source/AIUserIcons.m	Fri Dec 04 08:37:56 2009 -0600
+++ b/Frameworks/Adium Framework/Source/AIUserIcons.m	Sat Dec 05 13:09:19 2009 -0500
@@ -308,6 +308,16 @@
 }
 
 /*!
+ * @brief Returns if a cached user icon exists.
+ *
+ * @result YES if a cached user icon exists, NO otherwise.
+ */
++ (BOOL)cachedUserIconExistsForObject:(AIListObject *)inObject
+{
+	return [cachedUserIconSource cachedUserIconExistsForObject:inObject];
+}
+
+/*!
  * @brief Get the user icon for an object
  *
  * If it's not already cached, the icon sources will be queried as needed.




More information about the commits mailing list