adium 5415:ca83a87cff60: Stupid me stupidly thought the computer...
commits at adium.im
commits at adium.im
Sun Mar 24 03:01:12 UTC 2013
details: http://hg.adium.im/adium/rev/ca83a87cff60
revision: 5415:ca83a87cff60
branch: adium-1.6
author: Frank Dowsett <wixardy at adium.im>
date: Sat Mar 23 23:00:38 2013 -0400
Stupid me stupidly thought the computers would do what I was thinking for me.
diffs (69 lines):
diff -r 7d45cfb6ae92 -r ca83a87cff60 Plugins/Twitter Plugin/AITwitterAccount.m
--- a/Plugins/Twitter Plugin/AITwitterAccount.m Sat Mar 23 22:15:45 2013 -0400
+++ b/Plugins/Twitter Plugin/AITwitterAccount.m Sat Mar 23 23:00:38 2013 -0400
@@ -47,7 +47,7 @@
userID:(NSString *)userID
inReplyToUser:(NSString *)replyUserID
inReplyToTweetID:(NSString *)replyTweetID;
-- (NSAttributedString *)parseDirectMessage:(NSString *)inMessage
+- (NSAttributedString *)parseDirectMessage:(NSDictionary *)inMessage
withID:(NSString *)dmID
fromUser:(NSString *)sourceUID;
- (NSAttributedString *)attributedStringWithLinkLabel:(NSString *)label
@@ -1710,15 +1710,16 @@
/*!
* @brief Parse a direct message
*/
-- (NSAttributedString *)parseDirectMessage:(NSString *)inMessage
+- (NSAttributedString *)parseDirectMessage:(NSDictionary *)inMessage
withID:(NSString *)dmID
fromUser:(NSString *)sourceUID
{
- NSAttributedString *message;
+ NSString *message = [[inMessage objectForKey:TWITTER_DM_TEXT] stringByUnescapingFromXMLWithEntities:nil];
+ NSMutableAttributedString *mutableMessage = [[NSMutableAttributedString alloc] initWithString:message];
- message = [NSAttributedString stringWithString:[inMessage stringByUnescapingFromXMLWithEntities:nil]];
-
- NSMutableAttributedString *mutableMessage = [[message mutableCopy] autorelease];
+ NSDictionary *entities = [inMessage objectForKey:@"entities"];
+ NSArray *hashtags = [entities objectForKey:@"hashtags"];
+ NSArray *users = [entities objectForKey:@"user_mentions"];
[self linkifyEntities:users inString:&mutableMessage forLinkType:AITwitterLinkUserPage];
[self linkifyEntities:hashtags inString:&mutableMessage forLinkType:AITwitterLinkSearchHash];
@@ -1729,7 +1730,7 @@
NSString *linkAddress = [self addressForLinkType:AITwitterLinkDestroyDM
userID:sourceUID
statusID:dmID
- context:[inMessage stringByAddingPercentEscapesForAllCharacters]];
+ context:[message stringByAddingPercentEscapesForAllCharacters]];
[mutableMessage appendAttributedString:[self attributedStringWithLinkLabel:@"\u232B"
linkDestination:linkAddress
@@ -1742,7 +1743,7 @@
[NSNumber numberWithBool:YES], AIHiddenMessagePartAttributeName, nil]
range:NSMakeRange(startIndex, mutableMessage.length - startIndex)];
- return mutableMessage;
+ return [mutableMessage autorelease];
}
@@ -1871,7 +1872,6 @@
for (NSDictionary *message in sortedQueuedDM) {
NSDate *date = [NSDate dateWithNaturalLanguageString:[message objectForKey:TWITTER_DM_CREATED]];
- NSString *text = [message objectForKey:TWITTER_DM_TEXT];
NSString *fromUID = [message objectForKey:TWITTER_DM_SENDER_UID];
NSString *toUID = [message objectForKey:TWITTER_DM_RECIPIENT_UID];
@@ -1894,7 +1894,7 @@
withSource:source
destination:destination
date:date
- message:[self parseDirectMessage:text
+ message:[self parseDirectMessage:message
withID:[message objectForKey:TWITTER_DM_ID]
fromUser:chat.listObject.UID]
autoreply:NO];
More information about the commits
mailing list