mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 21:53:05 +01:00
fixes
This commit is contained in:
parent
40f70fc1e3
commit
5c66f5c161
13
src/chat.c
13
src/chat.c
@ -116,14 +116,17 @@ static void set_self_typingstatus(ToxWindow *self, Tox *m, uint8_t is_typing)
|
||||
ctx->self_is_typing = is_typing;
|
||||
}
|
||||
|
||||
static void chat_set_window_name(ToxWindow *self, char *nick, int len)
|
||||
{
|
||||
static void chat_set_window_name(ToxWindow *self, const char *nick, int len)
|
||||
{
|
||||
char nick_cpy[TOXIC_MAX_NAME_LENGTH + 1];
|
||||
snprintf(nick_cpy, sizeof(nick_cpy), "%s", nick);
|
||||
|
||||
if (len > MAX_WINDOW_NAME_LENGTH) {
|
||||
strcpy(&nick[MAX_WINDOW_NAME_LENGTH - 3], "...");
|
||||
nick[MAX_WINDOW_NAME_LENGTH] = '\0';
|
||||
strcpy(&nick_cpy[MAX_WINDOW_NAME_LENGTH - 3], "...");
|
||||
nick_cpy[MAX_WINDOW_NAME_LENGTH] = '\0';
|
||||
}
|
||||
|
||||
snprintf(self->name, sizeof(self->name), "%s", nick);
|
||||
snprintf(self->name, sizeof(self->name), "%s", nick_cpy);
|
||||
}
|
||||
|
||||
static void close_all_file_receivers(Tox *m, int friendnum);
|
||||
|
@ -250,7 +250,7 @@ void str_to_lower(char *str)
|
||||
int get_nick_truncate(Tox *m, char *buf, int friendnum)
|
||||
{
|
||||
int len = tox_get_name(m, friendnum, (uint8_t *) buf);
|
||||
len = MIN(len, TOXIC_MAX_NAME_LENGTH);
|
||||
len = MIN(len, TOXIC_MAX_NAME_LENGTH - 1);
|
||||
buf[len] = '\0';
|
||||
return len;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user