pidgin: ec236422: Chat's nick is normalized. So normalize ...

sadrul at pidgin.im sadrul at pidgin.im
Mon Apr 27 23:46:08 EDT 2009


-----------------------------------------------------------------
Revision: ec23642271e644f846d1ec0e1912fd3a9d38a688
Ancestor: 57f4985cff937a1ddd754153bbd9d5f3a34d1cc0
Author: sadrul at pidgin.im
Date: 2009-04-28T03:44:26
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ec23642271e644f846d1ec0e1912fd3a9d38a688

Modified files:
        libpurple/conversation.c libpurple/server.c

ChangeLog: 

Chat's nick is normalized. So normalize before comparing with it.
Also, remove an extra normalization operation.

-------------- next part --------------
============================================================
--- libpurple/conversation.c	c8939bf9bab76a2b6347ec1b830877faa7461389
+++ libpurple/conversation.c	991af181d5a5ff81ebcf53ba6bce73a9393bda8a
@@ -1477,11 +1477,11 @@ purple_conv_chat_write(PurpleConvChat *c
 		return;
 
 	if (!(flags & PURPLE_MESSAGE_WHISPER)) {
-		char *str;
+		const char *str;
 
-		str = g_strdup(purple_normalize(account, who));
+		str = purple_normalize(account, who);
 
-		if (purple_strequal(str, purple_normalize(account, chat->nick))) {
+		if (purple_strequal(str, chat->nick)) {
 			flags |= PURPLE_MESSAGE_SEND;
 		} else {
 			flags |= PURPLE_MESSAGE_RECV;
@@ -1489,8 +1489,6 @@ purple_conv_chat_write(PurpleConvChat *c
 			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. */
============================================================
--- libpurple/server.c	d73a293e8c6a272b342499f8f2160f4f49eb2b97
+++ libpurple/server.c	8db23c2e4802ffcf38b78f053e30960dcb90aa79
@@ -940,7 +940,8 @@ void serv_got_chat_in(PurpleConnection *
 		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 {


More information about the Commits mailing list