adium/adium

Parents bff389662124
Children 878a85a40504
Store the URL of Twitter avatars to prevent requesting ones that we already have.
(transplanted from ba73efba03535135368adf2c06a051a2ba09a69e)
--- a/Plugins/Twitter Plugin/AITwitterAccount.h Sat May 11 23:04:13 2013 -0400
+++ b/Plugins/Twitter Plugin/AITwitterAccount.h Sun May 12 13:43:38 2013 -0400
@@ -95,6 +95,7 @@
#define TWITTER_TIMELINE_NAME @"Timeline (%@)"
#define TWITTER_PROPERTY_REQUESTED_USER_ICON @"Twitter Requested User Icon"
+#define TWITTER_PROPERTY_USER_ICON_URL @"Twitter User Icon URL"
#define TWITTER_PREFERENCE_UPDATE_AFTER_SEND @"Update After Send"
#define TWITTER_PREFERENCE_UPDATE_GLOBAL @"Update Global Status"
--- a/Plugins/Twitter Plugin/AITwitterAccount.m Sat May 11 23:04:13 2013 -0400
+++ b/Plugins/Twitter Plugin/AITwitterAccount.m Sun May 12 13:43:38 2013 -0400
@@ -1027,6 +1027,9 @@
{
// If we don't already have an icon for the user...
if(![listContact boolValueForProperty:TWITTER_PROPERTY_REQUESTED_USER_ICON]) {
+ if ([[listContact valueForKey:TWITTER_PROPERTY_USER_ICON_URL] isEqualToString:url])
+ return;
+
[listContact setValue:[NSNumber numberWithBool:YES] forProperty:TWITTER_PROPERTY_REQUESTED_USER_ICON notify:NotifyNever];
// Grab the user icon and set it as their serverside icon.
@@ -1044,6 +1047,7 @@
notify:NotifyLater];
[listContact setValue:nil forProperty:TWITTER_PROPERTY_REQUESTED_USER_ICON notify:NotifyNever];
+ [listContact setValue:url forProperty:TWITTER_PROPERTY_USER_ICON_URL afterDelay:NotifyNever];
});
} else {
[self requestFailed:AITwitterUserIconPull withError:error userInfo:@{ @"ListContact" : listContact }];