From 043784e91dba9eb92f650a9258c2ddab1da3f0ee Mon Sep 17 00:00:00 2001 From: Gordon Quad Date: Sun, 4 Dec 2016 23:44:28 +0000 Subject: [PATCH] highlight implemented --- src/twc-chat.c | 2 +- src/twc-message-queue.c | 2 +- src/twc-tox-callbacks.c | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/twc-chat.c b/src/twc-chat.c index 68a2d3b..f2df707 100644 --- a/src/twc-chat.c +++ b/src/twc-chat.c @@ -297,7 +297,7 @@ twc_chat_send_message(struct t_twc_chat *chat, const char *message, chat->friend_number, message, message_type); char *name = twc_get_self_name_nt(chat->profile->tox); - twc_chat_print_message(chat, "", + twc_chat_print_message(chat, "notify_message", weechat_color("chat_nick_self"), name, message, message_type); free(name); diff --git a/src/twc-message-queue.c b/src/twc-message-queue.c index e16a8ac..f822d44 100644 --- a/src/twc-message-queue.c +++ b/src/twc-message-queue.c @@ -154,7 +154,7 @@ twc_message_queue_flush_friend(struct t_twc_profile *profile, weechat_printf(friend_chat->buffer, "%s%sFailed to send message: %s%s", weechat_prefix("error"), - weechat_color("highlight"), + weechat_color("chat_highlight"), err_str, weechat_color("reset")); } diff --git a/src/twc-tox-callbacks.c b/src/twc-tox-callbacks.c index 4a555eb..4250e6a 100644 --- a/src/twc-tox-callbacks.c +++ b/src/twc-tox-callbacks.c @@ -71,7 +71,7 @@ twc_friend_message_callback(Tox *tox, uint32_t friend_number, char *name = twc_get_name_nt(profile->tox, friend_number); char *message_nt = twc_null_terminate(message, length); - twc_chat_print_message(chat, "", weechat_color("chat_nick_other"), name, + twc_chat_print_message(chat, "notify_private", weechat_color("chat_nick_other"), name, message_nt, type); free(name); @@ -321,7 +321,9 @@ twc_handle_group_message(Tox *tox, group_number, true); + char myname[TOX_MAX_NAME_LENGTH]; char *name = twc_get_peer_name_nt(profile->tox, group_number, peer_number); + char *tags = "notify_message"; char *message_nt = twc_null_terminate(message, length); const char *nick_color; @@ -330,7 +332,12 @@ twc_handle_group_message(Tox *tox, else nick_color = weechat_info_get("nick_color", name); - twc_chat_print_message(chat, "", nick_color, name, + tox_self_get_name(tox, (uint8_t *)myname); + myname[tox_self_get_name_size(tox)] = '\0'; + + if ((myname[0] != '\0') && weechat_string_has_highlight(message_nt, myname)) + tags = "notify_highlight"; + twc_chat_print_message(chat, tags, nick_color, name, message_nt, message_type); free(name);