Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Commands where
- -- Cambiar todas los parámetros por listas, así reducimos las llamadas y podemos usar la intensional
- type IrcCommand = String
- type UserName = String
- type HostName = String
- type ServerName = String
- type NickName = String
- type NickPass = String
- type Message = String
- type MessageTarget = String
- type ChannelServ = String
- type NewTopic = String
- -- Login && Connect
- getUser :: UserName -> HostName -> ServerName -> NickName -> IrcCommand
- getUser u h s n = "USER " ++ u ++ " " ++ h ++ " " ++ s ++ " " ++ n
- getNick :: NickName -> IrcCommand
- getNick n = "NICK " ++ n
- joinIrc :: ChannelServ -> IrcCommand
- joinIrc c = "JOIN " ++ c
- -- User Functions
- setName :: NickName -> IrcCommand
- setName n = "SETNAME " ++ n
- quit :: Message -> IrcCommand
- quit m = "QUIT " ++ m
- -- Ejemplo Gestión:
- setPass :: [NickPass] -> IrcCommand
- setPass xs = "PASS " ++ (xs!!1)
- -- Message Functions
- privMsg :: MessageTarget -> Message -> IrcCommand
- privMsg mt m= "PRIVMSG " ++ mt ++ " " ++ m
- changeTopic :: [String] -> IrcCommand
- changeTopic xs = "TOPIC " ++ (xs!!1) ++ " " ++ (xs!!2)
- -- Other Functions
- listAllUsers :: IrcCommand
- listAllUsers = "LIST"
- --whoisUser :: NickName -> IrcCommand
- --whoisUser
- --banUser :: NickName -> IrcCommand
- --banUser x = "/mode +b " ++ "show(Socket.send(getUserIp x))"
- --pingUsers :: [String] -> IrcCommand
- --pingUsers [] = ""
- --pingUsers (x:xs) = "PING " ++ (concatUsers (x:xs))
- --concatUsers :: [NickName] -> String
- --concatUsers [] = ""
- -- Se concatenarán todos los usuarios activos, se usará para hacer ping global
- --concatUsers (x:xs) = show(Socket.send(getUserIP x)) ++ (concatUsers xs)
- getUserIP :: [NickName] -> ircCommand
- getUserIP xs = "USERIP " ++ (xs!!1)
- -- Admin Functions
- kickUser :: ChannelServ -> NickName -> IrcCommand
- kickUser c n = "KICK " ++ c ++ " " ++ n
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement