From 27589848053910baa5394f8fdf233a7f9c07c3f8 Mon Sep 17 00:00:00 2001 From: Test_User Date: Mon, 17 Jun 2024 22:19:12 -0400 Subject: Deoper support --- protocols/inspircd3.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'protocols/inspircd3.c') diff --git a/protocols/inspircd3.c b/protocols/inspircd3.c index 3b0219d..3c74a79 100644 --- a/protocols/inspircd3.c +++ b/protocols/inspircd3.c @@ -646,12 +646,20 @@ void inspircd3_protocol_propagate_kill_user(struct string from, struct string so } // :source OPERTYPE -void inspircd3_protocol_propagate_oper_user(struct string from, struct user_info *user, struct string type) { - inspircd3_protocol_propagate(from, STRING(":")); - inspircd3_protocol_propagate(from, user->uid); - inspircd3_protocol_propagate(from, STRING(" OPERTYPE :")); - inspircd3_protocol_propagate(from, type); - inspircd3_protocol_propagate(from, STRING("\n")); +void inspircd3_protocol_propagate_oper_user(struct string from, struct user_info *user, struct string type, struct string source) { + if (type.len == 0) { + inspircd3_protocol_propagate(from, STRING(":")); + inspircd3_protocol_propagate(from, source); + inspircd3_protocol_propagate(from, STRING(" MODE ")); + inspircd3_protocol_propagate(from, user->uid); + inspircd3_protocol_propagate(from, STRING(" -o\n")); + } else { + inspircd3_protocol_propagate(from, STRING(":")); + inspircd3_protocol_propagate(from, user->uid); + inspircd3_protocol_propagate(from, STRING(" OPERTYPE :")); + inspircd3_protocol_propagate(from, type); + inspircd3_protocol_propagate(from, STRING("\n")); + } } // [:source] FJOIN [] @@ -823,7 +831,7 @@ void inspircd3_protocol_handle_kill_user(struct string from, struct string sourc return; } -int inspircd3_protocol_handle_oper_user(struct string from, struct user_info *info, struct string type) { +int inspircd3_protocol_handle_oper_user(struct string from, struct user_info *info, struct string type, struct string source) { return 0; } @@ -859,7 +867,7 @@ void inspircd3_protocol_fail_rename_user(struct string from, struct user_info *i return; } -void inspircd3_protocol_fail_oper_user(struct string from, struct user_info *info, struct string type) { +void inspircd3_protocol_fail_oper_user(struct string from, struct user_info *info, struct string type, struct string source) { return; } @@ -1424,7 +1432,7 @@ int inspircd3_protocol_handle_opertype(struct string source, size_t argc, struct if (!user) return 0; - if (oper_user(config->sid, user, argv[0]) != 0) { + if (oper_user(config->sid, user, argv[0], config->sid) != 0) { WRITES(2, STRING("[InspIRCd v3] ERROR: Unable to set oper type!\r\n")); return -1; } -- cgit v1.2.3