[Adium-commits] adium 2050:0da4ed51dce3: Normalize the UID (possibly getting the...

adium-commits at adiumx.com adium-commits at adiumx.com
Fri May 1 16:19:12 UTC 2009


details:	http://hg.adiumx.com/adium/rev/0da4ed51dce3
revision:	2050:0da4ed51dce3
author:		Zachary West <zacw at adiumx.com>
date:		Fri May 01 12:19:03 2009 -0400

Normalize the UID (possibly getting their real UID) when receiving a message from a group chat participant. Fixes #11416.

diffstat:

 Plugins/Purple Service/adiumPurpleConversation.h |   1 +
 Plugins/Purple Service/adiumPurpleConversation.m |  10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r 86ee99ab9534 -r 0da4ed51dce3 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 12:19:03 2009 -0400
@@ -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 0da4ed51dce3 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 12:19:03 2009 -0400
@@ -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);




More information about the commits mailing list