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 c3b5fe3fa1
commit 42e955db8c

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;