Mercurial > pidgin.yaz
changeset 6060:6b4a12cd4caf
[gaim-migrate @ 6510]
a better fix for things that don't set the display_name for a GaimConnection
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 08 Jul 2003 04:05:02 +0000 |
parents | d8cd876e613e |
children | c28dea25983c |
files | src/conversation.c |
diffstat | 1 files changed, 28 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/conversation.c Tue Jul 08 03:36:41 2003 +0000 +++ b/src/conversation.c Tue Jul 08 04:05:02 2003 +0000 @@ -82,6 +82,7 @@ { GaimAccount *account; char *msg, *who, *p; + const char *disp; int n; account = gaim_connection_get_account(gc); @@ -102,26 +103,31 @@ g_free(who); - if (!gaim_utf8_strcasecmp(gaim_account_get_username(account), - gaim_connection_get_display_name(gc))) { - g_free(msg); - - return FALSE; + disp = gaim_connection_get_display_name(gc); + + + if(disp) { + if (!gaim_utf8_strcasecmp(gaim_account_get_username(account), disp)) { + g_free(msg); + + return FALSE; + } + + who = g_utf8_strdown(disp, -1); + n = who ? strlen(who) : 0; + + if (n > 0 && (p = strstr(msg, who)) != NULL) { + if ((p == msg || !isalnum(*(p - 1))) && !isalnum(*(p + n))) { + g_free(who); + g_free(msg); + + return TRUE; + } + } + + g_free(who); } - who = g_utf8_strdown(gaim_connection_get_display_name(gc), -1); - n = who ? strlen(who) : 0; - - if (n > 0 && (p = strstr(msg, who)) != NULL) { - if ((p == msg || !isalnum(*(p - 1))) && !isalnum(*(p + n))) { - g_free(who); - g_free(msg); - - return TRUE; - } - } - - g_free(who); g_free(msg); return FALSE; @@ -1855,11 +1861,13 @@ if (!(flags & WFLAG_WHISPER)) { char *str; + const char *disp; str = g_strdup(normalize(who)); + disp = gaim_connection_get_display_name(gc); if (!gaim_utf8_strcasecmp(str, normalize(gaim_account_get_username(account))) || - !gaim_utf8_strcasecmp(str, normalize(gaim_connection_get_display_name(gc)))) { + (disp && !gaim_utf8_strcasecmp(str, normalize(disp)))) { flags |= WFLAG_SEND; } @@ -1869,7 +1877,7 @@ if (find_nick(gc, message)) flags |= WFLAG_NICK; } - + g_free(str); }