{-# Language OverloadedStrings #-}
module Client.Commands.Queries (queryCommands) where
import Client.Commands.Arguments.Spec
import Client.Commands.TabCompletion
import Client.Commands.Types
import Client.State.Network (sendMsg)
import qualified Data.Text as Text
import Irc.Commands
queryCommands :: CommandSection
queryCommands :: CommandSection
queryCommands = Text -> [Command] -> CommandSection
CommandSection Text
"Queries"
[ NonEmpty Text
-> Args ClientState String -> Text -> CommandImpl String -> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"who")
(String -> Args ClientState String
forall r. String -> Args r String
remainingArg String
"arguments")
Text
"Send WHO query to server with given arguments.\n"
(CommandImpl String -> Command) -> CommandImpl String -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand String
-> (Bool -> NetworkCommand String) -> CommandImpl String
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand String
cmdWho Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState String -> Text -> CommandImpl String -> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"whois")
(String -> Args ClientState String
forall r. String -> Args r String
remainingArg String
"arguments")
Text
"Send WHOIS query to server with given arguments.\n"
(CommandImpl String -> Command) -> CommandImpl String -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand String
-> (Bool -> NetworkCommand String) -> CommandImpl String
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand String
cmdWhois Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState String -> Text -> CommandImpl String -> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"whowas")
(String -> Args ClientState String
forall r. String -> Args r String
remainingArg String
"arguments")
Text
"Send WHOWAS query to server with given arguments.\n"
(CommandImpl String -> Command) -> CommandImpl String -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand String
-> (Bool -> NetworkCommand String) -> CommandImpl String
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand String
cmdWhowas Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState String -> Text -> CommandImpl String -> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"ison")
(String -> Args ClientState String
forall r. String -> Args r String
remainingArg String
"arguments")
Text
"Send ISON query to server with given arguments.\n"
(CommandImpl String -> Command) -> CommandImpl String -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand String
-> (Bool -> NetworkCommand String) -> CommandImpl String
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand String
cmdIson Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState String -> Text -> CommandImpl String -> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"userhost")
(String -> Args ClientState String
forall r. String -> Args r String
remainingArg String
"arguments")
Text
"Send USERHOST query to server with given arguments.\n"
(CommandImpl String -> Command) -> CommandImpl String -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand String
-> (Bool -> NetworkCommand String) -> CommandImpl String
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand String
cmdUserhost Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState (Maybe String)
-> Text
-> CommandImpl (Maybe String)
-> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"time")
(Args ClientState String -> Args ClientState (Maybe String)
forall r a. Args r a -> Args r (Maybe a)
optionalArg (String -> Args ClientState String
forall r. String -> Args r String
simpleToken String
"[servername]"))
Text
"Send TIME query to server with given arguments.\n"
(CommandImpl (Maybe String) -> Command)
-> CommandImpl (Maybe String) -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand (Maybe String)
-> (Bool -> NetworkCommand String) -> CommandImpl (Maybe String)
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand (Maybe String)
cmdTime Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState String -> Text -> CommandImpl String -> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"stats")
(String -> Args ClientState String
forall r. String -> Args r String
remainingArg String
"arguments")
Text
"Send STATS query to server with given arguments.\n"
(CommandImpl String -> Command) -> CommandImpl String -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand String
-> (Bool -> NetworkCommand String) -> CommandImpl String
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand String
cmdStats Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState (Maybe String)
-> Text
-> CommandImpl (Maybe String)
-> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"lusers")
(Args ClientState String -> Args ClientState (Maybe String)
forall r a. Args r a -> Args r (Maybe a)
optionalArg (String -> Args ClientState String
forall r. String -> Args r String
simpleToken String
"[servername]"))
Text
"Send LUSERS query to a given server.\n"
(CommandImpl (Maybe String) -> Command)
-> CommandImpl (Maybe String) -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand (Maybe String)
-> (Bool -> NetworkCommand String) -> CommandImpl (Maybe String)
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand (Maybe String)
cmdLusers Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState (Maybe String)
-> Text
-> CommandImpl (Maybe String)
-> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"users")
(Args ClientState String -> Args ClientState (Maybe String)
forall r a. Args r a -> Args r (Maybe a)
optionalArg (String -> Args ClientState String
forall r. String -> Args r String
simpleToken String
"[servername]"))
Text
"Send USERS query to a given server.\n"
(CommandImpl (Maybe String) -> Command)
-> CommandImpl (Maybe String) -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand (Maybe String)
-> (Bool -> NetworkCommand String) -> CommandImpl (Maybe String)
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand (Maybe String)
cmdUsers Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState (Maybe String)
-> Text
-> CommandImpl (Maybe String)
-> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"motd") (Args ClientState String -> Args ClientState (Maybe String)
forall r a. Args r a -> Args r (Maybe a)
optionalArg (String -> Args ClientState String
forall r. String -> Args r String
simpleToken String
"[servername]"))
Text
"Send MOTD query to server.\n"
(CommandImpl (Maybe String) -> Command)
-> CommandImpl (Maybe String) -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand (Maybe String)
-> (Bool -> NetworkCommand String) -> CommandImpl (Maybe String)
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand (Maybe String)
cmdMotd Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState (Maybe String)
-> Text
-> CommandImpl (Maybe String)
-> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"admin") (Args ClientState String -> Args ClientState (Maybe String)
forall r a. Args r a -> Args r (Maybe a)
optionalArg (String -> Args ClientState String
forall r. String -> Args r String
simpleToken String
"[servername]"))
Text
"Send ADMIN query to server.\n"
(CommandImpl (Maybe String) -> Command)
-> CommandImpl (Maybe String) -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand (Maybe String)
-> (Bool -> NetworkCommand String) -> CommandImpl (Maybe String)
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand (Maybe String)
cmdAdmin Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState (Maybe String)
-> Text
-> CommandImpl (Maybe String)
-> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"rules") (Args ClientState String -> Args ClientState (Maybe String)
forall r a. Args r a -> Args r (Maybe a)
optionalArg (String -> Args ClientState String
forall r. String -> Args r String
simpleToken String
"[servername]"))
Text
"Send RULES query to server.\n"
(CommandImpl (Maybe String) -> Command)
-> CommandImpl (Maybe String) -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand (Maybe String)
-> (Bool -> NetworkCommand String) -> CommandImpl (Maybe String)
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand (Maybe String)
cmdRules Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState () -> Text -> CommandImpl () -> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"info") (() -> Args ClientState ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
Text
"Send INFO query to server.\n"
(CommandImpl () -> Command) -> CommandImpl () -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand ()
-> (Bool -> NetworkCommand String) -> CommandImpl ()
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand ()
cmdInfo Bool -> NetworkCommand String
noNetworkTab
, NonEmpty Text
-> Args ClientState String -> Text -> CommandImpl String -> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"list") (String -> Args ClientState String
forall r. String -> Args r String
remainingArg String
"arguments")
Text
"Send LIST query to server.\n"
(CommandImpl String -> Command) -> CommandImpl String -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand String
-> (Bool -> NetworkCommand String) -> CommandImpl String
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand String
cmdList Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState String -> Text -> CommandImpl String -> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"links")
(String -> Args ClientState String
forall r. String -> Args r String
remainingArg String
"arguments")
Text
"Send LINKS query to server with given arguments.\n"
(CommandImpl String -> Command) -> CommandImpl String -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand String
-> (Bool -> NetworkCommand String) -> CommandImpl String
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand String
cmdLinks Bool -> NetworkCommand String
simpleNetworkTab
, NonEmpty Text
-> Args ClientState (Maybe String)
-> Text
-> CommandImpl (Maybe String)
-> Command
forall a.
NonEmpty Text
-> Args ClientState a -> Text -> CommandImpl a -> Command
Command
(Text -> NonEmpty Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"version") (Args ClientState String -> Args ClientState (Maybe String)
forall r a. Args r a -> Args r (Maybe a)
optionalArg (String -> Args ClientState String
forall r. String -> Args r String
simpleToken String
"[servername]"))
Text
"Send VERSION query to server.\n"
(CommandImpl (Maybe String) -> Command)
-> CommandImpl (Maybe String) -> Command
forall a b. (a -> b) -> a -> b
$ NetworkCommand (Maybe String)
-> (Bool -> NetworkCommand String) -> CommandImpl (Maybe String)
forall a.
NetworkCommand a
-> (Bool -> NetworkCommand String) -> CommandImpl a
NetworkCommand NetworkCommand (Maybe String)
cmdVersion Bool -> NetworkCommand String
simpleNetworkTab
]
cmdInfo :: NetworkCommand ()
cmdInfo :: NetworkCommand ()
cmdInfo NetworkState
cs ClientState
st ()
_ =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs RawIrcMsg
ircInfo
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdVersion :: NetworkCommand (Maybe String)
cmdVersion :: NetworkCommand (Maybe String)
cmdVersion NetworkState
cs ClientState
st Maybe String
mbservername =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs (RawIrcMsg -> IO ()) -> RawIrcMsg -> IO ()
forall a b. (a -> b) -> a -> b
$ Text -> RawIrcMsg
ircVersion (Text -> RawIrcMsg) -> Text -> RawIrcMsg
forall a b. (a -> b) -> a -> b
$ case Maybe String
mbservername of
Just String
s -> String -> Text
Text.pack String
s
Maybe String
Nothing -> Text
""
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdList :: NetworkCommand String
cmdList :: NetworkCommand String
cmdList NetworkState
cs ClientState
st String
rest =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs ([Text] -> RawIrcMsg
ircList (String -> Text
Text.pack (String -> Text) -> [String] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> [String]
words String
rest))
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdLusers :: NetworkCommand (Maybe String)
cmdLusers :: NetworkCommand (Maybe String)
cmdLusers NetworkState
cs ClientState
st Maybe String
arg =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs (RawIrcMsg -> IO ()) -> RawIrcMsg -> IO ()
forall a b. (a -> b) -> a -> b
$ [Text] -> RawIrcMsg
ircLusers ([Text] -> RawIrcMsg) -> [Text] -> RawIrcMsg
forall a b. (a -> b) -> a -> b
$ (String -> Text) -> [String] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Text
Text.pack ([String] -> [Text]) -> [String] -> [Text]
forall a b. (a -> b) -> a -> b
$
case Maybe String
arg of
Maybe String
Nothing -> []
Just String
x -> [String
"*", String
x]
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdUsers :: NetworkCommand (Maybe String)
cmdUsers :: NetworkCommand (Maybe String)
cmdUsers NetworkState
cs ClientState
st Maybe String
arg =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs (RawIrcMsg -> IO ()) -> RawIrcMsg -> IO ()
forall a b. (a -> b) -> a -> b
$ Text -> RawIrcMsg
ircUsers (Text -> RawIrcMsg) -> Text -> RawIrcMsg
forall a b. (a -> b) -> a -> b
$ Text -> (String -> Text) -> Maybe String -> Text
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"" String -> Text
Text.pack Maybe String
arg
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdMotd :: NetworkCommand (Maybe String)
cmdMotd :: NetworkCommand (Maybe String)
cmdMotd NetworkState
cs ClientState
st Maybe String
mbservername =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs (RawIrcMsg -> IO ()) -> RawIrcMsg -> IO ()
forall a b. (a -> b) -> a -> b
$ Text -> RawIrcMsg
ircMotd (Text -> RawIrcMsg) -> Text -> RawIrcMsg
forall a b. (a -> b) -> a -> b
$ case Maybe String
mbservername of
Just String
s -> String -> Text
Text.pack String
s
Maybe String
Nothing -> Text
""
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdAdmin :: NetworkCommand (Maybe String)
cmdAdmin :: NetworkCommand (Maybe String)
cmdAdmin NetworkState
cs ClientState
st Maybe String
mbservername =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs (RawIrcMsg -> IO ()) -> RawIrcMsg -> IO ()
forall a b. (a -> b) -> a -> b
$ Text -> RawIrcMsg
ircAdmin (Text -> RawIrcMsg) -> Text -> RawIrcMsg
forall a b. (a -> b) -> a -> b
$ case Maybe String
mbservername of
Just String
s -> String -> Text
Text.pack String
s
Maybe String
Nothing -> Text
""
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdRules :: NetworkCommand (Maybe String)
cmdRules :: NetworkCommand (Maybe String)
cmdRules NetworkState
cs ClientState
st Maybe String
mbservername =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs (RawIrcMsg -> IO ()) -> RawIrcMsg -> IO ()
forall a b. (a -> b) -> a -> b
$ Text -> RawIrcMsg
ircRules (Text -> RawIrcMsg) -> Text -> RawIrcMsg
forall a b. (a -> b) -> a -> b
$
case Maybe String
mbservername of
Just String
s -> String -> Text
Text.pack String
s
Maybe String
Nothing -> Text
""
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdStats :: NetworkCommand String
cmdStats :: NetworkCommand String
cmdStats NetworkState
cs ClientState
st String
rest =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs ([Text] -> RawIrcMsg
ircStats (String -> Text
Text.pack (String -> Text) -> [String] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> [String]
words String
rest))
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdLinks :: NetworkCommand String
cmdLinks :: NetworkCommand String
cmdLinks NetworkState
cs ClientState
st String
rest =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs ([Text] -> RawIrcMsg
ircLinks (String -> Text
Text.pack (String -> Text) -> [String] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> [String]
words String
rest))
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdTime :: NetworkCommand (Maybe String)
cmdTime :: NetworkCommand (Maybe String)
cmdTime NetworkState
cs ClientState
st Maybe String
arg =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs (Text -> RawIrcMsg
ircTime (Text -> (String -> Text) -> Maybe String -> Text
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"" String -> Text
Text.pack Maybe String
arg))
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdWhois :: NetworkCommand String
cmdWhois :: NetworkCommand String
cmdWhois NetworkState
cs ClientState
st String
rest =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs ([Text] -> RawIrcMsg
ircWhois (String -> Text
Text.pack (String -> Text) -> [String] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> [String]
words String
rest))
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdWho :: NetworkCommand String
cmdWho :: NetworkCommand String
cmdWho NetworkState
cs ClientState
st String
rest =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs ([Text] -> RawIrcMsg
ircWho (String -> Text
Text.pack (String -> Text) -> [String] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> [String]
words String
rest))
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdWhowas :: NetworkCommand String
cmdWhowas :: NetworkCommand String
cmdWhowas NetworkState
cs ClientState
st String
rest =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs ([Text] -> RawIrcMsg
ircWhowas (String -> Text
Text.pack (String -> Text) -> [String] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> [String]
words String
rest))
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdIson :: NetworkCommand String
cmdIson :: NetworkCommand String
cmdIson NetworkState
cs ClientState
st String
rest =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs ([Text] -> RawIrcMsg
ircIson (String -> Text
Text.pack (String -> Text) -> [String] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> [String]
words String
rest))
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st
cmdUserhost :: NetworkCommand String
cmdUserhost :: NetworkCommand String
cmdUserhost NetworkState
cs ClientState
st String
rest =
do NetworkState -> RawIrcMsg -> IO ()
sendMsg NetworkState
cs ([Text] -> RawIrcMsg
ircUserhost (String -> Text
Text.pack (String -> Text) -> [String] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> [String]
words String
rest))
ClientState -> IO CommandResult
forall (m :: * -> *). Monad m => ClientState -> m CommandResult
commandSuccess ClientState
st