diff options
author | Test_User <hax@andrewyu.org> | 2024-06-17 22:19:12 -0400 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2024-06-17 22:19:12 -0400 |
commit | 27589848053910baa5394f8fdf233a7f9c07c3f8 (patch) | |
tree | 26dccff9bc67c55e8cf2cb2a5615f43db668a501 /general_network.c | |
parent | d3e2530cdaa9fb6ce0af737a7ce181a60f88cc45 (diff) | |
download | haxircd-27589848053910baa5394f8fdf233a7f9c07c3f8.tar.gz haxircd-27589848053910baa5394f8fdf233a7f9c07c3f8.zip |
Deoper support
Diffstat (limited to 'general_network.c')
-rw-r--r-- | general_network.c | 20 |
1 files changed, 17 insertions, 3 deletions
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; +} |