[Adium-commits] adium 2053:af23cf77fb85: Try to work around iconv some more

adium-commits at adiumx.com adium-commits at adiumx.com
Fri May 1 17:50:46 UTC 2009


details:	http://hg.adiumx.com/adium/rev/af23cf77fb85
revision:	2053:af23cf77fb85
author:		David Smith <catfish.man at gmail.com>
date:		Fri May 01 10:50:00 2009 -0700

Try to work around iconv some more
Subject: adium 2054:00b4e5f2a859: Automated merge with ssh://hg@hg.adiumx.com/adium

details:	http://hg.adiumx.com/adium/rev/00b4e5f2a859
revision:	2054:00b4e5f2a859
author:		David Smith <catfish.man at gmail.com>
date:		Fri May 01 10:50:37 2009 -0700

Automated merge with ssh://hg@hg.adiumx.com/adium

diffstat:

 Plugins/Purple Service/adiumPurpleConversation.h         |   1 +
 Plugins/Purple Service/adiumPurpleConversation.m         |  10 +++-
 Plugins/Twitter Plugin/AITwitterAccount.m                |   6 ++-
 Plugins/Twitter Plugin/AITwitterURLHandler.m             |  38 ++++++-------------
 Utilities/dep-build-scripts/general_dependencies_make.sh |   5 +-
 5 files changed, 28 insertions(+), 32 deletions(-)

diffs (150 lines):

diff -r 86ee99ab9534 -r 00b4e5f2a859 Plugins/Purple Service/adiumPurpleConversation.h
--- a/Plugins/Purple Service/adiumPurpleConversation.h	Thu Apr 30 22:25:45 2009 -0700
+++ b/Plugins/Purple Service/adiumPurpleConversation.h	Fri May 01 10:50:37 2009 -0700
@@ -18,3 +18,4 @@
 
 PurpleConversationUiOps *adium_purple_conversation_get_ui_ops(void);
 void adiumPurpleConversation_init(void);
+NSString *get_real_name_for_account_conv_buddy(PurpleAccount *account, PurpleConversation *conv, char *who);
diff -r 86ee99ab9534 -r 00b4e5f2a859 Plugins/Purple Service/adiumPurpleConversation.m
--- a/Plugins/Purple Service/adiumPurpleConversation.m	Thu Apr 30 22:25:45 2009 -0700
+++ b/Plugins/Purple Service/adiumPurpleConversation.m	Fri May 01 10:50:37 2009 -0700
@@ -77,9 +77,10 @@
 			  messageString);
 
 		NSDate				*date = [NSDate dateWithTimeIntervalSince1970:mtime];
+		PurpleAccount		*purpleAccount = purple_conversation_get_account(conv);
 		
 		if ((flags & PURPLE_MESSAGE_SYSTEM) == PURPLE_MESSAGE_SYSTEM || !who) {
-			CBPurpleAccount *account = accountLookup(purple_conversation_get_account(conv));
+			CBPurpleAccount *account = accountLookup(purpleAccount);
 			
 			[account receivedEventForChat:groupChatLookupFromConv(conv)
 								  message:messageString
@@ -88,10 +89,11 @@
 		} else {
 			NSAttributedString	*attributedMessage = [AIHTMLDecoder decodeHTML:messageString];
 			NSNumber			*purpleMessageFlags = [NSNumber numberWithInt:flags];
+			NSString			*normalizedUID = get_real_name_for_account_conv_buddy(purpleAccount, conv, (char *)who);
 			
-			if (who && strlen(who)) {
+			if (normalizedUID.length) {
 				messageDict = [NSDictionary dictionaryWithObjectsAndKeys:attributedMessage, @"AttributedMessage",
-							   [NSString stringWithUTF8String:who], @"Source",
+							   normalizedUID, @"Source",
 							   purpleMessageFlags, @"PurpleMessageFlags",
 							   date, @"Date",nil];
 				
@@ -272,6 +274,8 @@
 
 NSString *get_real_name_for_account_conv_buddy(PurpleAccount *account, PurpleConversation *conv, char *who)
 {
+	g_return_val_if_fail(who != NULL && strlen(who), nil);
+	
 	PurplePlugin *prpl = purple_find_prpl(purple_account_get_protocol_id(account));
 	PurplePluginProtocolInfo  *prpl_info = (prpl ? PURPLE_PLUGIN_PROTOCOL_INFO(prpl) : NULL);
 	PurpleConvChat *convChat = purple_conversation_get_chat_data(conv);
diff -r 86ee99ab9534 -r 00b4e5f2a859 Plugins/Twitter Plugin/AITwitterAccount.m
--- a/Plugins/Twitter Plugin/AITwitterAccount.m	Thu Apr 30 22:25:45 2009 -0700
+++ b/Plugins/Twitter Plugin/AITwitterAccount.m	Fri May 01 10:50:37 2009 -0700
@@ -1331,7 +1331,7 @@
 				[mutableMessage setAttributes:[NSDictionary dictionaryWithObjectsAndKeys:linkAddress, NSLinkAttributeName, nil]
 										range:NSMakeRange(0, replyUserID.length + 1)];
 			} else {
-				// This probably shouldn't happen, but in case it does, we're set as in_reply_to_status_id a non-reply. link it at the ned.
+				// This happens for mentions which are in_reply_to_status_id but the @target isn't the first part of the message.
 				
 				[mutableMessage appendAttributedString:[NSAttributedString attributedStringWithLinkLabel:AILocalizedString(@"IRT", "An abbreviation for 'in reply to' - placed at the beginning of the tweet tools for those which are directly in reply to another")
 																						 linkDestination:linkAddress]];
@@ -1373,6 +1373,10 @@
 				[mutableMessage appendAttributedString:[NSAttributedString attributedStringWithLinkLabel:@"@"
 																						 linkDestination:linkAddress]];
 			} else {
+				if(commaNeeded) {
+					[mutableMessage appendString:@", " withAttributes:nil];
+				}
+				
 				// Our own message. Display a destroy link.
 				linkAddress = [self addressForLinkType:AITwitterLinkDestroyStatus
 												userID:userID
diff -r 86ee99ab9534 -r 00b4e5f2a859 Plugins/Twitter Plugin/AITwitterURLHandler.m
--- a/Plugins/Twitter Plugin/AITwitterURLHandler.m	Thu Apr 30 22:25:45 2009 -0700
+++ b/Plugins/Twitter Plugin/AITwitterURLHandler.m	Fri May 01 10:50:37 2009 -0700
@@ -140,17 +140,15 @@
 		// Make the text view have focus
 		[[adium.interfaceController windowForChat:timelineChat] makeFirstResponder:textView];
 		
-		if([inAction isEqualToString:@"reply"]) {
-			[timelineChat setValue:inTweet forProperty:@"TweetInReplyToStatusID" notify:NotifyNow];
-			[timelineChat setValue:inUser forProperty:@"TweetInReplyToUserID" notify:NotifyNow];
-			[timelineChat setValue:@"@" forProperty:@"Character Counter Prefix" notify:NotifyNow];
-			
-			AILogWithSignature(@"Flagging chat %@ to in_reply_to_status_id = %@", timelineChat, inTweet);
-			
-			[[NSNotificationCenter defaultCenter] removeObserver:self name:NSTextDidChangeNotification object:textView];
-			
-			[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textDidChange:) name:NSTextDidChangeNotification object:textView];
-		}
+		[timelineChat setValue:inTweet forProperty:@"TweetInReplyToStatusID" notify:NotifyNow];
+		[timelineChat setValue:inUser forProperty:@"TweetInReplyToUserID" notify:NotifyNow];
+		[timelineChat setValue:@"@" forProperty:@"Character Counter Prefix" notify:NotifyNow];
+		
+		AILogWithSignature(@"Flagging chat %@ to in_reply_to_status_id = %@", timelineChat, inTweet);
+		
+		[[NSNotificationCenter defaultCenter] removeObserver:self name:NSTextDidChangeNotification object:textView];
+		
+		[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textDidChange:) name:NSTextDidChangeNotification object:textView];
 	} else if ([inAction isEqualToString:@"favorite"]) {
 		[account toggleFavoriteTweet:inTweet];
 	} else if ([inAction isEqualToString:@"destroy"] && exactMatchForInternalID) {
@@ -179,7 +177,6 @@
 	AIMessageEntryTextView *textView = [notification object];
 
 	AIChat *chat = textView.chat;
-	AIAccount *account = chat.account;
 	
 	if(![chat valueForProperty:@"TweetInReplyToStatusID"] || ![chat valueForProperty:@"TweetInReplyToUserID"]) {
 		[[NSNotificationCenter defaultCenter] removeObserver:self name:NSTextDidChangeNotification object:textView];
@@ -189,20 +186,9 @@
 	NSString *contents = [textView string];
 	BOOL keepTweetValues = YES;
 	
-	if([contents hasPrefix:@"@"]) {
-		NSString *replyUsername = [contents substringFromIndex:1];
-		NSRange usernameRange = [replyUsername rangeOfCharacterFromSet:[account.service.allowedCharacters invertedSet]];
-		
-		if(usernameRange.location == NSNotFound) {
-			usernameRange = NSMakeRange([replyUsername length], 0);
-		}
-		
-		replyUsername = [replyUsername substringToIndex:usernameRange.location];
-		
-		if (![replyUsername isEqualToString:[chat valueForProperty:@"TweetInReplyToUserID"]]) {
-			keepTweetValues = NO;
-		}
-	} else {
+	NSRange usernameRange = [contents rangeOfString:[NSString stringWithFormat:@"@%@", [chat valueForProperty:@"TweetInReplyToUserID"]]];
+	
+	if (usernameRange.location == NSNotFound) {
 		keepTweetValues = NO;
 	}
 	
diff -r 86ee99ab9534 -r 00b4e5f2a859 Utilities/dep-build-scripts/general_dependencies_make.sh
--- a/Utilities/dep-build-scripts/general_dependencies_make.sh	Thu Apr 30 22:25:45 2009 -0700
+++ b/Utilities/dep-build-scripts/general_dependencies_make.sh	Fri May 01 10:50:37 2009 -0700
@@ -77,12 +77,13 @@
 	LOCAL_BIN_DIR="$TARGET_DIR_BASE-$ARCH/bin"
 	LOCAL_LIB_DIR="$TARGET_DIR_BASE-$ARCH/lib"
 	LOCAL_INCLUDE_DIR="$TARGET_DIR_BASE-$ARCH/include"
-	LOCAL_FLAGS="-L$LOCAL_LIB_DIR -I$LOCAL_INCLUDE_DIR -lintl"
+	LOCAL_FLAGS="-L$LOCAL_LIB_DIR -I$LOCAL_INCLUDE_DIR -lintl -liconv"
 	
 	export PKG_CONFIG="$LOCAL_BIN_DIR/pkg-config"
 	export MSGFMT="$LOCAL_BIN_DIR/msgfmt"
 	
-	export CFLAGS="$LOCAL_FLAGS $BASE_CFLAGS -arch $ARCH"
+	#Defining USE_LIBICONV_GNU here is a hack to avoid what *appears* to be a mistaken #error in gconvert.c
+	export CFLAGS="$LOCAL_FLAGS $BASE_CFLAGS -arch $ARCH -DUSE_LIBICONV_GNU"
 	export CPPFLAGS="$CFLAGS"
 	export LDFLAGS="$LOCAL_FLAGS $BASE_LDFLAGS -arch $ARCH"
 	




More information about the commits mailing list