mirror of https://github.com/nealey/irc-bot
ISON
This commit is contained in:
parent
4d9ed389a2
commit
36ef378852
|
@ -16,7 +16,6 @@ let modes = "l"
|
||||||
|
|
||||||
let dbg msg a = prerr_endline msg; a
|
let dbg msg a = prerr_endline msg; a
|
||||||
|
|
||||||
let by_file_descr = Hashtbl.create 25
|
|
||||||
let by_nick = Hashtbl.create 25
|
let by_nick = Hashtbl.create 25
|
||||||
|
|
||||||
let error num args text =
|
let error num args text =
|
||||||
|
@ -24,7 +23,6 @@ let error num args text =
|
||||||
|
|
||||||
let close cli ues g fd =
|
let close cli ues g fd =
|
||||||
Hashtbl.remove by_nick !(cli.nick);
|
Hashtbl.remove by_nick !(cli.nick);
|
||||||
Hashtbl.remove by_file_descr fd;
|
|
||||||
Unix.close fd;
|
Unix.close fd;
|
||||||
Unixqueue.remove_resource ues g (Unixqueue.Wait_in fd);
|
Unixqueue.remove_resource ues g (Unixqueue.Wait_in fd);
|
||||||
try
|
try
|
||||||
|
@ -136,7 +134,8 @@ let handle_command cli iobuf cmd =
|
||||||
| (None, "WALLOPS", [], Some text) ->
|
| (None, "WALLOPS", [], Some text) ->
|
||||||
()
|
()
|
||||||
| (None, "ISON", nicks, None) ->
|
| (None, "ISON", nicks, None) ->
|
||||||
()
|
let ison = List.filter (Hashtbl.mem by_nick) nicks in
|
||||||
|
reply cli "303" (String.concat " " ison)
|
||||||
| (_, name, _, _) ->
|
| (_, name, _, _) ->
|
||||||
reply cli "421" ~args:[name] "Unknown or misconstructed command"
|
reply cli "421" ~args:[name] "Unknown or misconstructed command"
|
||||||
|
|
||||||
|
|
4
tests.ml
4
tests.ml
|
@ -65,6 +65,10 @@ let regression_tests =
|
||||||
Recv ":testserver.test PONG testserver.test :snot\r\n";
|
Recv ":testserver.test PONG testserver.test :snot\r\n";
|
||||||
Send "PING :snot\r\n";
|
Send "PING :snot\r\n";
|
||||||
Recv ":testserver.test PONG testserver.test :snot\r\n";
|
Recv ":testserver.test PONG testserver.test :snot\r\n";
|
||||||
|
Send "ISON nick otherguy\r\n";
|
||||||
|
Recv ":testserver.test 303 nick :nick\r\n";
|
||||||
|
Send "ISON otherguy thirdguy\r\n";
|
||||||
|
Recv ":testserver.test 303 nick :\r\n";
|
||||||
]));
|
]));
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue