Expanded notion of channels

This commit is contained in:
Neale Pickett 2009-03-03 17:56:07 -07:00
parent 6dd5c6fd54
commit d7e7677547
4 changed files with 11 additions and 3 deletions

4
TODO
View File

@ -1 +1,3 @@
* * Modify Ocs_port to use Buffer instead of String

4
bot.ml
View File

@ -84,11 +84,11 @@ let handle_command iobuf cmd =
| (_, "PING", _, text) -> | (_, "PING", _, text) ->
write iobuf "PONG" [] text write iobuf "PONG" [] text
| (_, "001", _, _) -> | (_, "001", _, _) ->
write iobuf "JOIN" ["#bot"] None write iobuf "JOIN" ["+bot"] None
| (Some sender, "JOIN", [], Some chan) -> | (Some sender, "JOIN", [], Some chan) ->
write iobuf "PRIVMSG" [chan] (Some "hi asl") write iobuf "PRIVMSG" [chan] (Some "hi asl")
| (Some sender, "PRIVMSG", [target], Some text) -> | (Some sender, "PRIVMSG", [target], Some text) ->
if target.[0] = '#' then if Irc.is_channel target then
handle_privmsg iobuf sender target text handle_privmsg iobuf sender target text
| _ -> | _ ->
() ()

5
irc.ml
View File

@ -8,6 +8,11 @@ let dbg msg a =
prerr_endline ("[" ^ msg ^ "]"); prerr_endline ("[" ^ msg ^ "]");
a a
let is_channel str =
match str with
| '#' | '+' | '&' -> true
| _ -> false
let string_map f s = let string_map f s =
let l = String.length s in let l = String.length s in
if l = 0 then if l = 0 then

View File

@ -5,6 +5,7 @@ val name : string ref
val version : string val version : string
val start_time : float val start_time : float
val is_channel : string -> bool
val uppercase : string -> string val uppercase : string -> string
val lowercase : string -> string val lowercase : string -> string
val truncate : string -> int -> string val truncate : string -> int -> string