adium 4018:6ca41449fc05: Properly use the defaults system for th...

commits at adium.im commits at adium.im
Sat Jun 25 21:03:04 UTC 2011


details:	http://hg.adium.im/adium/rev/6ca41449fc05
revision:	4018:6ca41449fc05
branch:		(none)
author:		Evan Schoenberg
date:		Sat Jun 25 16:02:59 2011 -0500

Properly use the defaults system for the connect host of Twitter.  Clear out a previously set preference for twitter.com. Set the apiPath to /1. Fixes retrieving the Twitter user list. Fixes #15239

diffs (45 lines):

diff -r e071ecbbe9bb -r 6ca41449fc05 Plugins/Twitter Plugin/AITwitterAccount.m
--- a/Plugins/Twitter Plugin/AITwitterAccount.m	Sat Jun 25 15:34:53 2011 -0500
+++ b/Plugins/Twitter Plugin/AITwitterAccount.m	Sat Jun 25 16:02:59 2011 -0500
@@ -99,10 +99,19 @@
 										forGroup:TWITTER_PREFERENCE_GROUP_UPDATES
 										  object:self];
 	
-	// If we don't have a server set, set our default (if we have one)
-	if (!self.host && self.defaultServer) {
-		[self setPreference:self.defaultServer forKey:KEY_CONNECT_HOST group:GROUP_ACCOUNT_STATUS];
-	}
+    /* twitter.com isn't a valid server, but it was stored directly in the past. Clear it. */
+    if ([[self preferenceForKey:KEY_CONNECT_HOST group:GROUP_ACCOUNT_STATUS] isEqualToString:@"twitter.com"])
+        [self setPreference:nil
+                     forKey:KEY_CONNECT_HOST 
+                      group:GROUP_ACCOUNT_STATUS];
+
+    /* Register the default server if there is one. A subclass may choose to have no default server at all. */
+    if (self.defaultServer) {
+        [adium.preferenceController registerDefaults:[NSDictionary dictionaryWithObject:self.defaultServer
+                                                                                 forKey:KEY_CONNECT_HOST]
+                                            forGroup:GROUP_ACCOUNT_STATUS
+                                              object:self];        
+    }
 	
 	[adium.preferenceController registerPreferenceObserver:self forGroup:TWITTER_PREFERENCE_GROUP_UPDATES];
 	[adium.preferenceController informObserversOfChangedKey:nil inGroup:TWITTER_PREFERENCE_GROUP_UPDATES object:self];
@@ -127,7 +136,7 @@
  */
 - (NSString *)defaultServer
 {
-	return @"twitter.com";
+	return @"api.twitter.com";
 }
 
 #pragma mark AIAccount methods
@@ -302,7 +311,7 @@
  */
 - (NSString *)apiPath
 {
-	return nil;
+	return @"/1";
 }
 
 /*!




More information about the commits mailing list