diff options
author | Spittie <spittiepie@gmail.com> | 2013-08-01 06:32:54 +0200 |
---|---|---|
committer | Spittie <spittiepie@gmail.com> | 2013-08-01 06:32:54 +0200 |
commit | 42e955db8c97a414050b4055a860e0759291624e (patch) | |
tree | 6486a94b29b531b2b248ad849a9805254840b845 /testing/toxic | |
parent | c3b5fe3fa154e60d46d647f7928cab48ec4012a0 (diff) |
Add nicknames to the chat list
Change from [chat <number>] to [<nickname> (<number>)]
Diffstat (limited to 'testing/toxic')
-rw-r--r-- | testing/toxic/chat.c | 8 |
1 files changed, 7 insertions, 1 deletions
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 | |||
60 | nick[len-1] = '\0'; | 60 | nick[len-1] = '\0'; |
61 | fix_name(nick); | 61 | fix_name(nick); |
62 | 62 | ||
63 | snprintf(self->title, sizeof(self->title), "[%s (%d)]", nick, num); | ||
64 | |||
63 | wattron(ctx->history, COLOR_PAIR(3)); | 65 | wattron(ctx->history, COLOR_PAIR(3)); |
64 | wprintw(ctx->history, " * Your partner changed nick to '%s'\n", nick); | 66 | wprintw(ctx->history, " * Your partner changed nick to '%s'\n", nick); |
65 | wattroff(ctx->history, COLOR_PAIR(3)); | 67 | wattroff(ctx->history, COLOR_PAIR(3)); |
@@ -144,7 +146,11 @@ ToxWindow new_chat(int friendnum) { | |||
144 | ret.onNickChange = &chat_onNickChange; | 146 | ret.onNickChange = &chat_onNickChange; |
145 | ret.onStatusChange = &chat_onStatusChange; | 147 | ret.onStatusChange = &chat_onStatusChange; |
146 | 148 | ||
147 | snprintf(ret.title, sizeof(ret.title), "[chat %d]", friendnum); | 149 | uint8_t nick[MAX_NAME_LENGTH] = {0}; |
150 | getname(friendnum, (uint8_t*) &nick); | ||
151 | fix_name(nick); | ||
152 | |||
153 | snprintf(ret.title, sizeof(ret.title), "[%s (%d)]", nick, friendnum); | ||
148 | 154 | ||
149 | ChatContext* x = calloc(1, sizeof(ChatContext)); | 155 | ChatContext* x = calloc(1, sizeof(ChatContext)); |
150 | x->friendnum = friendnum; | 156 | x->friendnum = friendnum; |