adium/adium

Parents fa1a98917a05
Children 310e867b52c1
Store the URL of Twitter avatars to prevent requesting ones that we already have.
--- a/Plugins/Twitter Plugin/AITwitterAccount.h Sun May 12 13:22:09 2013 -0400
+++ b/Plugins/Twitter Plugin/AITwitterAccount.h Sun May 12 13:43:38 2013 -0400
@@ -96,6 +96,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 Sun May 12 13:22:09 2013 -0400
+++ b/Plugins/Twitter Plugin/AITwitterAccount.m Sun May 12 13:43:38 2013 -0400
@@ -1030,6 +1030,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.
@@ -1047,6 +1050,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 }];