fix quit logic; echo QUIT message

This commit is contained in:
tali 2024-01-08 01:05:03 -05:00
parent e7e641f266
commit d340708d4f
2 changed files with 9 additions and 3 deletions

View File

@ -171,7 +171,7 @@ let on_msg t (msg : Irc.Msg.t) : unit =
in
match result with
| `ok -> ()
| `quit -> close t
| `quit -> cleanup t
| `welcome -> rpl_welcome t; rpl_motd t
| `names (cp, ch, us) -> rpl_names t cp ch us
| `tryagain -> rpl_tryagain t msg.command

View File

@ -67,8 +67,14 @@ module User = struct
end
let cleanup t =
if is_registered t then begin
(* TODO: quit reason *)
send t (Irc.Msg.make "QUIT" ["Closed"]
~prefix:(prefix t)
~always_trailing:true);
(* TODO: relay QUIT message *)
unregister t;
unregister t
end;
close t
end