talircd/lib/server/server_info.ml

53 lines
1.1 KiB
OCaml

open! Import
include (Meta_server_info : sig
val version : string
end)
let tz_offset_s = Ptime_clock.current_tz_offset_s ()
let pp_time = Ptime.pp_human () ?tz_offset_s
type t = {
version : string;
created : string;
hostname : string;
admin_info : string;
motd : string list;
conf : conf;
}
and conf = {
isupport : string list;
all_umodes : Mode.user list;
all_cmodes : Mode.chan_d list;
all_pmodes : [Mode.chan_a | Mode.chan_b | Mode.chan_c] list;
init_umode : Mode.Set.t;
init_cmode : Mode.Set.t;
}
let isupport = [
"CASEMAPPING=ascii";
"CHANTYPES=#";
"CHANMODES=b,k,l,imstn";
"PREFIX=(ov)@+";
]
let default_conf = {
isupport;
all_umodes = [`i; `o; `w];
all_cmodes = [`i; `m; `n; `s; `t];
all_pmodes = [`b; `k; `l; `o; `v];
init_umode = Mode.Set.of_list [`i; `w];
init_cmode = Mode.Set.of_list [`n; `s; `t];
}
let make ?(conf = default_conf) ~hostname ~motd () = {
version;
created = Fmt.str "%a" pp_time (Ptime_clock.now ());
admin_info = "the admin of this server is @iitalics@octodon.social";
hostname;
motd;
conf;
}
let prefix t = Msg.Server_prefix t.hostname