--- a/Plugins/Twitter Plugin/AITwitterAccount.m Thu May 23 11:19:50 2013 -0400
+++ b/Plugins/Twitter Plugin/AITwitterAccount.m Thu May 23 11:28:15 2013 -0400
@@ -1060,6 +1060,25 @@
+ * @brief Update the display name, icon, and status of the list contact. +- (void)updateContact:(AIListContact *)listContact withInfo:(NSDictionary *)userInfo andStatusMessage:(NSAttributedString *)message + // Grab the Twitter display name and set it as the remote alias. + NSString *displayName = [userInfo objectForKey:TWITTER_INFO_DISPLAY_NAME]; + if (![[listContact valueForProperty:@"serverDisplayName"] isEqualToString:displayName]) { + [listContact setServersideAlias:displayName + silently:silentAndDelayed]; + // Update the user's status message + [listContact setStatusMessage:message + [self updateUserIcon:[userInfo objectForKey:TWITTER_INFO_ICON] forContact:listContact]; * @brief Unfollow the requested contacts.
- (void)removeContacts:(NSArray *)objects fromGroups:(NSArray *)groups
@@ -1527,19 +1546,8 @@
inReplyToUser:(NSString *)replyUserID
inReplyToTweetID:(NSString *)replyTweetID
- NSMutableAttributedString *mutableMessage;
- NSDictionary *retweet = [inStatus objectForKey:TWITTER_STATUS_RETWEET];
- if (retweet && [retweet isKindOfClass:[NSDictionary class]]) {
- NSString *text = [[retweet objectForKey:TWITTER_STATUS_TEXT] stringByUnescapingFromXMLWithEntities:nil];
- mutableMessage = [[NSMutableAttributedString alloc] initWithString:text];
- [mutableMessage replaceCharactersInRange:NSMakeRange(0, 0)
- withString:[NSString stringWithFormat:@"RT @%@: ",
- [[retweet objectForKey:TWITTER_STATUS_USER] objectForKey:TWITTER_STATUS_UID]]];
- NSString *text = [[inStatus objectForKey:TWITTER_STATUS_TEXT] stringByUnescapingFromXMLWithEntities:nil];
- mutableMessage = [[NSMutableAttributedString alloc] initWithString:text];
+ NSString *text = [[inStatus objectForKey:TWITTER_STATUS_TEXT] stringByUnescapingFromXMLWithEntities:nil]; + NSMutableAttributedString *mutableMessage = [[NSMutableAttributedString alloc] initWithString:text]; //Extract hashtags, users, and URLs
NSDictionary *entities = [inStatus objectForKey:@"entities"];
@@ -1824,6 +1832,15 @@
[[AIContactObserverManager sharedManager] delayListObjectNotifications];
for (NSDictionary *status in sortedQueuedUpdates) {
+ NSDate *date = [status objectForKey:TWITTER_STATUS_CREATED]; + NSDictionary *retweet = [status objectForKey:TWITTER_STATUS_RETWEET]; + NSString *retweeter = nil; + if (retweet && [retweet isKindOfClass:[NSDictionary class]]) { + retweeter = [[status objectForKey:TWITTER_STATUS_USER] objectForKey:TWITTER_STATUS_UID]; NSString *contactUID = [[status objectForKey:TWITTER_STATUS_USER] objectForKey:TWITTER_STATUS_UID];
NSAttributedString *message = [self parseStatus:status
tweetID:[status objectForKey:TWITTER_STATUS_ID]
@@ -1831,18 +1848,26 @@
inReplyToUser:[status objectForKey:TWITTER_STATUS_REPLY_UID]
inReplyToTweetID:[status objectForKey:TWITTER_STATUS_REPLY_ID]];
- NSDate *date = [status objectForKey:TWITTER_STATUS_CREATED];
+ //Add a link to the retweeter + NSMutableAttributedString *m = [[message mutableCopy] autorelease]; + NSString *linkURL = [self addressForLinkType:AITwitterLinkUserPage + NSAttributedString *rt = [NSAttributedString attributedStringWithString:[NSString stringWithFormat:@" [@%@]", retweeter] + linkRange:NSMakeRange(2, retweeter.length+1) + linkDestination:linkURL]; + [m appendAttributedString:rt]; AIListObject *fromObject = nil;
if (![self.UID isCaseInsensitivelyEqualToString:contactUID]) {
AIListContact *listContact = [self contactWithUID:contactUID];
- // Update the user's status message
- [listContact setStatusMessage:message
- [self updateUserIcon:[[status objectForKey:TWITTER_STATUS_USER] objectForKey:TWITTER_INFO_ICON] forContact:listContact];
+ [self updateContact:listContact withInfo:[status objectForKey:TWITTER_STATUS_USER] andStatusMessage:message]; [timelineChat addParticipatingNick:listContact.UID notify:NotifyNow];
[timelineChat setContact:listContact forNick:listContact.UID];
@@ -2213,26 +2238,17 @@
[listContact addRemoteGroupName:self.timelineGroupName];
- // Grab the Twitter display name and set it as the remote alias.
- if (![[listContact valueForProperty:@"serverDisplayName"] isEqualToString:[user objectForKey:TWITTER_INFO_DISPLAY_NAME]]) {
- [listContact setServersideAlias:[user objectForKey:TWITTER_INFO_DISPLAY_NAME]
- silently:silentAndDelayed];
- // Grab the user icon and set it as their serverside icon.
- [self updateUserIcon:[user objectForKey:TWITTER_INFO_ICON] forContact:listContact];
+ // Set the user's status message to their current twitter status text + NSString *statusText = [[user objectForKey:TWITTER_INFO_STATUS] objectForKey:TWITTER_INFO_STATUS_TEXT] ?: @""; + [self updateContact:listContact + andStatusMessage:[NSAttributedString stringWithString:[statusText stringByUnescapingFromXMLWithEntities:nil]]]; // Set the user as available.
[listContact setStatusWithName:nil
statusType:AIAvailableStatusType
- // Set the user's status message to their current twitter status text
- NSString *statusText = [[user objectForKey:TWITTER_INFO_STATUS] objectForKey:TWITTER_INFO_STATUS_TEXT];
- if (!statusText) //nil if they've never tweeted
- [listContact setStatusMessage:[NSAttributedString stringWithString:[statusText stringByUnescapingFromXMLWithEntities:nil]] notify:NotifyLater];
// Set the user as online.
[listContact setOnline:YES notify:NotifyLater silently:silentAndDelayed];