highlight implemented

This commit is contained in:
Gordon Quad 2016-12-04 23:44:28 +00:00
parent 56c0c924ac
commit 043784e91d
3 changed files with 11 additions and 4 deletions

View File

@ -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);

View File

@ -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"));
}

View File

@ -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);