remove tryagain, fix USERSDONTMATCH error message
This commit is contained in:
parent
4a249fa941
commit
47185c83e1
|
@ -68,7 +68,6 @@ let reply t (num, params) =
|
||||||
(Msg.make num (target :: params)
|
(Msg.make num (target :: params)
|
||||||
~prefix ~always_trailing)
|
~prefix ~always_trailing)
|
||||||
|
|
||||||
let tryagain cmd = "263", [cmd; "Please wait a while and try again."]
|
|
||||||
let away nick text = "301", [nick; text]
|
let away nick text = "301", [nick; text]
|
||||||
let nosuchnick tgt = "401", [tgt; "No such nick/channel"]
|
let nosuchnick tgt = "401", [tgt; "No such nick/channel"]
|
||||||
let nosuchchannel tgt = "403", [tgt; "No such 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 noprivileges = "481", ["Permission Denied- You're not an IRC operator"]
|
||||||
let chanoprivsneeded chan = "482", [chan; "You're not channel operator"]
|
let chanoprivsneeded chan = "482", [chan; "You're not channel operator"]
|
||||||
let umodeunknownflag = "501", ["Unknown MODE flag"]
|
let umodeunknownflag = "501", ["Unknown MODE flag"]
|
||||||
let usersdontmatch_set = "502", ["Can't change mode for other users"]
|
let usersdontmatch x = "502", [Fmt.str "Can't %s mode for other users" x]
|
||||||
let usersdontmatch_get = "502", ["Can't view mode for other users"]
|
|
||||||
|
|
||||||
|
|
||||||
(* permission checking *)
|
(* permission checking *)
|
||||||
|
@ -100,9 +98,6 @@ let require_registered t : user result =
|
||||||
| Some me -> Ok me
|
| Some me -> Ok me
|
||||||
| None -> Error notregistered
|
| None -> Error notregistered
|
||||||
|
|
||||||
let require_same_user user me =
|
|
||||||
if (user : user) == me then Ok () else Error usersdontmatch_get
|
|
||||||
|
|
||||||
let require_membership chan me =
|
let require_membership chan me =
|
||||||
match Router.membership chan me with
|
match Router.membership chan me with
|
||||||
| mem -> Ok mem
|
| mem -> Ok mem
|
||||||
|
@ -179,13 +174,13 @@ let set_member_priv ~from mem priv =
|
||||||
mem.mem_priv <- priv
|
mem.mem_priv <- priv
|
||||||
|
|
||||||
let on_get_user_mode user me =
|
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 [
|
Ok [
|
||||||
"221", [Fmt.str "+%a" Mode.Set.pp (User.mode me)]
|
"221", [Fmt.str "+%a" Mode.Set.pp (User.mode me)]
|
||||||
]
|
]
|
||||||
|
|
||||||
let on_set_user_mode user me modestr _args =
|
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)
|
let* chg = try Ok (Mode.Parse.user_modes modestr)
|
||||||
with Mode.Parse.Unknown_mode _ ->
|
with Mode.Parse.Unknown_mode _ ->
|
||||||
(* TODO: "If one or more modes sent are not implemented on the server, the server
|
(* TODO: "If one or more modes sent are not implemented on the server, the server
|
||||||
|
|
Loading…
Reference in New Issue