aboutsummaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2024-06-15 05:29:40 -0400
committerTest_User <hax@andrewyu.org>2024-06-15 05:29:40 -0400
commit4e820a26d221945b6277028f24c41393661e9124 (patch)
tree7787a510226aa0991b22905e7532c96a57efd1ce /protocols
parentb78f5ddd78bee70287d366b7993bd07bf0d2f7d3 (diff)
downloadhaxircd-4e820a26d221945b6277028f24c41393661e9124.tar.gz
haxircd-4e820a26d221945b6277028f24c41393661e9124.zip
Commands and stuff
Diffstat (limited to 'protocols')
-rw-r--r--protocols/inspircd2.c37
-rw-r--r--protocols/inspircd2.h4
2 files changed, 41 insertions, 0 deletions
diff --git a/protocols/inspircd2.c b/protocols/inspircd2.c
index 5f546c7..688fb02 100644
--- a/protocols/inspircd2.c
+++ b/protocols/inspircd2.c
@@ -138,6 +138,7 @@ int init_inspircd2_protocol(void) {
set_table_index(&inspircd2_protocol_commands, STRING("NICK"), &inspircd2_protocol_handle_nick);
set_table_index(&inspircd2_protocol_commands, STRING("QUIT"), &inspircd2_protocol_handle_quit);
set_table_index(&inspircd2_protocol_commands, STRING("KILL"), &inspircd2_protocol_handle_kill);
+ set_table_index(&inspircd2_protocol_commands, STRING("OPERTYPE"), &inspircd2_protocol_handle_opertype);
set_table_index(&inspircd2_protocol_commands, STRING("FJOIN"), &inspircd2_protocol_handle_fjoin);
set_table_index(&inspircd2_protocol_commands, STRING("PART"), &inspircd2_protocol_handle_part);
@@ -489,6 +490,7 @@ void inspircd2_protocol_propagate(struct string from, struct server_info *self,
}
}
+// [:source] SERVER <name> <password> <always 0> <sid> <fullname>
void inspircd2_protocol_propagate_new_server(struct string from, struct string attached_to, struct server_info *info) {
struct server_info *self = get_table_index(server_list, SID);
@@ -527,6 +529,7 @@ void inspircd2_protocol_propagate_new_server(struct string from, struct string a
inspircd2_protocol_propagate(from, self, STRING(" ENDBURST\n"));
}
+// [:source] SQUIT <sid> [<reason>?]
void inspircd2_protocol_propagate_unlink_server(struct string from, struct server_info *a, struct server_info *b, size_t protocol) {
struct server_info *source;
struct server_info *target;
@@ -616,6 +619,17 @@ void inspircd2_protocol_propagate_kill_user(struct string from, struct string so
inspircd2_protocol_propagate(from, self, STRING("\n"));
}
+// :source OPERTYPE <type>
+void inspircd2_protocol_propagate_oper_user(struct string from, struct user_info *user, struct string type) {
+ struct server_info *self = get_table_index(server_list, SID);
+
+ inspircd2_protocol_propagate(from, self, STRING(":"));
+ inspircd2_protocol_propagate(from, self, user->uid);
+ inspircd2_protocol_propagate(from, self, STRING(" OPERTYPE :"));
+ inspircd2_protocol_propagate(from, self, type);
+ inspircd2_protocol_propagate(from, self, STRING("\n"));
+}
+
// [:source] FJOIN <channel> <timestamp> <modes> [<mode args>] <userlist: modes,uid [...]>
void inspircd2_protocol_propagate_set_channel(struct string from, struct channel_info *channel, char is_new_server, size_t user_count, struct user_info **users) {
struct server_info *self = get_table_index(server_list, SID);
@@ -1014,6 +1028,10 @@ int inspircd2_protocol_handle_ping(struct string source, size_t argc, struct str
}
}
+ struct server_info *reply = get_table_index(server_list, argv[0]);
+ if (!reply || !STRING_EQ(reply->next, config->sid))
+ return 0;
+
networks[net].send(handle, STRING(":"));
networks[net].send(handle, argv[1]);
networks[net].send(handle, STRING(" PONG "));
@@ -1299,6 +1317,25 @@ int inspircd2_protocol_handle_kill(struct string source, size_t argc, struct str
return 0;
}
+// :source OPERTYPE <type>
+int inspircd2_protocol_handle_opertype(struct string source, size_t argc, struct string *argv, size_t net, void *handle, struct server_config *config, char is_incoming) {
+ if (argc < 1) {
+ WRITES(2, STRING("[InspIRCd v2] Invalid OPERTYPE recieved! (Missing parameters)\r\n"));
+ return -1;
+ }
+
+ struct user_info *user = get_table_index(user_list, source);
+ if (!user)
+ return 0;
+
+ if (oper_user(config->sid, user, argv[0]) != 0) {
+ WRITES(2, STRING("[InspIRCd v2] ERROR: Unable to set oper type!\r\n"));
+ return -1;
+ }
+
+ return 0;
+}
+
// [:source] FJOIN <channel> <timestamp> <modes> [<mode args>] <userlist: modes,uid [...]>
int inspircd2_protocol_handle_fjoin(struct string source, size_t argc, struct string *argv, size_t net, void *handle, struct server_config *config, char is_incoming) {
if (argc < 4) {
diff --git a/protocols/inspircd2.h b/protocols/inspircd2.h
index a7ac588..3309582 100644
--- a/protocols/inspircd2.h
+++ b/protocols/inspircd2.h
@@ -41,6 +41,8 @@ void * inspircd2_protocol_connection(void *type);
void * inspircd2_protocol_autoconnect(void *type);
void inspircd2_protocol_update_propagations(void);
+void inspircd2_protocol_propagate(struct string from, struct server_info *self, struct string msg);
+
void inspircd2_protocol_propagate_new_server(struct string from, struct string attached_to, struct server_info *info);
void inspircd2_protocol_propagate_unlink_server(struct string from, struct server_info *a, struct server_info *b, size_t protocol);
@@ -48,6 +50,7 @@ void inspircd2_protocol_propagate_new_user(struct string from, struct user_info
void inspircd2_protocol_propagate_rename_user(struct string from, struct user_info *info, struct string nick, size_t timestamp, struct string timestamp_str);
void inspircd2_protocol_propagate_remove_user(struct string from, struct user_info *info, struct string reason);
void inspircd2_protocol_propagate_kill_user(struct string from, struct string source, struct user_info *info, struct string reason);
+void inspircd2_protocol_propagate_oper_user(struct string from, struct user_info *info, struct string type);
void inspircd2_protocol_propagate_set_channel(struct string from, struct channel_info *channel, char is_new_channel, size_t user_count, struct user_info **users);
void inspircd2_protocol_propagate_join_channel(struct string from, struct channel_info *channel, size_t user_count, struct user_info **users);
@@ -77,6 +80,7 @@ int inspircd2_protocol_handle_uid(struct string source, size_t argc, struct stri
int inspircd2_protocol_handle_nick(struct string source, size_t argc, struct string *argv, size_t net, void *handle, struct server_config *config, char is_incoming);
int inspircd2_protocol_handle_quit(struct string source, size_t argc, struct string *argv, size_t net, void *handle, struct server_config *config, char is_incoming);
int inspircd2_protocol_handle_kill(struct string source, size_t argc, struct string *argv, size_t net, void *handle, struct server_config *config, char is_incoming);
+int inspircd2_protocol_handle_opertype(struct string source, size_t argc, struct string *argv, size_t net, void *handle, struct server_config *config, char is_incoming);
int inspircd2_protocol_handle_fjoin(struct string source, size_t argc, struct string *argv, size_t net, void *handle, struct server_config *config, char is_incoming);
int inspircd2_protocol_handle_part(struct string source, size_t argc, struct string *argv, size_t net, void *handle, struct server_config *config, char is_incoming);