comparison libpurple/conversation.c @ 26803: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 15ae2dea92b3
children 2ab648c328cc 684690dbda4a b2b1fa27047a
comparison
equal deleted inserted replaced
26802:25e01fe7b732 26803:1ba4bbd3b0cd
1475 /* Don't display this if the person who wrote it is ignored. */ 1475 /* Don't display this if the person who wrote it is ignored. */
1476 if (purple_conv_chat_is_user_ignored(chat, who)) 1476 if (purple_conv_chat_is_user_ignored(chat, who))
1477 return; 1477 return;
1478 1478
1479 if (!(flags & PURPLE_MESSAGE_WHISPER)) { 1479 if (!(flags & PURPLE_MESSAGE_WHISPER)) {
1480 char *str; 1480 const char *str;
1481 1481
1482 str = g_strdup(purple_normalize(account, who)); 1482 str = purple_normalize(account, who);
1483 1483
1484 if (purple_strequal(str, purple_normalize(account, chat->nick))) { 1484 if (purple_strequal(str, chat->nick)) {
1485 flags |= PURPLE_MESSAGE_SEND; 1485 flags |= PURPLE_MESSAGE_SEND;
1486 } else { 1486 } else {
1487 flags |= PURPLE_MESSAGE_RECV; 1487 flags |= PURPLE_MESSAGE_RECV;
1488 1488
1489 if (purple_utf8_has_word(message, chat->nick)) 1489 if (purple_utf8_has_word(message, chat->nick))
1490 flags |= PURPLE_MESSAGE_NICK; 1490 flags |= PURPLE_MESSAGE_NICK;
1491 } 1491 }
1492
1493 g_free(str);
1494 } 1492 }
1495 1493
1496 /* Pass this on to either the ops structure or the default write func. */ 1494 /* Pass this on to either the ops structure or the default write func. */
1497 if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL) 1495 if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL)
1498 conv->ui_ops->write_chat(conv, who, message, flags, mtime); 1496 conv->ui_ops->write_chat(conv, who, message, flags, mtime);