1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-15 02:13:01 +01:00

add mod-list prune command

This commit is contained in:
Jfreegman 2015-05-30 23:57:30 -04:00
parent 9cd8afe90a
commit 7e7087e94e
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
4 changed files with 18 additions and 2 deletions

View File

@ -92,6 +92,7 @@ static struct cmd_func group_commands[] = {
{ "/passwd", cmd_set_passwd }, { "/passwd", cmd_set_passwd },
{ "/peerlimit", cmd_set_peerlimit }, { "/peerlimit", cmd_set_peerlimit },
{ "/privacy", cmd_set_privacy }, { "/privacy", cmd_set_privacy },
{ "/prune", cmd_prune },
{ "/rejoin", cmd_rejoin }, { "/rejoin", cmd_rejoin },
{ "/topic", cmd_set_topic }, { "/topic", cmd_set_topic },
{ "/unignore", cmd_unignore }, { "/unignore", cmd_unignore },

View File

@ -92,7 +92,7 @@ void cmd_kick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
return; return;
} }
int ret = tox_group_op_kick_peer(m, self->num, (uint32_t) peernumber); int ret = tox_group_kick_peer(m, self->num, (uint32_t) peernumber);
switch (ret) { switch (ret) {
case 0: { case 0: {
@ -140,9 +140,23 @@ void cmd_mod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "You do not have permission to promote moderators."); line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "You do not have permission to promote moderators.");
return; return;
} }
case -3: {
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Moderator list is full. Use the \"/prune\" command to remove all offline mods from the mod list.");
return;
}
} }
} }
void cmd_prune(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
if (tox_group_prune_moderator_list(m, self->num) == -1) {
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to prune moderator list.");
return;
}
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Moderator list has been successfully pruned.");
}
void cmd_unmod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) void cmd_unmod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{ {
if (argc < 1) { if (argc < 1) {

View File

@ -30,6 +30,7 @@ void cmd_chatid(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
void cmd_ignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_ignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_kick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_kick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_mod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_mod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_prune(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_set_passwd(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_set_passwd(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_set_peerlimit(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_set_peerlimit(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_set_privacy(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_set_privacy(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);

View File

@ -603,7 +603,7 @@ static void groupchat_onGroupModeration(ToxWindow *self, Tox *m, int groupnum, u
line_info_add(self, timefrmt, NULL, NULL, SYS_MSG, 1, BLUE, "-!- %s has been silenced by %s", tgt_name, src_name); line_info_add(self, timefrmt, NULL, NULL, SYS_MSG, 1, BLUE, "-!- %s has been silenced by %s", tgt_name, src_name);
break; break;
case TOX_GROUP_MOD_EVENT_USER: case TOX_GROUP_MOD_EVENT_USER:
line_info_add(self, timefrmt, NULL, NULL, SYS_MSG, 1, BLUE, "-!- %s has been user'd by %s", tgt_name, src_name); line_info_add(self, timefrmt, NULL, NULL, SYS_MSG, 1, BLUE, "-!- %s has been made a normal user by %s", tgt_name, src_name);
break; break;
case TOX_GROUP_MOD_EVENT_MODERATOR: case TOX_GROUP_MOD_EVENT_MODERATOR:
line_info_add(self, timefrmt, NULL, NULL, SYS_MSG, 1, BLUE, "-!- %s has been promoted to moderator by %s", tgt_name, src_name); line_info_add(self, timefrmt, NULL, NULL, SYS_MSG, 1, BLUE, "-!- %s has been promoted to moderator by %s", tgt_name, src_name);