hask-irc/hask-irc-core/Network/IRC/Handlers/Auth/Types.hs

27 lines
688 B
Haskell
Raw Normal View History

2014-05-22 03:23:57 +05:30
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE NoImplicitPrelude #-}
2014-05-23 02:45:45 +05:30
{-# LANGUAGE TemplateHaskell #-}
2014-05-22 03:23:57 +05:30
module Network.IRC.Handlers.Auth.Types where
import ClassyPrelude
2014-05-25 01:09:31 +05:30
import Data.Data (Data)
import Data.SafeCopy (base, deriveSafeCopy)
2014-05-22 03:23:57 +05:30
import Network.IRC.Types hiding (user)
2014-05-25 01:09:31 +05:30
type Token = Text
2014-05-22 03:23:57 +05:30
newtype Auth = Auth { auth :: Map Nick Token } deriving (Eq, Show, Data, Typeable)
2014-05-22 20:59:02 +05:30
emptyAuth :: Auth
emptyAuth = Auth mempty
2014-05-23 02:45:45 +05:30
$(deriveSafeCopy 0 'base ''Auth)
2014-05-22 03:23:57 +05:30
data AuthEvent = AuthEvent Nick Token (MVar Bool) deriving (Typeable)
2014-05-22 20:59:02 +05:30
2014-05-22 03:23:57 +05:30
instance Event AuthEvent
2014-05-22 20:59:02 +05:30
2014-05-22 03:23:57 +05:30
instance Show AuthEvent where
show (AuthEvent user token _) = "AuthEvent[" ++ unpack user ++ ", " ++ unpack token ++ "]"