slight connection.welcome refactor
This commit is contained in:
parent
b58e690cfc
commit
7dbd997b92
|
@ -343,24 +343,6 @@ let on_msg_part t name reason =
|
||||||
|
|
||||||
(* welcome and quit *)
|
(* welcome and quit *)
|
||||||
|
|
||||||
let about t me =
|
|
||||||
let who = Msg.prefix_string (User.prefix me) in
|
|
||||||
let s_hostname = Server_info.hostname t.server_info in
|
|
||||||
let s_version = Server_info.version t.server_info in
|
|
||||||
let s_created = Server_info.created t.server_info in
|
|
||||||
let conf = Server_info.conf t.server_info in
|
|
||||||
let modes l = String.of_seq (List.to_seq l |> Seq.map Mode.to_char) in
|
|
||||||
let umodes = modes conf.all_umodes in
|
|
||||||
let cmodes = modes conf.all_cmodes in
|
|
||||||
let pmodes = modes conf.all_pmodes in
|
|
||||||
begin
|
|
||||||
reply t ("001", [Fmt.str "Welcome to the tali IRC network %s" who]);
|
|
||||||
reply t ("002", [Fmt.str "Your host is %s, running version %s" s_hostname s_version]);
|
|
||||||
reply t ("003", [Fmt.str "This server was created %s" s_created]);
|
|
||||||
reply t ("004", [s_hostname; s_version; umodes; cmodes; pmodes]);
|
|
||||||
reply t ("005", conf.isupport);
|
|
||||||
end
|
|
||||||
|
|
||||||
let motd t =
|
let motd t =
|
||||||
let s_hostname = Server_info.hostname t.server_info in
|
let s_hostname = Server_info.hostname t.server_info in
|
||||||
let s_motd = Server_info.motd t.server_info in
|
let s_motd = Server_info.motd t.server_info in
|
||||||
|
@ -370,17 +352,30 @@ let motd t =
|
||||||
reply t ("376", ["End of /MOTD command"]);
|
reply t ("376", ["End of /MOTD command"]);
|
||||||
end
|
end
|
||||||
|
|
||||||
let welcome t me =
|
|
||||||
begin
|
|
||||||
about t me;
|
|
||||||
motd t;
|
|
||||||
end
|
|
||||||
|
|
||||||
let on_msg_motd t =
|
let on_msg_motd t =
|
||||||
let* _me = require_registered t in
|
let* _me = require_registered t in
|
||||||
motd t;
|
motd t;
|
||||||
Ok ()
|
Ok ()
|
||||||
|
|
||||||
|
let welcome t me =
|
||||||
|
let whoami = Msg.prefix_string (User.prefix me) in
|
||||||
|
let s_hostname = Server_info.hostname t.server_info in
|
||||||
|
let s_version = Server_info.version t.server_info in
|
||||||
|
let s_created = Server_info.created t.server_info in
|
||||||
|
let conf = Server_info.conf t.server_info in
|
||||||
|
let modes l = String.of_seq (List.to_seq l |> Seq.map Mode.to_char) in
|
||||||
|
let umodes = modes conf.all_umodes in
|
||||||
|
let cmodes = modes conf.all_cmodes in
|
||||||
|
let pmodes = modes conf.all_pmodes in
|
||||||
|
begin
|
||||||
|
reply t ("001", [Fmt.str "Welcome to the tali IRC network %s" whoami]);
|
||||||
|
reply t ("002", [Fmt.str "Your host is %s, running version %s" s_hostname s_version]);
|
||||||
|
reply t ("003", [Fmt.str "This server was created %s" s_created]);
|
||||||
|
reply t ("004", [s_hostname; s_version; umodes; cmodes; pmodes]);
|
||||||
|
reply t ("005", conf.isupport @ ["are supported by this server"]);
|
||||||
|
motd t;
|
||||||
|
end
|
||||||
|
|
||||||
let quit t me ~reason =
|
let quit t me ~reason =
|
||||||
begin
|
begin
|
||||||
let msg = Msg.make "QUIT" [User.nick me; reason] ~always_trailing:true in
|
let msg = Msg.make "QUIT" [User.nick me; reason] ~always_trailing:true in
|
||||||
|
|
|
@ -21,7 +21,6 @@ let isupport = [
|
||||||
"CHANTYPES=#";
|
"CHANTYPES=#";
|
||||||
"CHANMODES=b,k,l,imstn";
|
"CHANMODES=b,k,l,imstn";
|
||||||
"PREFIX=(ov)@+";
|
"PREFIX=(ov)@+";
|
||||||
"are supported by this server";
|
|
||||||
]
|
]
|
||||||
|
|
||||||
let default_conf = {
|
let default_conf = {
|
||||||
|
|
Loading…
Reference in New Issue