From 98040ca35a29172701adf32c95e6d15392ec5fd1 Mon Sep 17 00:00:00 2001 From: Test_User Date: Sat, 15 Jun 2024 18:35:19 -0400 Subject: Start of InspIRCd v3 support --- server_network.c | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'server_network.c') diff --git a/server_network.c b/server_network.c index bf9e442..a3f420a 100644 --- a/server_network.c +++ b/server_network.c @@ -55,10 +55,8 @@ int init_server_network(void) { } } -#ifdef USE_INSPIRCD2_PROTOCOL - if (protocols[INSPIRCD2_PROTOCOL].init() != 0) + if (protocols_init() != 0) return 1; -#endif return 0; } @@ -107,6 +105,20 @@ int start_server_network_threads(size_t net) { return 1; } } +#endif +#ifdef USE_INSPIRCD3_PROTOCOL + if (SERVER_INCOMING[net][INSPIRCD3_PROTOCOL]) { + type = malloc(sizeof(*type)); + if (!type) + return 1; + type->net_type = net; + type->protocol = INSPIRCD3_PROTOCOL; + type->is_incoming = 1; + if (pthread_create(&trash, &pthread_attr, server_accept_thread, type) != 0) { + free(type); + return 1; + } + } #endif return 0; } @@ -214,12 +226,7 @@ int add_server(struct string from, struct string attached_to, struct string sid, protocols[protocol].update_propagations(); -#ifdef USE_HAXIRCD_PROTOCOL - protocols[HAXIRCD_PROTOCOL].propagate_new_server(from, attached_to, new_info); -#endif -#ifdef USE_INSPIRCD2_PROTOCOL - protocols[INSPIRCD2_PROTOCOL].propagate_new_server(from, attached_to, new_info); -#endif + protocols_propagate_new_server(from, attached_to, new_info); return 0; @@ -266,15 +273,6 @@ void remove_server(struct string from, struct server_info *server, struct string free_server(server); } -void update_all_propagations(void) { -#ifdef USE_HAXIRCD_PROTOCOL - protocols[HAXIRCD_PROTOCOL].update_propagations(); -#endif -#ifdef USE_INSPIRCD2_PROTOCOL - protocols[INSPIRCD2_PROTOCOL].update_propagations(); -#endif -} - void unlink_server(struct string from, struct server_info *a, struct server_info *b, size_t protocol) { if (!has_table_index(a->connected_to, b->sid)) return; @@ -284,12 +282,7 @@ void unlink_server(struct string from, struct server_info *a, struct server_info protocols[protocol].update_propagations(); -#ifdef USE_HAXIRCD_PROTOCOL - protocols[HAXIRCD_PROTOCOL].propagate_unlink_server(from, a, b, protocol); -#endif -#ifdef USE_INSPIRCD2_PROTOCOL - protocols[INSPIRCD2_PROTOCOL].propagate_unlink_server(from, a, b, protocol); -#endif + protocols_propagate_unlink_server(from, a, b, protocol); protocols[protocol].do_unlink(from, a, b); } -- cgit v1.2.3