changeset 26721:1ba4bbd3b0cd

Chat's nick is normalized. So normalize before comparing with it. Also, remove an extra normalization operation.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 28 Apr 2009 03:44:26 +0000
parents 25e01fe7b732
children e3a42d2e639f
files libpurple/conversation.c libpurple/server.c
diffstat 2 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/conversation.c	Mon Apr 27 17:49:36 2009 +0000
+++ b/libpurple/conversation.c	Tue Apr 28 03:44:26 2009 +0000
@@ -1477,11 +1477,11 @@
 		return;
 
 	if (!(flags & PURPLE_MESSAGE_WHISPER)) {
-		char *str;
-
-		str = g_strdup(purple_normalize(account, who));
-
-		if (purple_strequal(str, purple_normalize(account, chat->nick))) {
+		const char *str;
+
+		str = purple_normalize(account, who);
+
+		if (purple_strequal(str, chat->nick)) {
 			flags |= PURPLE_MESSAGE_SEND;
 		} else {
 			flags |= PURPLE_MESSAGE_RECV;
@@ -1489,8 +1489,6 @@
 			if (purple_utf8_has_word(message, chat->nick))
 				flags |= PURPLE_MESSAGE_NICK;
 		}
-
-		g_free(str);
 	}
 
 	/* Pass this on to either the ops structure or the default write func. */
--- a/libpurple/server.c	Mon Apr 27 17:49:36 2009 +0000
+++ b/libpurple/server.c	Tue Apr 28 03:44:26 2009 +0000
@@ -940,7 +940,8 @@
 		return;
 
 	/* Did I send the message? */
-	if (purple_strequal(purple_conv_chat_get_nick(chat), who)) {
+	if (purple_strequal(purple_conv_chat_get_nick(chat),
+				purple_normalize(purple_conversation_get_account(conv), who))) {
 		flags |= PURPLE_MESSAGE_SEND;
 		flags &= ~PURPLE_MESSAGE_RECV; /* Just in case some prpl sets it! */
 	} else {