From 27589848053910baa5394f8fdf233a7f9c07c3f8 Mon Sep 17 00:00:00 2001 From: Test_User Date: Mon, 17 Jun 2024 22:19:12 -0400 Subject: Deoper support --- general_network.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'general_network.c') diff --git a/general_network.c b/general_network.c index 34eb4f2..4436643 100644 --- a/general_network.c +++ b/general_network.c @@ -424,18 +424,21 @@ int kill_user(struct string from, struct string source, struct user_info *user, return 0; } -int oper_user(struct string from, struct user_info *user, struct string type) { +int oper_user(struct string from, struct user_info *user, struct string type, struct string source) { + if (STRING_EQ(user->oper_type, type)) + return 0; + struct string tmp; if (str_clone(&tmp, type) != 0) return 1; #ifdef USE_SERVER - if (protocols_handle_oper_user(from, user, type) != 0) { + if (protocols_handle_oper_user(from, user, type, source) != 0) { free(tmp.data); return 1; } - protocols_propagate_oper_user(from, user, type); + protocols_propagate_oper_user(from, user, type, source); #endif free(user->oper_type.data); @@ -729,3 +732,14 @@ int do_trivial_reloads(void) { #endif return 0; } + +int case_string_eq(struct string x, struct string y) { + if (x.len != y.len) + return 0; + + for (size_t i = 0; i < x.len; i++) + if (CASEMAP(x.data[i]) != CASEMAP(y.data[i])) + return 0; + + return 1; +} -- cgit v1.2.3