remove tryagain, fix USERSDONTMATCH error message

This commit is contained in:
tali 2024-01-31 15:17:01 -05:00
parent 4a249fa941
commit 47185c83e1
1 changed files with 3 additions and 8 deletions

View File

@ -68,7 +68,6 @@ let reply t (num, params) =
(Msg.make num (target :: params)
~prefix ~always_trailing)
let tryagain cmd = "263", [cmd; "Please wait a while and try again."]
let away nick text = "301", [nick; text]
let nosuchnick tgt = "401", [tgt; "No such nick/channel"]
let nosuchchannel tgt = "403", [tgt; "No such channel"]
@ -89,8 +88,7 @@ let unknownmode chr = "472", [String.make 1 chr; "is an unknown mode char
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"]
let usersdontmatch_get = "502", ["Can't view mode for other users"]
let usersdontmatch x = "502", [Fmt.str "Can't %s mode for other users" x]
(* permission checking *)
@ -100,9 +98,6 @@ let require_registered t : user result =
| Some me -> Ok me
| None -> Error notregistered
let require_same_user user me =
if (user : user) == me then Ok () else Error usersdontmatch_get
let require_membership chan me =
match Router.membership chan me with
| mem -> Ok mem
@ -179,13 +174,13 @@ let set_member_priv ~from mem priv =
mem.mem_priv <- priv
let on_get_user_mode user me =
let* () = require_same_user user me in
let* () = if user == me then Ok () else Error (usersdontmatch "get") in
Ok [
"221", [Fmt.str "+%a" Mode.Set.pp (User.mode me)]
]
let on_set_user_mode user me modestr _args =
let* () = require_same_user user me in
let* () = if user == me then Ok () else Error (usersdontmatch "set") in
let* chg = try Ok (Mode.Parse.user_modes modestr)
with Mode.Parse.Unknown_mode _ ->
(* TODO: "If one or more modes sent are not implemented on the server, the server