add INFO, HELP, plus a bunch of invalid "admin only" commands
This commit is contained in:
parent
7534b2c4e7
commit
4a249fa941
|
@ -86,6 +86,7 @@ let needmoreparams cmd = "461", [cmd; "Not enough parameters"]
|
|||
let alreadyregistered = "462", ["Unauthorized command (already registered)"]
|
||||
let channelisfull chan = "471", [chan; "Cannot join channel (+l)"]
|
||||
let unknownmode chr = "472", [String.make 1 chr; "is an unknown mode char to me"]
|
||||
let noprivileges = "481", ["Permission Denied- You're not an IRC operator"]
|
||||
let chanoprivsneeded chan = "482", [chan; "You're not channel operator"]
|
||||
let umodeunknownflag = "501", ["Unknown MODE flag"]
|
||||
let usersdontmatch_set = "502", ["Can't change mode for other users"]
|
||||
|
@ -695,6 +696,17 @@ let on_msg_admin t =
|
|||
reply t ("256", [t.server_info.hostname; t.server_info.admin_info]);
|
||||
Ok ()
|
||||
|
||||
let on_msg_info t =
|
||||
let* _me = require_registered t in
|
||||
reply t ("371", ["Running talircd version " ^ t.server_info.version]);
|
||||
reply t ("374", ["End of INFO list"]);
|
||||
Ok ()
|
||||
|
||||
let on_msg_help t topic =
|
||||
let* _me = require_registered t in
|
||||
let topic = Option.value topic ~default:"*" in
|
||||
Error ("524", [topic; "No help available on this topic"])
|
||||
|
||||
let quit t me ~reason =
|
||||
begin
|
||||
let msg = Msg.make "QUIT" [User.nick me; reason] ~always_trailing:true in
|
||||
|
@ -845,6 +857,8 @@ let dispatch t = function
|
|||
| "QUIT", reason -> on_msg_quit t (concat_args reason)
|
||||
| "MOTD", _ -> on_msg_motd t
|
||||
| "ADMIN", _ -> on_msg_admin t
|
||||
| "INFO", _ -> on_msg_info t
|
||||
| "HELP", args -> on_msg_help t (concat_args args)
|
||||
| "PING", args -> on_msg_ping t (concat_args args)
|
||||
| "PONG", args -> on_msg_pong t (concat_args args)
|
||||
| "PRIVMSG", ([] | "" :: _) -> Error norecipient
|
||||
|
@ -868,21 +882,13 @@ let dispatch t = function
|
|||
| "WHOWAS", nick :: count :: _ -> on_msg_whowas t nick count
|
||||
| ("USER" | "JOIN" | "NAMES" | "PART" | "KICK" | "MODE" | "WHO") as cmd, _ ->
|
||||
Error (needmoreparams cmd)
|
||||
| ("CONNECT" | "KILL" | "REHASH" | "RESTART" | "STATS" | "SQUIT" | "WALLOPS"), _ ->
|
||||
Error noprivileges
|
||||
(* TODO: "LIST" *)
|
||||
(* TODO: "ADMIN" *)
|
||||
(* TODO: "CONNECT" *)
|
||||
(* TODO: "LUSERS" *)
|
||||
(* TODO: "TIME" *)
|
||||
(* TODO: "STATS" *)
|
||||
(* TODO: "HELP" *)
|
||||
(* TODO: "INFO" *)
|
||||
(* TODO: "KILL" *)
|
||||
(* TODO: "REHASH" *)
|
||||
(* TODO: "RESTART" *)
|
||||
(* TODO: "SQUIT" *)
|
||||
(* TODO: "LINKS" *)
|
||||
(* TODO: "USERHOST" *)
|
||||
(* TODO: "WALLOPS" *)
|
||||
| cmd, _ ->
|
||||
Error (unknowncommand cmd)
|
||||
|
||||
|
|
Loading…
Reference in New Issue