diff --git a/TODO b/TODO index a767caf..45c7921 100644 --- a/TODO +++ b/TODO @@ -1 +1,3 @@ -* +* Modify Ocs_port to use Buffer instead of String + + diff --git a/bot.ml b/bot.ml index 18db4f0..210c87a 100644 --- a/bot.ml +++ b/bot.ml @@ -84,11 +84,11 @@ let handle_command iobuf cmd = | (_, "PING", _, text) -> write iobuf "PONG" [] text | (_, "001", _, _) -> - write iobuf "JOIN" ["#bot"] None + write iobuf "JOIN" ["+bot"] None | (Some sender, "JOIN", [], Some chan) -> write iobuf "PRIVMSG" [chan] (Some "hi asl") | (Some sender, "PRIVMSG", [target], Some text) -> - if target.[0] = '#' then + if Irc.is_channel target then handle_privmsg iobuf sender target text | _ -> () diff --git a/irc.ml b/irc.ml index 26bf66d..ebe14f6 100644 --- a/irc.ml +++ b/irc.ml @@ -8,6 +8,11 @@ let dbg msg a = prerr_endline ("[" ^ msg ^ "]"); a +let is_channel str = + match str with + | '#' | '+' | '&' -> true + | _ -> false + let string_map f s = let l = String.length s in if l = 0 then diff --git a/irc.mli b/irc.mli index 0d313c5..489e442 100644 --- a/irc.mli +++ b/irc.mli @@ -5,6 +5,7 @@ val name : string ref val version : string val start_time : float +val is_channel : string -> bool val uppercase : string -> string val lowercase : string -> string val truncate : string -> int -> string