add LINKS command

This commit is contained in:
tali 2024-01-31 17:15:15 -05:00
parent a4e98a10ae
commit 7d204b98b6
1 changed files with 6 additions and 1 deletions

View File

@ -735,6 +735,11 @@ let on_msg_lusers t =
Fmt.str "Current global users %d, max %d" u m]); Fmt.str "Current global users %d, max %d" u m]);
Ok () Ok ()
let on_msg_links t =
let* _me = require_registered t in
reply t ("365", ["End of /LINKS list"]);
Ok ()
let quit t me ~reason = let quit t me ~reason =
begin begin
let msg = Msg.make "QUIT" [User.nick me; reason] ~always_trailing:true in let msg = Msg.make "QUIT" [User.nick me; reason] ~always_trailing:true in
@ -888,6 +893,7 @@ let dispatch t = function
| "INFO", _ -> on_msg_info t | "INFO", _ -> on_msg_info t
| "TIME", _ -> on_msg_time t | "TIME", _ -> on_msg_time t
| "LUSERS", _ -> on_msg_lusers t | "LUSERS", _ -> on_msg_lusers t
| "LINKS", _ -> on_msg_links t
| "HELP", args -> on_msg_help t (concat_args args) | "HELP", args -> on_msg_help t (concat_args args)
| "PING", args -> on_msg_ping t (concat_args args) | "PING", args -> on_msg_ping t (concat_args args)
| "PONG", args -> on_msg_pong t (concat_args args) | "PONG", args -> on_msg_pong t (concat_args args)
@ -915,7 +921,6 @@ let dispatch t = function
| ("CONNECT" | "KILL" | "REHASH" | "RESTART" | "STATS" | "SQUIT" | "WALLOPS"), _ -> | ("CONNECT" | "KILL" | "REHASH" | "RESTART" | "STATS" | "SQUIT" | "WALLOPS"), _ ->
Error noprivileges Error noprivileges
(* TODO: "LIST" *) (* TODO: "LIST" *)
(* TODO: "LINKS" *)
(* TODO: "USERHOST" *) (* TODO: "USERHOST" *)
| cmd, _ -> | cmd, _ ->
Error (unknowncommand cmd) Error (unknowncommand cmd)