Add basic nick coloring functionality.
This commit is contained in:
parent
174f00eccd
commit
4aa054aada
@ -279,6 +279,7 @@ twc_chat_search_buffer(struct t_gui_buffer *buffer)
|
|||||||
void
|
void
|
||||||
twc_chat_print_message(struct t_twc_chat *chat,
|
twc_chat_print_message(struct t_twc_chat *chat,
|
||||||
const char *tags,
|
const char *tags,
|
||||||
|
const char *color,
|
||||||
const char *sender,
|
const char *sender,
|
||||||
const char *message,
|
const char *message,
|
||||||
enum TWC_MESSAGE_TYPE message_type)
|
enum TWC_MESSAGE_TYPE message_type)
|
||||||
@ -287,14 +288,16 @@ twc_chat_print_message(struct t_twc_chat *chat,
|
|||||||
{
|
{
|
||||||
case TWC_MESSAGE_TYPE_MESSAGE:
|
case TWC_MESSAGE_TYPE_MESSAGE:
|
||||||
weechat_printf_tags(chat->buffer, tags,
|
weechat_printf_tags(chat->buffer, tags,
|
||||||
"%s\t%s",
|
"%s%s%s\t%s",
|
||||||
sender, message);
|
color, sender,
|
||||||
|
weechat_color("reset"), message);
|
||||||
break;
|
break;
|
||||||
case TWC_MESSAGE_TYPE_ACTION:
|
case TWC_MESSAGE_TYPE_ACTION:
|
||||||
weechat_printf_tags(chat->buffer, tags,
|
weechat_printf_tags(chat->buffer, tags,
|
||||||
"%s%s %s",
|
"%s%s %s",
|
||||||
weechat_prefix("action"),
|
weechat_prefix("action"),
|
||||||
sender, message);
|
color, sender,
|
||||||
|
weechat_color("reset"), message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -312,7 +315,9 @@ twc_chat_send_message(struct t_twc_chat *chat, const char *message,
|
|||||||
chat->friend_number,
|
chat->friend_number,
|
||||||
message, message_type);
|
message, message_type);
|
||||||
char *name = twc_get_self_name_nt(chat->profile->tox);
|
char *name = twc_get_self_name_nt(chat->profile->tox);
|
||||||
twc_chat_print_message(chat, "", name, message, message_type);
|
twc_chat_print_message(chat, "",
|
||||||
|
weechat_color("chat_nick_self"), name,
|
||||||
|
message, message_type);
|
||||||
free(name);
|
free(name);
|
||||||
}
|
}
|
||||||
else if (chat->group_number >= 0)
|
else if (chat->group_number >= 0)
|
||||||
|
@ -61,6 +61,7 @@ twc_chat_search_buffer(struct t_gui_buffer *target_buffer);
|
|||||||
void
|
void
|
||||||
twc_chat_print_message(struct t_twc_chat *chat,
|
twc_chat_print_message(struct t_twc_chat *chat,
|
||||||
const char *tags,
|
const char *tags,
|
||||||
|
const char *color,
|
||||||
const char *sender,
|
const char *sender,
|
||||||
const char *message,
|
const char *message,
|
||||||
enum TWC_MESSAGE_TYPE message_type);
|
enum TWC_MESSAGE_TYPE message_type);
|
||||||
|
@ -67,7 +67,7 @@ twc_friend_message_callback(Tox *tox, uint32_t friend_number,
|
|||||||
char *name = twc_get_name_nt(profile->tox, friend_number);
|
char *name = twc_get_name_nt(profile->tox, friend_number);
|
||||||
char *message_nt = twc_null_terminate(message, length);
|
char *message_nt = twc_null_terminate(message, length);
|
||||||
|
|
||||||
twc_chat_print_message(chat, "", name,
|
twc_chat_print_message(chat, "", weechat_color("chat_nick_other"), name,
|
||||||
message_nt, type);
|
message_nt, type);
|
||||||
|
|
||||||
free(name);
|
free(name);
|
||||||
@ -256,7 +256,13 @@ twc_handle_group_message(Tox *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 *message_nt = twc_null_terminate(message, length);
|
char *message_nt = twc_null_terminate(message, length);
|
||||||
|
|
||||||
twc_chat_print_message(chat, "", name,
|
const char *nick_color;
|
||||||
|
if (tox_group_peernumber_is_ours(tox, group_number, peer_number))
|
||||||
|
nick_color = weechat_color("chat_nick_self");
|
||||||
|
else
|
||||||
|
nick_color = weechat_info_get("nick_color", name);
|
||||||
|
|
||||||
|
twc_chat_print_message(chat, "", nick_color, name,
|
||||||
message_nt, message_type);
|
message_nt, message_type);
|
||||||
|
|
||||||
free(name);
|
free(name);
|
||||||
|
Loading…
Reference in New Issue
Block a user