--- a/Plugins/Purple Service/AIPurpleGTalkAccount.h Wed Apr 01 20:32:24 2015 +0200
+++ b/Plugins/Purple Service/AIPurpleGTalkAccount.h Wed Apr 01 21:12:13 2015 +0200
@@ -17,6 +17,7 @@
#import "ESPurpleJabberAccount.h"
#define KEY_GTALK_CODE @"GTalk:Code"
+#define KEY_GTALK_UPGRADED_OAUTH2 @"GTalk:OAuth2 Upgraded" #define ADIUM_GTALK_CLIENT_ID @"853036734951.apps.googleusercontent.com"
#define ADIUM_GTALK_SECRET @"TSXNUaq34k_0YU7DZT4HbmQd"
--- a/Plugins/Purple Service/AIPurpleGTalkAccount.m Wed Apr 01 20:32:24 2015 +0200
+++ b/Plugins/Purple Service/AIPurpleGTalkAccount.m Wed Apr 01 21:12:13 2015 +0200
@@ -135,7 +135,8 @@
if (refresh_token && refresh_token.length) {
[self useRefreshToken:refresh_token];
- if ([self preferenceForKey:KEY_GTALK_CODE group:GROUP_ACCOUNT_STATUS]) {
+ if ([self preferenceForKey:KEY_GTALK_CODE group:GROUP_ACCOUNT_STATUS] || + [[self preferenceForKey:KEY_GTALK_UPGRADED_OAUTH2 group:GROUP_ACCOUNT_STATUS] boolValue]) { [self requestAccessToken];
[adium.interfaceController displayQuestion:AILocalizedString(@"Upgrade Google Talk account", nil)
@@ -220,6 +221,17 @@
AILogWithSignature(@"%@", responseDict);
+ if ([responseDict objectForKey:@"error"]) { + // Delete the refresh token, so we don't use it again. + [[AIKeychain defaultKeychain_error:NULL] deleteGenericPasswordForService:self.service.serviceID + [self setLastDisconnectionError:[NSString stringWithFormat:AILocalizedString(@"Retrieving OAuth token failed: %@", nil), [responseDict objectForKey:@"error_description"]]]; + [self serverReportedInvalidPassword]; NSString *jsonWebToken = [responseDict objectForKey:@"id_token"];
@@ -260,6 +272,9 @@
+ [self setPreference:nil forKey:KEY_GTALK_CODE group:GROUP_ACCOUNT_STATUS]; + [self setPreference:@(YES) forKey:KEY_GTALK_UPGRADED_OAUTH2 group:GROUP_ACCOUNT_STATUS]; if ([responseDict objectForKey:@"refresh_token"]) {
[[AIKeychain defaultKeychain_error:NULL] deleteGenericPasswordForService:self.service.serviceID
@@ -287,7 +302,6 @@
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
[self setLastDisconnectionError:[NSString stringWithFormat:AILocalizedString(@"OAuth authentication failed: %@", nil), error.description]];
- [self setValue:[NSNumber numberWithBool:YES] forProperty:@"isDisconnecting" notify:NotifyNow];
- (void)retrievePasswordThenConnect