1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-12-06 14:56:35 +01:00

detach group names from global name

Group names are now set on a per-group basis and are not affected
by the global /nick command.
This commit is contained in:
jfreegman
2023-04-04 16:16:57 -04:00
parent 5d757e1230
commit ff669be8d1
7 changed files with 93 additions and 30 deletions

View File

@@ -76,6 +76,32 @@ void cmd_disconnect(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*ar
}
}
void cmd_group_nick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
if (argc < 1) {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Input required.");
return;
}
char nick[MAX_STR_SIZE];
snprintf(nick, sizeof(nick), "%s", argv[1]);
size_t len = strlen(nick);
if (!valid_nick(nick)) {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Invalid name.");
return;
}
len = MIN(len, TOXIC_MAX_NAME_LENGTH - 1);
nick[len] = '\0';
set_nick_this_group(self, m, nick, len);
store_data(m, DATA_FILE);
}
void cmd_ignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
if (argc < 1) {