1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-23 07:53:24 +01:00

Add nicknames to the chat list

Change from [chat <number>] to [<nickname> (<number>)]
This commit is contained in:
Spittie 2013-08-01 06:32:54 +02:00
parent 2f302b36e0
commit f5ec15f11c

8
chat.c
View File

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