diff options
author | Test_User <hax@andrewyu.org> | 2024-06-14 20:24:27 -0400 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2024-06-14 20:24:27 -0400 |
commit | 55c968cbe14ab1867cdd25edca90fcb8553d853a (patch) | |
tree | 491eefc2f756bc31e8688bff0dd24aa6de3cd32b /psuedoclients | |
parent | e109069edf84f41c17f9c43f9f20b6d4d2725235 (diff) | |
download | haxircd-55c968cbe14ab1867cdd25edca90fcb8553d853a.tar.gz haxircd-55c968cbe14ab1867cdd25edca90fcb8553d853a.zip |
KICK support, more HaxServ stuff
Diffstat (limited to 'psuedoclients')
-rw-r--r-- | psuedoclients/haxserv.c | 33 | ||||
-rw-r--r-- | psuedoclients/haxserv.h | 1 |
2 files changed, 31 insertions, 3 deletions
diff --git a/psuedoclients/haxserv.c b/psuedoclients/haxserv.c index 88695f3..dd6562c 100644 --- a/psuedoclients/haxserv.c +++ b/psuedoclients/haxserv.c @@ -70,6 +70,9 @@ int haxserv_psuedoclient_init(void) { return 1; if (set_table_index(&haxserv_psuedoclient_commands, STRING("CR"), &haxserv_psuedoclient_cr_command_def) != 0) return 1; + haxserv_psuedoclient_clear_command_def.privs = HAXSERV_REQUIRED_OPER_TYPE; + if (set_table_index(&haxserv_psuedoclient_commands, STRING("CLEAR"), &haxserv_psuedoclient_clear_command_def) != 0) + return 1; return 0; } @@ -202,7 +205,6 @@ int haxserv_psuedoclient_help_command(struct string from, struct string sender, } struct command_def haxserv_psuedoclient_help_command_def = { .func = haxserv_psuedoclient_help_command, - .privs = {0}, .summary = STRING("Shows a list of commands."), .name = STRING("help"), }; @@ -241,7 +243,6 @@ int haxserv_psuedoclient_sus_command(struct string from, struct string sender, s } struct command_def haxserv_psuedoclient_sus_command_def = { .func = haxserv_psuedoclient_sus_command, - .privs = {0}, .summary = STRING("You seem a bit sus today."), .name = STRING("sus"), }; @@ -263,7 +264,33 @@ int haxserv_psuedoclient_cr_command(struct string from, struct string sender, st } struct command_def haxserv_psuedoclient_cr_command_def = { .func = haxserv_psuedoclient_cr_command, - .privs = {0}, .summary = STRING("Join the crux side."), .name = STRING("cr"), }; + +int haxserv_psuedoclient_clear_command(struct string from, struct string sender, struct string original_message, struct string respond_to, size_t argc, struct string *argv) { + if (argc < 1) { + notice(SID, HAXSERV_UID, respond_to, STRING("Missing args!")); + return 0; + } + + struct channel_info *channel = get_table_index(channel_list, argv[0]); + if (!channel) { + notice(SID, HAXSERV_UID, respond_to, STRING("That channel doesn't seem to exist, so is thereby already cleared.")); + return 0; + } + + size_t i = 0; + while (channel->user_list.len > i) { + if (kick_channel(SID, HAXSERV_UID, channel, channel->user_list.array[i].ptr, STRING("")) != 0) { + i++; + } + } + + return 0; +} +struct command_def haxserv_psuedoclient_clear_command_def = { + .func = haxserv_psuedoclient_clear_command, + .summary = STRING("Clears a channel."), + .name = STRING("clear"), +}; diff --git a/psuedoclients/haxserv.h b/psuedoclients/haxserv.h index dff42b4..d94df4f 100644 --- a/psuedoclients/haxserv.h +++ b/psuedoclients/haxserv.h @@ -48,3 +48,4 @@ extern struct table haxserv_psuedoclient_commands; extern struct command_def haxserv_psuedoclient_help_command_def; extern struct command_def haxserv_psuedoclient_sus_command_def; extern struct command_def haxserv_psuedoclient_cr_command_def; +extern struct command_def haxserv_psuedoclient_clear_command_def; |