get self name fixed

This commit is contained in:
Gordon Quad 2016-12-05 03:15:19 +00:00
parent f91b117996
commit 19d279faa8

View File

@ -383,7 +383,7 @@ twc_handle_group_message(Tox *tox,
group_number, group_number,
true); true);
char myname[TOX_MAX_NAME_LENGTH]; char *myname = twc_get_self_name_nt(profile->tox);
char *name = twc_get_peer_name_nt(profile->tox, group_number, peer_number); char *name = twc_get_peer_name_nt(profile->tox, group_number, peer_number);
char *tags = "notify_message"; char *tags = "notify_message";
char *message_nt = twc_null_terminate(message, length); char *message_nt = twc_null_terminate(message, length);
@ -394,15 +394,13 @@ twc_handle_group_message(Tox *tox,
else else
nick_color = weechat_info_get("nick_color", name); nick_color = weechat_info_get("nick_color", name);
tox_self_get_name(tox, (uint8_t *)myname); if (weechat_string_has_highlight(message_nt, myname))
myname[tox_self_get_name_size(tox)] = '\0';
if ((myname[0] != '\0') && weechat_string_has_highlight(message_nt, myname))
tags = "notify_highlight"; tags = "notify_highlight";
twc_chat_print_message(chat, tags, nick_color, name, twc_chat_print_message(chat, tags, nick_color, name,
message_nt, message_type); message_nt, message_type);
free(name); free(name);
free(myname);
free(message_nt); free(message_nt);
} }