    then pong s
  else eval (clean s)
  where
    clean = drop 1 . dropWhile (/= ':') . drop 1
    ping x = "PING :" `isPrefixOf` x
    pong x = write "PONG" (':' : drop 6 x)

eval :: String -> Net ()
eval "!quit" = write "QUIT" ":Exiting" >> io exitSuccess
eval x       | "!id " `isPrefixOf` x = privmsg (drop 4 x)
eval _       = return ()

privmsg :: String -> Net ()
privmsg s = write "PRIVMSG" (chan ++ " :" ++ s)
