adium-1.4 2878:c756003473ac: Only check if a cached user icon ex...

commits at adium.im commits at adium.im
Sat Dec 5 18:10:27 UTC 2009


details:	http://hg.adium.im/adium-1.4/rev/c756003473ac
revision:	2878:c756003473ac
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.

diffs (67 lines):

diff -r 7f70f199f31d -r c756003473ac 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 7f70f199f31d -r c756003473ac 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 7f70f199f31d -r c756003473ac 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 7f70f199f31d -r c756003473ac 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