make "Router.membership" easier to type

This commit is contained in:
tali 2024-01-30 19:21:47 -05:00
parent d8ef67310a
commit 4aaa96c6c1
1 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,6 @@
open! Import open! Import
open Result_syntax open Result_syntax
type membership = Router.membership
include (val Logging.sublogs logger "Connection") include (val Logging.sublogs logger "Connection")
@ -91,7 +92,7 @@ let require_membership chan me =
| mem -> Ok mem | mem -> Ok mem
| exception Not_found -> Error (notonchannel (Chan.name chan)) | exception Not_found -> Error (notonchannel (Chan.name chan))
let require_chan_op (m : Router.membership) = let require_chan_op (m : membership) =
match m.mem_priv with match m.mem_priv with
| Operator -> Ok () | Operator -> Ok ()
| _ -> Error (chanoprivsneeded (Chan.name m.mem_chan)) | _ -> Error (chanoprivsneeded (Chan.name m.mem_chan))
@ -146,10 +147,9 @@ let set_chan_limit chan ~from chg =
Router.relay msg ~from [`to_chan chan; `to_self]; Router.relay msg ~from [`to_chan chan; `to_self];
Chan.set_limit chan limit Chan.set_limit chan limit
let set_member_priv ~from (mem : Router.membership) (priv : Router.priv) = let set_member_priv ~from (mem : membership) (priv : Router.priv) =
let user = mem.mem_user in let user = mem.mem_user in
let chan = mem.mem_chan in let chan = mem.mem_chan in
(* let user = (mem : Router.membership).mem_user in *)
let modestr = match mem.mem_priv, priv with let modestr = match mem.mem_priv, priv with
| _, Voice -> "+v" | _, Voice -> "+v"
| _, Operator -> "+o" | _, Operator -> "+o"
@ -319,14 +319,14 @@ let list_names t me chan =
[] []
else else
Chan.membership_when Chan.membership_when
(fun (m : Router.membership) -> (fun (m : membership) ->
not (is_invisible m.mem_user)) not (is_invisible m.mem_user))
chan chan
in in
let nicks = let nicks =
List.map List.map
(fun (m : Router.membership) -> (fun (m : membership) ->
let nick = User.nick m.mem_user in let nick = User.nick m.mem_user in
match m.mem_priv with match m.mem_priv with
| Normal -> nick | Normal -> nick