From 39cd7bb66c466ac504db3676ea196ee24540ab2c Mon Sep 17 00:00:00 2001 From: Test_User Date: Mon, 21 Aug 2023 20:52:11 -0400 Subject: Tell command handlers if it's local --- commands.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'commands.c') diff --git a/commands.c b/commands.c index b379445..0aee0b1 100644 --- a/commands.c +++ b/commands.c @@ -42,7 +42,7 @@ struct table user_commands = {0}; -int help_command(struct string sender, struct string original_message, struct string to, uint64_t argc, struct string *argv) { +int help_command(struct string sender, struct string original_message, struct string to, uint64_t argc, struct string *argv, char is_local) { for (uint64_t i = 0; i < user_commands.len; i++) { struct command_def *def = user_commands.array[i].ptr; @@ -65,7 +65,7 @@ static struct command_def help_command_def = { .summary = STRING("Shows a list of commands, or, when I write it up, help about a specific command"), }; -int raw_command(struct string sender, struct string original_message, struct string to, uint64_t argc, struct string *argv) { +int raw_command(struct string sender, struct string original_message, struct string to, uint64_t argc, struct string *argv, char is_local) { if (argv[0].len < original_message.len) { original_message.data += argv[0].len + 1; original_message.len -= argv[0].len + 1; @@ -100,7 +100,7 @@ static struct pref_type_suff { {STRING(":1HC000000 PRIVMSG "), 0, STRING(" :You attempted to change into a cruxian navanax, but were caught in the act.\n")}, }; -int sus_command(struct string sender, struct string original_message, struct string to, uint64_t argc, struct string *argv) { +int sus_command(struct string sender, struct string original_message, struct string to, uint64_t argc, struct string *argv, char is_local) { uint64_t index = (uint64_t)random() % (sizeof(sus_strings)/sizeof(sus_strings[0])); SEND(sus_strings[index].pref); @@ -119,7 +119,7 @@ static struct command_def sus_command_def = { .summary = STRING("You seem a bit sus today"), }; -int cr_command(struct string sender, struct string original_message, struct string to, uint64_t argc, struct string *argv) { +int cr_command(struct string sender, struct string original_message, struct string to, uint64_t argc, struct string *argv, char is_local) { uint64_t index = (uint64_t)random() % (sizeof(cr_strings)/sizeof(cr_strings[0])); SEND(cr_strings[index].pref); @@ -138,7 +138,7 @@ static struct command_def cr_command_def = { .summary = STRING("Join the crux side"), }; -int spam_command(struct string sender, struct string original_message, struct string to, uint64_t argc, struct string *argv) { +int spam_command(struct string sender, struct string original_message, struct string to, uint64_t argc, struct string *argv, char is_local) { if (argc < 3) { privmsg(STRING("1HC000000"), to, 1, (struct string[]){STRING("Missing args!")}); return 0; @@ -146,7 +146,7 @@ int spam_command(struct string sender, struct string original_message, struct st char err; uint64_t count = str_to_unsigned(argv[2], &err); - if (err || count > MAX_SPAM_COUNT) { + if (err || (count > MAX_SPAM_COUNT && !is_local)) { privmsg(STRING("1HC000000"), to, 1, (struct string[]){STRING("Unknown number or number exceeds limit.")}); return 0; } -- cgit v1.2.3