--- a/Plugins/Twitter Plugin/AITwitterAccount.m Wed Mar 20 12:02:05 2013 -0400
+++ b/Plugins/Twitter Plugin/AITwitterAccount.m Thu Mar 21 00:01:23 2013 -0400
@@ -1,15 +1,15 @@
* Adium is the legal property of its developers, whose names are listed in the copyright file included
* with this source distribution.
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
* You should have received a copy of the GNU General Public License along with this program; if not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -80,7 +80,7 @@
[[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(chatDidOpen:)
+ selector:@selector(chatDidOpen:) @@ -94,15 +94,15 @@
/* 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"])
- forKey:KEY_CONNECT_HOST
+ 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
forGroup:GROUP_ACCOUNT_STATUS
[adium.preferenceController registerPreferenceObserver:self forGroup:TWITTER_PREFERENCE_GROUP_UPDATES];
@@ -158,7 +158,7 @@
NSDictionary *oauth = [self.passwordWhileConnected parametersDictionary];
NSString *oauthToken = [oauth objectForKey:@"oauth_token"];
NSString *oauthSecret = [oauth objectForKey:@"oauth_token_secret"];
@@ -170,9 +170,9 @@
AILogWithSignature(@"%@ connecting to %@", self, twitterEngine.userName);
- [twitterEngine verifyCredentialsWithSuccessBlock:^(id response) {
- if ([response isKindOfClass:[NSDictionary class]])
- [self userInfoReceived:(NSDictionary *)response forRequest:AITwitterValidateCredentials];
+ [twitterEngine getAccountVerifyCredentialsSkipStatus:YES + successBlock:^(NSDictionary *myInfo) { + [self userInfoReceived:myInfo forRequest:AITwitterValidateCredentials]; if ([[self preferenceForKey:TWITTER_PREFERENCE_LOAD_CONTACTS group:TWITTER_PREFERENCE_GROUP_UPDATES] boolValue]) {
// If we load our follows as contacts, do so now.
@@ -181,17 +181,17 @@
[self silenceAllContactUpdatesForInterval:18.0];
[twitterEngine getFriendsForScreenName:self.UID
- successBlock:^(NSArray *friends) {
- [self userInfoReceived:@{ @"friends" : friends } forRequest:AITwitterInitialUserInfo];
- if ([self boolValueForProperty:@"isConnecting"]) {
- // Trigger our normal update routine.
- } errorBlock:^(NSError *error) {
- [self setLastDisconnectionError:AILocalizedString(@"Unable to retrieve user list [fail]", "Message when a (vital) twitter request to retrieve the follow list fails")];
+ successBlock:^(NSArray *friends) { + [self userInfoReceived:@{ @"friends" : friends } forRequest:AITwitterInitialUserInfo]; + if ([self boolValueForProperty:@"isConnecting"]) { + // Trigger our normal update routine. + } errorBlock:^(NSError *error) { + [self setLastDisconnectionError:AILocalizedString(@"Unable to retrieve user list [fail]", "Message when a (vital) twitter request to retrieve the follow list fails")]; // If we don't load follows as contacts, we've finished connecting (fast, wasn't it?)
@@ -220,11 +220,11 @@
[timelineBookmark restoreGrouping];
AIChat *newTimelineChat = [adium.chatController chatWithName:self.timelineChatName
[newTimelineChat setDisplayName:self.timelineChatName];
@@ -345,7 +345,7 @@
* @brief Affirm we can open chats.
- (BOOL)openChat:(AIChat *)chat
[chat setValue:[NSNumber numberWithBool:YES] forProperty:@"accountJoined" notify:NotifyNow];
@@ -355,7 +355,7 @@
* @brief Allow all chats to close.
- (BOOL)closeChat:(AIChat *)inChat
@@ -363,7 +363,7 @@
* @brief Rejoin the requested chat.
- (BOOL)rejoinChat:(AIChat *)inChat
[self displayYouHaveConnectedInChat:inChat];
@@ -404,7 +404,7 @@
if(chat.isGroupChat && chat.account == self) {
[self updateTimelineChat:(AIGroupChat *)chat];
@@ -716,7 +716,7 @@
- (NSString *)tokenAccessURL
- return @"https://twitter.com/oauth/access_token";
+ return @"https://twitter.com/oauth/access_token"; @@ -772,7 +772,7 @@
[menuItem setRepresentedObject:inContact];
[menuItemArray addObject:menuItem];
@@ -849,7 +849,7 @@
[menuItem setImage:serviceIcon];
[menuItemArray addObject:menuItem];
@@ -883,7 +883,7 @@
[menuItemArray addObject:menuItem];
@@ -960,7 +960,7 @@
- (AIGroupChat *)timelineChat
AIGroupChat *timelineChat = [adium.chatController existingChatWithName:self.timelineChatName
timelineChat = [adium.chatController chatWithName:self.timelineChatName
@@ -969,20 +969,20 @@
* @brief Update the timeline chat
- (void)updateTimelineChat:(AIGroupChat *)timelineChat
// Disable the user list on the chat.
if (timelineChat.chatContainer.chatViewController.userListVisible) {
- [timelineChat.chatContainer.chatViewController toggleUserList];
+ [timelineChat.chatContainer.chatViewController toggleUserList]; // Update the participant list.
[timelineChat addParticipatingListObjects:self.contacts notify:NotifyNow];
@@ -1079,10 +1079,10 @@
if ([group.UID isEqualToString:self.timelineGroupName]) {
/* Hide the group by no longer loading Twitter contacts */
[self setPreference:[NSNumber numberWithBool:NO]
- forKey:TWITTER_PREFERENCE_LOAD_CONTACTS
+ forKey:TWITTER_PREFERENCE_LOAD_CONTACTS group:TWITTER_PREFERENCE_GROUP_UPDATES];
return AIAccountGroupDeletionShouldIgnoreContacts;
return AIAccountGroupDeletionShouldRemoveContacts;
@@ -1098,7 +1098,7 @@
AILogWithSignature(@"Not adding contact %@ to group %@, it's me!", contact.UID, group.UID);
AILogWithSignature(@"%@ Requesting follow for: %@", self, contact.UID);
[twitterEngine postFollow:contact.UID
successBlock:^(NSDictionary *friend) {
@@ -1161,11 +1161,11 @@
[self silenceAllContactUpdatesForInterval:18.0];
[twitterEngine getFriendsForScreenName:self.UID
- successBlock:^(NSArray *friends) {
- [self userInfoReceived:@{ @"friends" : friends } forRequest:AITwitterInitialUserInfo];
- } errorBlock:^(NSError *error) {
- [self requestFailed:AITwitterInitialUserInfo withError:error userInfo:nil];
+ successBlock:^(NSArray *friends) { + [self userInfoReceived:@{ @"friends" : friends } forRequest:AITwitterInitialUserInfo]; + } errorBlock:^(NSError *error) { + [self requestFailed:AITwitterInitialUserInfo withError:error userInfo:nil]; [[self timelineChat] removeAllParticipatingContactsSilently];
[self removeAllContacts];
@@ -1226,7 +1226,7 @@
[self requestFailed:AITwitterUpdateFollowedTimeline withError:error userInfo:nil];
- // Pull the replies feed
+ // Pull the replies feed lastID = [self preferenceForKey:TWITTER_PREFERENCE_REPLIES_LAST_ID
group:TWITTER_PREFERENCE_GROUP_UPDATES];
@@ -1262,7 +1262,7 @@
- // Not Found: either you're requesting an invalid URI or the resource in question doesn't exist (ex: no such user).
+ // Not Found: either you're requesting an invalid URI or the resource in question doesn't exist (ex: no such user). return AILocalizedString(@"Requested resource not found.", nil);
@@ -1308,9 +1308,9 @@
} else if (linkType == AITwitterLinkFriends) {
address = [NSString stringWithFormat:@"https://twitter.com/%@/friends", userID];
} else if (linkType == AITwitterLinkFollowers) {
- address = [NSString stringWithFormat:@"https://twitter.com/%@/followers", userID];
+ address = [NSString stringWithFormat:@"https://twitter.com/%@/followers", userID]; } else if (linkType == AITwitterLinkUserPage) {
- address = [NSString stringWithFormat:@"https://twitter.com/%@", userID];
+ address = [NSString stringWithFormat:@"https://twitter.com/%@", userID]; } else if (linkType == AITwitterLinkSearchHash) {
address = [NSString stringWithFormat:@"http://search.twitter.com/search?q=%%23%@", context];
} else if (linkType == AITwitterLinkReply) {
@@ -1322,7 +1322,7 @@
} else if (linkType == AITwitterLinkDestroyStatus) {
address = [NSString stringWithFormat:@"twitterreply://%@@%@?action=destroy&status=%@&message=%@", self.internalObjectID, userID, statusID, context];
} else if (linkType == AITwitterLinkDestroyDM) {
- address = [NSString stringWithFormat:@"twitterreply://%@@%@?action=destroy&dm=%@&message=%@", self.internalObjectID, userID, statusID, context];
+ address = [NSString stringWithFormat:@"twitterreply://%@@%@?action=destroy&dm=%@&message=%@", self.internalObjectID, userID, statusID, context]; } else if (linkType == AITwitterLinkQuote) {
address = [NSString stringWithFormat:@"twitterreply://%@@%@?action=quote&message=%@", self.internalObjectID, userID, context];
@@ -1481,7 +1481,7 @@
* @brief Parse an attributed string into a linkified version.
- (NSAttributedString *)linkifiedAttributedStringFromString:(NSAttributedString *)inString
NSAttributedString *attributedString;
static NSCharacterSet *usernameCharacters = nil;
@@ -1497,7 +1497,6 @@
[disallowedCharacters removeCharactersInString:@"_"];
hashCharacters = [disallowedCharacters invertedSet];
attributedString = [AITwitterURLParser linkifiedStringFromAttributedString:inString
@@ -1562,7 +1561,7 @@
linkDestination:linkAddress
linkClass:AITwitterInReplyToClassName]];
@@ -1590,7 +1589,7 @@
linkClass:AITwitterRetweetClassName]];
/* Next add the quote link */
[mutableMessage appendString:@", " withAttributes:nil];
@@ -1605,14 +1604,14 @@
[mutableMessage appendAttributedString:[self attributedStringWithLinkLabel:PILCROW_SIGN
linkDestination:linkAddress
- linkClass:AITwitterQuoteClassName]];
+ linkClass:AITwitterQuoteClassName]]; /* Now add the reply link */
[mutableMessage appendString:@", " withAttributes:nil];
linkAddress = [self addressForLinkType:AITwitterLinkReply
@@ -1727,7 +1726,7 @@
NSInteger queuedDMSort(id dm1, id dm2, void *context)
- return [[dm1 objectForKey:TWITTER_DM_CREATED] compare:[dm2 objectForKey:TWITTER_DM_CREATED]];
+ return [[dm1 objectForKey:TWITTER_DM_CREATED] compare:[dm2 objectForKey:TWITTER_DM_CREATED]]; @@ -2002,9 +2001,9 @@
case AITwitterFavoriteNo:
AIChat *timelineChat = self.timelineChat;
- [adium.contentController displayEvent:[NSString stringWithFormat:AILocalizedString(@"Attempt to favorite tweet failed. %@", nil), [self errorMessageForError:error]]
+ [adium.contentController displayEvent:[NSString stringWithFormat:AILocalizedString(@"Attempt to favorite tweet failed. %@", nil), [self errorMessageForError:error]] @@ -2124,7 +2123,7 @@
- (void)directMessagesReceived:(NSArray *)messages forRequest:(AITwitterRequestType)identifier
- if (identifier == AITwitterUpdateDirectMessage) {
+ if (identifier == AITwitterUpdateDirectMessage) { NSString *lastID = [self preferenceForKey:TWITTER_PREFERENCE_DM_LAST_ID
group:TWITTER_PREFERENCE_GROUP_UPDATES];
--- a/Plugins/Twitter Plugin/AITwitterAccountViewController.h Wed Mar 20 12:02:05 2013 -0400
+++ b/Plugins/Twitter Plugin/AITwitterAccountViewController.h Thu Mar 21 00:01:23 2013 -0400
@@ -1,15 +1,15 @@
* Adium is the legal property of its developers, whose names are listed in the copyright file included
* with this source distribution.
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
* You should have received a copy of the GNU General Public License along with this program; if not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -47,7 +47,7 @@
IBOutlet NSTextField *textField_url;
IBOutlet NSTextField *textField_location;
IBOutlet NSTextField *textField_description;
STTwitterOAuth *OAuthSetup;
--- a/Plugins/Twitter Plugin/AITwitterAccountViewController.m Wed Mar 20 12:02:05 2013 -0400
+++ b/Plugins/Twitter Plugin/AITwitterAccountViewController.m Thu Mar 21 00:01:23 2013 -0400
@@ -1,15 +1,15 @@
* Adium is the legal property of its developers, whose names are listed in the copyright file included
* with this source distribution.
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
* You should have received a copy of the GNU General Public License along with this program; if not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -59,7 +59,7 @@
representedObject:[NSNumber numberWithInt:2]];
[intervalMenu addItemWithTitle:AILocalizedString(@"every 5 minutes", "Update tweets: every 5 minutes")
@@ -192,7 +192,7 @@
withColor:[NSColor redColor]
buttonText:BUTTON_TEXT_ALLOW_ACCESS];
} else if (account.UID && [[adium.accountController passwordForAccount:account] length]) {
[self setStatusText:AILocalizedString(@"Adium currently has access to your account.", nil)
@@ -220,17 +220,17 @@
BOOL updateGlobal = [[account preferenceForKey:TWITTER_PREFERENCE_UPDATE_GLOBAL group:TWITTER_PREFERENCE_GROUP_UPDATES] boolValue];
[checkBox_updateGlobalStatus setState:updateGlobal];
BOOL updateGlobalIncludesReplies = [[account preferenceForKey:TWITTER_PREFERENCE_UPDATE_GLOBAL_REPLIES group:TWITTER_PREFERENCE_GROUP_UPDATES] boolValue];
[checkBox_updateGlobalIncludeReplies setState:updateGlobalIncludesReplies];
[checkBox_updateGlobalIncludeReplies setEnabled:[checkBox_updateGlobalStatus state]];
BOOL loadContacts = [[account preferenceForKey:TWITTER_PREFERENCE_LOAD_CONTACTS group:TWITTER_PREFERENCE_GROUP_UPDATES] boolValue];
[checkBox_loadContacts setState:loadContacts];
textField_name.stringValue = [account valueForProperty:@"Profile Name"] ?: @"";
textField_url.stringValue = [account valueForProperty:@"Profile URL"] ?: @"";
textField_location.stringValue = [account valueForProperty:@"Profile Location"] ?: @"";
@@ -290,7 +290,7 @@
textField_OAuthStatus.stringValue = text ?: @"";
textField_OAuthStatus.textColor = color ?: [NSColor controlTextColor];
[button_OAuthStart setEnabled:enabled];
--- a/Plugins/Twitter Plugin/STTwitter/STTwitterAPIWrapper.m Wed Mar 20 12:02:05 2013 -0400
+++ b/Plugins/Twitter Plugin/STTwitter/STTwitterAPIWrapper.m Thu Mar 21 00:01:23 2013 -0400
@@ -270,7 +270,7 @@
//Twitter returns an unauthenticated error if parameters is nil.
[_oauth postResource:resource parameters:@{ @"id" : statusID } successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -306,7 +306,7 @@
[_oauth postResource:@"statuses/update.json" parameters:md successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -339,7 +339,7 @@
[_oauth postResource:@"statuses/update_with_media.json" parameters:md successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -351,8 +351,8 @@
NSString *resource = [NSString stringWithFormat:@"statuses/retweet/%@.json", statusID];
- [_oauth postResource:resource parameters:nil successBlock:^(id response) {
- successBlock(response);
+ [_oauth postResource:resource parameters:@{@"id": statusID} successBlock:^(id response) { + successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -367,7 +367,7 @@
NSDictionary *d = @{@"q" : q};
[_oauth getResource:@"search/tweets.json" parameters:d successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -385,7 +385,7 @@
if (optionalCount != NSNotFound) [md setObject:[@(optionalCount) stringValue] forKey:@"count"];
[_oauth getResource:@"direct_messages.json" parameters:md successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -397,7 +397,7 @@
NSDictionary *d = @{@"id" : dmID};
[_oauth postResource:@"direct_messages/destroy.json" parameters:d successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -411,7 +411,7 @@
[md setObject:screenName forKey:@"screen_name"];
[_oauth postResource:@"direct_messages/new.json" parameters:md successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -435,7 +435,7 @@
if ([cursor isEqualToString:@"0"]) {
+ successBlock(removeNull(ids)); [_oauth getResource:resource parameters:d successBlock:requestHandler
@@ -464,7 +464,7 @@
NSDictionary *d = @{@"screen_name" : screenName};
[_oauth getResource:@"friendships/create.json" parameters:d successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -476,7 +476,7 @@
NSDictionary *d = @{@"screen_name" : screenName};
[_oauth getResource:@"friendships/destroy.json" parameters:d successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -490,7 +490,7 @@
d[@"device"] = notify ? @"true" : @"false";
[_oauth getResource:@"friendships/update.json" parameters:d successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -517,7 +517,7 @@
NSDictionary *d = @{@"skip_status" : (skipStatus ? @"true" : @"false")};
[_oauth getResource:@"account/verify_credentials.json" parameters:d successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -527,7 +527,7 @@
successBlock:(void(^)(NSDictionary *myInfo))successBlock
errorBlock:(void(^)(NSError *error))errorBlock {
[_oauth postResource:@"account/update_profile.json" parameters:profileData successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -540,7 +540,7 @@
[md setObject:@"image" forKey:@"postDataKey"];
[_oauth postResource:@"account/update_profile_image.json" parameters:md successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -552,7 +552,7 @@
NSDictionary *d = @{@"screen_name" : screenName};
[_oauth getResource:@"users/show.json" parameters:d successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -566,7 +566,7 @@
errorBlock:(void(^)(NSError *error))errorBlock {
[_oauth getResource:@"favorites/list.json" parameters:nil successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -584,7 +584,7 @@
NSDictionary *d = @{@"id" : statusID};
[_oauth postResource:resource parameters:d successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -610,7 +610,7 @@
NSArray *places = [response valueForKeyPath:@"result.places"];
+ successBlock(removeNull(places)); } errorBlock:^(NSError *error) {
@@ -629,7 +629,7 @@
NSArray *places = [response valueForKeyPath:@"result.places"];
+ successBlock(removeNull(places)); } errorBlock:^(NSError *error) {
@@ -647,7 +647,7 @@
NSArray *places = [response valueForKeyPath:@"result.places"];
+ successBlock(removeNull(places)); } errorBlock:^(NSError *error) {
@@ -665,7 +665,7 @@
NSArray *places = [response valueForKeyPath:@"result.places"];
+ successBlock(removeNull(places)); } errorBlock:^(NSError *error) {
@@ -691,7 +691,7 @@
[_oauth getResource:@"users/report_spam.json" parameters:d successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {
@@ -707,7 +707,7 @@
d = @{ @"resources" : [resources componentsJoinedByString:@","] };
[_oauth getResource:@"application/rate_limit_status.json" parameters:d successBlock:^(id response) {
- successBlock(response);
+ successBlock(removeNull(response)); } errorBlock:^(NSError *error) {