summaryrefslogtreecommitdiff
path: root/Hsbot/Utils.hs
diff options
context:
space:
mode:
authorJulien Dessaux2010-05-16 00:01:00 +0200
committerJulien Dessaux2010-05-16 00:01:00 +0200
commitc1662ba7b982a8502dc9f32031b7cb518df7f60e (patch)
treef00dbd9cb39bf0fbc20949105ea2b93d9e868070 /Hsbot/Utils.hs
parentAdded the quote module. (diff)
downloadhsbot-c1662ba7b982a8502dc9f32031b7cb518df7f60e.tar.gz
hsbot-c1662ba7b982a8502dc9f32031b7cb518df7f60e.tar.bz2
hsbot-c1662ba7b982a8502dc9f32031b7cb518df7f60e.zip
Rewrote nearly everything!v0.2.0
* Rewrote the whole architecture to achieve extreme modularity * Added the ability to build a multiprotocol bot * Added cabal integration * Added configuration handling the XMonad style * Added configuration in ~/.hsbot * Refactored many many named and functions * Refactored data structures * Cleaned a big bunch of stuff
Diffstat (limited to 'Hsbot/Utils.hs')
-rw-r--r--Hsbot/Utils.hs42
1 files changed, 0 insertions, 42 deletions
diff --git a/Hsbot/Utils.hs b/Hsbot/Utils.hs
deleted file mode 100644
index 247a65c..0000000
--- a/Hsbot/Utils.hs
+++ /dev/null
@@ -1,42 +0,0 @@
-module Hsbot.Utils
- ( error
- , errorM
- , inColor
- , sendstr
- , trace
- , traceM
- ) where
-
-import Control.Monad.State
-import Data.List
-import System.IO
-
-import Hsbot.Types
-
--- |Wrap a string with ANSI escape sequences.
-inColor :: String -> [Int] -> String
-inColor str vals = "\ESC[" ++ valstr ++ "m" ++ str ++ "\ESC[0m"
- where valstr = concat . intersperse ";" $ map show vals
-
--- | Sends a string over handle
-sendstr :: String -> IrcBot ()
-sendstr str = do
- handle <- gets botHandle
- traceM $ inColor ("--> " ++ str) [33]
- liftIO $ hPutStr handle (str ++ "\r\n")
-
--- | Log a message string
-trace :: String -> IO ()
-trace msg = putStrLn msg
-
--- | Log a message string
-traceM :: String -> IrcBot ()
-traceM msg = liftIO $ trace msg
-
--- | Logs an error message
-traceRed :: String -> IO ()
-traceRed msg = trace $ inColor msg [31]
-
-errorM :: String -> IrcBot ()
-errorM msg = liftIO $ traceRed msg
-