diff options
Diffstat (limited to '')
-rw-r--r-- | client_network.c | 17 | ||||
-rw-r--r-- | main.c | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/client_network.c b/client_network.c index e6df67b..08b9aea 100644 --- a/client_network.c +++ b/client_network.c @@ -466,6 +466,22 @@ int client_ping_handler(uint64_t argc, struct string *argv) { return 0; } +int client_mode_handler(uint64_t argc, struct string *argv) { + if (argc < 2) + return 0; // Mode querying not supported yet + + SEND(STRING(":1HC000001 MODE ")); + for (uint64_t i = 0; i < argc - 1; i++) { + SEND(argv[i]); + SEND(STRING(" ")); + } + SEND(STRING(":")); + SEND(argv[argc - 1]); + SEND(STRING("\n")); + + return 0; +} + int client_fd = -1; int client_listen_fd; @@ -478,6 +494,7 @@ int initclientnetwork(void) { set_table_index(&client_network_commands, STRING("PRIVMSG"), &client_privmsg_handler); set_table_index(&client_network_commands, STRING("RAW"), &client_raw_handler); set_table_index(&client_network_commands, STRING("PING"), &client_ping_handler); + set_table_index(&client_network_commands, STRING("MODE"), &client_mode_handler); client_nick.data = malloc(0); @@ -210,6 +210,7 @@ void *client_loop(void *ign) { disconnect_client: if (client_connected) { SEND(STRING(":1HC000001 QUIT :Ping timeout: -240 seconds\n")); + remove_user(STRING("1HC000001"), STRING("Ping timeout: -240 seconds\n")); client_connected = 0; } |