diff options
author | tv <tv@krebsco.de> | 2019-01-24 17:22:03 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-01-24 17:25:19 +0100 |
commit | d5f66b27b2cd7c36eb7c2e81b0cdca10c5a5ef90 (patch) | |
tree | d0da96518550cf181194d1a3f02ef3680454448e /src/Reaktor/Plugins/Register.hs | |
parent | a4b7708483dd32bc7256288faefa300d3fc13f7b (diff) |
src: ByteString -> Textv0.1.2
Diffstat (limited to 'src/Reaktor/Plugins/Register.hs')
-rw-r--r-- | src/Reaktor/Plugins/Register.hs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Reaktor/Plugins/Register.hs b/src/Reaktor/Plugins/Register.hs index 0809006..ff420f0 100644 --- a/src/Reaktor/Plugins/Register.hs +++ b/src/Reaktor/Plugins/Register.hs @@ -7,15 +7,15 @@ module Reaktor.Plugins.Register where import Blessings import Prelude.Extended import Data.Aeson -import Data.ByteString.Char8.Extended (ByteString) -import qualified Data.ByteString.Char8.Extended as BS +import qualified Data.Text as T +import qualified Data.Text.IO as T import qualified Reaktor.Nick as Nick import Reaktor import System.Environment (lookupEnv) data ConfigNickServ = ConfigNickServ { cnsPassFile :: FilePath - , cnsPrefix :: ByteString + , cnsPrefix :: Text } instance FromJSON ConfigNickServ where parseJSON = \case @@ -26,10 +26,10 @@ instance FromJSON ConfigNickServ where _ -> undefined data Config = Config - { cNick :: Maybe ByteString - , cUser :: Maybe ByteString - , cReal :: ByteString - , cChannels :: [ByteString] + { cNick :: Maybe Text + , cUser :: Maybe Text + , cReal :: Text + , cChannels :: [Text] , cNickServ :: Maybe ConfigNickServ } instance Default Config where @@ -54,18 +54,18 @@ new Config{..} Actions{..} = do regain nick pass = do aSend (privmsg "NickServ" ["REGAIN", nick, pass]) - channelsArg = BS.intercalate "," cChannels + channelsArg = T.intercalate "," cChannels -- TODO make this similar to privmsg (i.e. don't aSend) join = do -- TODO JOIN only if not already joined -- i.e. not during subsequent nick changes - unless (BS.null channelsArg) $ + unless (T.null channelsArg) $ aSend (Message Nothing "JOIN" [channelsArg]) start = do nick <- maybe aGetNick pure cNick user <- - maybe (maybe nick BS.pack <$> lookupEnv "LOGNAME") pure cUser + maybe (maybe nick T.pack <$> lookupEnv "LOGNAME") pure cUser aSetNick nick aSend (Message Nothing "NICK" [nick]) aSend (Message Nothing "USER" [user, "*", "0", cReal]) @@ -103,7 +103,7 @@ new Config{..} Actions{..} = do else do -- TODO do not fail, but disable NicServ - [pass] <- BS.lines <$> BS.readFile cnsPassFile + [pass] <- T.lines <$> T.readFile cnsPassFile pure $ \case Start -> start Message (Just _self) "NICK" (newnick:[]) -> onNick newnick |