add TODO comments for various features missing from message handling
This commit is contained in:
parent
15a4475d3c
commit
ae8b837c56
|
@ -88,6 +88,7 @@ let on_msg_user t username modestr realname =
|
||||||
(* > messages and channels *)
|
(* > messages and channels *)
|
||||||
|
|
||||||
let on_msg_privmsg t tgt txt _ =
|
let on_msg_privmsg t tgt txt _ =
|
||||||
|
(* TODO: comma-separated list of targets *)
|
||||||
let msg = Irc.Msg.make "PRIVMSG" [tgt; txt] ~always_trailing:true in
|
let msg = Irc.Msg.make "PRIVMSG" [tgt; txt] ~always_trailing:true in
|
||||||
let dst =
|
let dst =
|
||||||
try
|
try
|
||||||
|
@ -100,7 +101,10 @@ let on_msg_privmsg t tgt txt _ =
|
||||||
match dst with
|
match dst with
|
||||||
| `not_found -> `nosuchnick tgt
|
| `not_found -> `nosuchnick tgt
|
||||||
| (`to_user _ | `to_chan _) as dst ->
|
| (`to_user _ | `to_chan _) as dst ->
|
||||||
(* TODO: check if allowed to send to channel *)
|
(* TODO: check if user is away *)
|
||||||
|
(* TODO: check if channel is +n and user is not a member *)
|
||||||
|
(* TODO: check if channel is +m and user is not priviledged *)
|
||||||
|
(* TODO: check if channel is +b <user> *)
|
||||||
Router.relay msg ~from:t.user dst;
|
Router.relay msg ~from:t.user dst;
|
||||||
`ok
|
`ok
|
||||||
|
|
||||||
|
@ -113,6 +117,7 @@ let list_names chan =
|
||||||
`names ("@", Chan.name chan, names)
|
`names ("@", Chan.name chan, names)
|
||||||
|
|
||||||
let on_msg_names t name _ =
|
let on_msg_names t name _ =
|
||||||
|
(* TODO: comma-separated list of channels *)
|
||||||
match Irc.name_type name with
|
match Irc.name_type name with
|
||||||
| `nick | `invalid ->
|
| `nick | `invalid ->
|
||||||
if name = "" then `needmoreparams else `nosuchchannel name
|
if name = "" then `needmoreparams else `nosuchchannel name
|
||||||
|
@ -120,12 +125,15 @@ let on_msg_names t name _ =
|
||||||
let chan = try Some (Router.find_chan t.router name)
|
let chan = try Some (Router.find_chan t.router name)
|
||||||
with Not_found -> None
|
with Not_found -> None
|
||||||
in
|
in
|
||||||
(* TODO: check if allowed to list names *)
|
(* TODO: check if channel is +s and user is not a member *)
|
||||||
|
(* TODO: check if user in channel is +i and user is not a member *)
|
||||||
match chan with
|
match chan with
|
||||||
| None -> `nosuchchannel name
|
| None -> `nosuchchannel name
|
||||||
| Some chan -> list_names chan
|
| Some chan -> list_names chan
|
||||||
|
|
||||||
let on_msg_join t name _ =
|
let on_msg_join t name _ =
|
||||||
|
(* TODO: comma-separated list of channels *)
|
||||||
|
(* TODO: "0" parameter means part from all channels *)
|
||||||
match Irc.name_type name with
|
match Irc.name_type name with
|
||||||
| `nick | `invalid ->
|
| `nick | `invalid ->
|
||||||
if name = "" then `needmoreparams else `nosuchchannel name
|
if name = "" then `needmoreparams else `nosuchchannel name
|
||||||
|
@ -134,13 +142,14 @@ let on_msg_join t name _ =
|
||||||
with Not_found ->
|
with Not_found ->
|
||||||
Logs.debug (fun m -> m "making new channel %S" name);
|
Logs.debug (fun m -> m "making new channel %S" name);
|
||||||
let chan = Chan.make ~name in
|
let chan = Chan.make ~name in
|
||||||
(* TODO: op user after joining *)
|
(* TODO: make user +o *)
|
||||||
Chan.register chan ~router:t.router;
|
Chan.register chan ~router:t.router;
|
||||||
chan
|
chan
|
||||||
in
|
in
|
||||||
if Chan.is_member chan t.user then
|
if Chan.is_member chan t.user then
|
||||||
`ok
|
`ok
|
||||||
else begin
|
else begin
|
||||||
|
(* TODO: check if channel is +k, get associated key from parameters *)
|
||||||
Chan.join chan t.user;
|
Chan.join chan t.user;
|
||||||
let msg = Irc.Msg.make "JOIN" [name] in
|
let msg = Irc.Msg.make "JOIN" [name] in
|
||||||
Router.relay msg ~from:t.user `to_self;
|
Router.relay msg ~from:t.user `to_self;
|
||||||
|
@ -149,6 +158,8 @@ let on_msg_join t name _ =
|
||||||
end
|
end
|
||||||
|
|
||||||
let on_msg_part t name _ =
|
let on_msg_part t name _ =
|
||||||
|
(* TODO: comma-separated list of channels *)
|
||||||
|
(* TODO: part reason *)
|
||||||
match Irc.name_type name with
|
match Irc.name_type name with
|
||||||
| `nick | `invalid ->
|
| `nick | `invalid ->
|
||||||
if name = "" then `needmoreparams else `nosuchchannel name
|
if name = "" then `needmoreparams else `nosuchchannel name
|
||||||
|
@ -179,6 +190,9 @@ let on_msg_part t name = require_registered t (on_msg_part t name)
|
||||||
(* > misc *)
|
(* > misc *)
|
||||||
|
|
||||||
let on_msg_quit t reason =
|
let on_msg_quit t reason =
|
||||||
|
(* TODO: '''When connections are terminated by a client-sent QUIT command, servers
|
||||||
|
SHOULD prepend <reason> with the ASCII string "Quit: " when sending QUIT messages to
|
||||||
|
other clients''' *)
|
||||||
let reason = String.concat " " reason in
|
let reason = String.concat " " reason in
|
||||||
shutdown t ~reason;
|
shutdown t ~reason;
|
||||||
`ok
|
`ok
|
||||||
|
|
Loading…
Reference in New Issue