From d095efe06273ec29bdc07c2cc522d6fe5a793550 Mon Sep 17 00:00:00 2001 From: Test_User Date: Mon, 24 Jun 2024 11:08:29 -0400 Subject: The start of some services, inspircd3 support extra broken for now --- protocols.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'protocols.c') diff --git a/protocols.c b/protocols.c index 1eb1786..d27386a 100644 --- a/protocols.c +++ b/protocols.c @@ -56,6 +56,8 @@ struct protocol protocols[NUM_PROTOCOLS] = { .propagate_kill_user = inspircd2_protocol_propagate_kill_user, .propagate_oper_user = inspircd2_protocol_propagate_oper_user, + .propagate_set_account = inspircd2_protocol_propagate_set_account, + .propagate_set_channel = inspircd2_protocol_propagate_set_channel, .propagate_join_channel = inspircd2_protocol_propagate_join_channel, .propagate_part_channel = inspircd2_protocol_propagate_part_channel, @@ -73,6 +75,8 @@ struct protocol protocols[NUM_PROTOCOLS] = { .handle_kill_user = inspircd2_protocol_handle_kill_user, .handle_oper_user = inspircd2_protocol_handle_oper_user, + .handle_set_account = inspircd2_protocol_handle_set_account, + .handle_set_channel = inspircd2_protocol_handle_set_channel, .handle_join_channel = inspircd2_protocol_handle_join_channel, .handle_part_channel = inspircd2_protocol_handle_part_channel, @@ -84,6 +88,8 @@ struct protocol protocols[NUM_PROTOCOLS] = { .fail_rename_user = inspircd2_protocol_fail_rename_user, .fail_oper_user = inspircd2_protocol_fail_oper_user, + .fail_set_account = inspircd2_protocol_fail_set_account, + .fail_set_channel = inspircd2_protocol_fail_set_channel, .fail_join_channel = inspircd2_protocol_fail_join_channel, @@ -110,6 +116,8 @@ struct protocol protocols[NUM_PROTOCOLS] = { .propagate_kill_user = inspircd3_protocol_propagate_kill_user, .propagate_oper_user = inspircd3_protocol_propagate_oper_user, + .propagate_set_account = inspircd3_protocol_propagate_set_account, + .propagate_set_channel = inspircd3_protocol_propagate_set_channel, .propagate_join_channel = inspircd3_protocol_propagate_join_channel, .propagate_part_channel = inspircd3_protocol_propagate_part_channel, @@ -127,6 +135,8 @@ struct protocol protocols[NUM_PROTOCOLS] = { .handle_kill_user = inspircd3_protocol_handle_kill_user, .handle_oper_user = inspircd3_protocol_handle_oper_user, + .handle_set_account = inspircd3_protocol_handle_set_account, + .handle_set_channel = inspircd3_protocol_handle_set_channel, .handle_join_channel = inspircd3_protocol_handle_join_channel, .handle_part_channel = inspircd3_protocol_handle_part_channel, @@ -138,6 +148,8 @@ struct protocol protocols[NUM_PROTOCOLS] = { .fail_rename_user = inspircd3_protocol_fail_rename_user, .fail_oper_user = inspircd3_protocol_fail_oper_user, + .fail_set_account = inspircd3_protocol_fail_set_account, + .fail_set_channel = inspircd3_protocol_fail_set_channel, .fail_join_channel = inspircd3_protocol_fail_join_channel, @@ -240,6 +252,14 @@ void protocols_propagate_oper_user(struct string from, struct user_info *info, s } } +void protocols_propagate_set_account(struct string from, struct user_info *info, struct string account, struct string source) { + for (size_t i = 0; i < NUM_PROTOCOLS; i++) { + if (!active_protocols[i]) + continue; + protocols[i].propagate_set_account(from, info, account, source); + } +} + void protocols_propagate_set_channel(struct string from, struct channel_info *channel, char is_new_channel, size_t user_count, struct user_info **users) { for (size_t i = 0; i < NUM_PROTOCOLS; i++) { if (!active_protocols[i]) @@ -400,6 +420,28 @@ int protocols_handle_oper_user(struct string from, struct user_info *info, struc return 1; } +int protocols_handle_set_account(struct string from, struct user_info *info, struct string account, struct string source) { + size_t i; + for (i = 0; i < NUM_PROTOCOLS; i++) { + if (!active_protocols[i]) + continue; + if (protocols[i].handle_set_account(from, info, account, source) != 0) + goto protocols_handle_set_account_fail; + } + + return 0; + + protocols_handle_set_account_fail: + while (i > 0) { + i--; + if (!active_protocols[i]) + continue; + protocols[i].fail_set_account(from, info, account, source); + } + + return 1; +} + int protocols_handle_set_channel(struct string from, struct channel_info *channel, char is_new_channel, size_t user_count, struct user_info **users) { size_t i; for (i = 0; i < NUM_PROTOCOLS; i++) { @@ -492,6 +534,14 @@ void protocols_fail_oper_user(struct string from, struct user_info *info, struct } } +void protocols_fail_set_account(struct string from, struct user_info *info, struct string account, struct string source) { + for (size_t i = 0; i < NUM_PROTOCOLS; i++) { + if (!active_protocols[i]) + continue; + protocols[i].fail_set_account(from, info, account, source); + } +} + void protocols_fail_set_channel(struct string from, struct channel_info *channel, char is_new_channel, size_t user_count, struct user_info **users) { for (size_t i = 0; i < NUM_PROTOCOLS; i++) { if (!active_protocols[i]) -- cgit v1.2.3