From 42e955db8c97a414050b4055a860e0759291624e Mon Sep 17 00:00:00 2001 From: Spittie Date: Thu, 1 Aug 2013 06:32:54 +0200 Subject: Add nicknames to the chat list Change from [chat ] to [ ()] --- testing/toxic/chat.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'testing') diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c index dceb1d7b..854d3817 100644 --- a/testing/toxic/chat.c +++ b/testing/toxic/chat.c @@ -60,6 +60,8 @@ static void chat_onNickChange(ToxWindow* self, int num, uint8_t* nick, uint16_t nick[len-1] = '\0'; fix_name(nick); + snprintf(self->title, sizeof(self->title), "[%s (%d)]", nick, num); + wattron(ctx->history, COLOR_PAIR(3)); wprintw(ctx->history, " * Your partner changed nick to '%s'\n", nick); wattroff(ctx->history, COLOR_PAIR(3)); @@ -144,7 +146,11 @@ ToxWindow new_chat(int friendnum) { ret.onNickChange = &chat_onNickChange; ret.onStatusChange = &chat_onStatusChange; - snprintf(ret.title, sizeof(ret.title), "[chat %d]", friendnum); + uint8_t nick[MAX_NAME_LENGTH] = {0}; + getname(friendnum, (uint8_t*) &nick); + fix_name(nick); + + snprintf(ret.title, sizeof(ret.title), "[%s (%d)]", nick, friendnum); ChatContext* x = calloc(1, sizeof(ChatContext)); x->friendnum = friendnum; -- cgit v1.2.3