aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2024-08-31 09:27:37 -0400
committerTest_User <hax@andrewyu.org>2024-08-31 09:27:37 -0400
commit253c1726681d6bf82b05b49d6e06b56b2574bb6d (patch)
tree564cfb78d9b1d50a061436a81f8a53826c6f1c15
parent37db49c845f3714cdd9e44996116dddd1381874a (diff)
downloadhaxircd-253c1726681d6bf82b05b49d6e06b56b2574bb6d.tar.gz
haxircd-253c1726681d6bf82b05b49d6e06b56b2574bb6d.zip
Fix RSQUIT behavior
-rw-r--r--protocols/inspircd2.c8
-rw-r--r--protocols/inspircd3.c8
-rw-r--r--protocols/inspircd4.c6
3 files changed, 16 insertions, 6 deletions
diff --git a/protocols/inspircd2.c b/protocols/inspircd2.c
index 8b25be5..07a7ba6 100644
--- a/protocols/inspircd2.c
+++ b/protocols/inspircd2.c
@@ -1334,12 +1334,14 @@ int inspircd2_protocol_handle_rsquit(struct string source, size_t argc, struct s
for (size_t i = 0; i < server_list.len; i++) {
struct server_info *target = server_list.array[i].ptr;
- if (target->protocol != INSPIRCD2_PROTOCOL)
+ if (target != self && target->protocol != INSPIRCD2_PROTOCOL)
continue; // TODO: Maybe actually unlink this somehow
if (!STRING_EQ(target->name, argv[0]))
continue;
- if (has_table_index(target->connected_to, SID)) {
+ if (target == self) {
+ networks[net].shutdown(handle);
+ } else if (has_table_index(target->connected_to, SID)) {
networks[target->net].shutdown(target->handle);
} else {
struct server_info *next = get_table_index(server_list, target->next);
@@ -1355,6 +1357,8 @@ int inspircd2_protocol_handle_rsquit(struct string source, size_t argc, struct s
networks[next->net].send(next->handle, STRING(" :\n"));
}
}
+
+ break;
}
return 0;
diff --git a/protocols/inspircd3.c b/protocols/inspircd3.c
index c4384bb..6d64f14 100644
--- a/protocols/inspircd3.c
+++ b/protocols/inspircd3.c
@@ -1424,12 +1424,14 @@ int inspircd3_protocol_handle_rsquit(struct string source, size_t argc, struct s
for (size_t i = 0; i < server_list.len; i++) {
struct server_info *target = server_list.array[i].ptr;
- if (target->protocol != INSPIRCD3_PROTOCOL)
+ if (target != self && target->protocol != INSPIRCD3_PROTOCOL)
continue; // TODO: Maybe actually unlink this somehow
if (!STRING_EQ(target->name, argv[0]))
continue;
- if (has_table_index(target->connected_to, SID)) {
+ if (target == self) {
+ networks[net].shutdown(handle);
+ } else if (has_table_index(target->connected_to, SID)) {
networks[target->net].shutdown(target->handle);
} else {
struct server_info *next = get_table_index(server_list, target->next);
@@ -1445,6 +1447,8 @@ int inspircd3_protocol_handle_rsquit(struct string source, size_t argc, struct s
networks[next->net].send(next->handle, STRING(":\n"));
}
}
+
+ break;
}
return 0;
diff --git a/protocols/inspircd4.c b/protocols/inspircd4.c
index 9e47d0e..57e7245 100644
--- a/protocols/inspircd4.c
+++ b/protocols/inspircd4.c
@@ -1429,12 +1429,14 @@ int inspircd4_protocol_handle_rsquit(struct string source, size_t argc, struct s
for (size_t i = 0; i < server_list.len; i++) {
struct server_info *target = server_list.array[i].ptr;
- if (target->protocol != INSPIRCD4_PROTOCOL)
+ if (target != self && target->protocol != INSPIRCD4_PROTOCOL)
continue; // TODO: Maybe actually unlink this somehow
if (!STRING_EQ(target->name, argv[0]))
continue;
- if (has_table_index(target->connected_to, SID)) {
+ if (target == self) {
+ networks[net].shutdown(handle);
+ } else if (has_table_index(target->connected_to, SID)) {
networks[target->net].shutdown(target->handle);
} else {
struct server_info *next = get_table_index(server_list, target->next);