irc-fun-client 0.2.0.0 → 0.3.0.0
raw patch · 5 files changed
+65/−3 lines, 5 filesdep ~irc-fun-messagesPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: irc-fun-messages
API changes (from Hackage documentation)
- Network.IRC.Fun.Client.ChannelLogger: instance Show ChanLogEvent
- Network.IRC.Fun.Client.ChannelLogger: instance Show LogEvent
- Network.IRC.Fun.Client.Events: instance Show Event
- Network.IRC.Fun.Client.IO: instance Eq Connection
- Network.IRC.Fun.Client.IO: instance Show Connection
- Network.IRC.Fun.Client.IO: nick :: Connection -> String
- Network.IRC.Fun.Client.IO: password :: Connection -> Maybe String
- Network.IRC.Fun.Client.IO: port :: Connection -> Int
- Network.IRC.Fun.Client.IO: server :: Connection -> String
- Network.IRC.Fun.Client.IO: tls :: Connection -> Bool
+ Network.IRC.Fun.Client.ChannelLogger: ActInChan :: NickName -> String -> ChanLogEvent
+ Network.IRC.Fun.Client.ChannelLogger: Action :: NickName -> ChannelName -> String -> LogEvent
+ Network.IRC.Fun.Client.ChannelLogger: instance GHC.Show.Show Network.IRC.Fun.Client.ChannelLogger.ChanLogEvent
+ Network.IRC.Fun.Client.ChannelLogger: instance GHC.Show.Show Network.IRC.Fun.Client.ChannelLogger.LogEvent
+ Network.IRC.Fun.Client.Commands: ircActToChannel :: Handle -> String -> String -> IO ()
+ Network.IRC.Fun.Client.Commands: ircActToUser :: Handle -> String -> String -> IO ()
+ Network.IRC.Fun.Client.Events: ChannelAction :: String -> String -> String -> Event
+ Network.IRC.Fun.Client.Events: Pong :: String -> (Maybe String) -> Event
+ Network.IRC.Fun.Client.Events: PrivateAction :: String -> String -> Event
+ Network.IRC.Fun.Client.Events: instance GHC.Show.Show Network.IRC.Fun.Client.Events.Event
+ Network.IRC.Fun.Client.IO: [nick] :: Connection -> String
+ Network.IRC.Fun.Client.IO: [password] :: Connection -> Maybe String
+ Network.IRC.Fun.Client.IO: [port] :: Connection -> Int
+ Network.IRC.Fun.Client.IO: [server] :: Connection -> String
+ Network.IRC.Fun.Client.IO: [tls] :: Connection -> Bool
+ Network.IRC.Fun.Client.IO: instance GHC.Classes.Eq Network.IRC.Fun.Client.IO.Connection
+ Network.IRC.Fun.Client.IO: instance GHC.Show.Show Network.IRC.Fun.Client.IO.Connection
Files
- NEWS +24/−0
- irc-fun-client.cabal +2/−2
- src/Network/IRC/Fun/Client/ChannelLogger.hs +4/−0
- src/Network/IRC/Fun/Client/Commands.hs +18/−0
- src/Network/IRC/Fun/Client/Events.hs +17/−1
NEWS view
@@ -3,6 +3,30 @@ +irc-fun-client 0.3.0.0 -- 2015-10-17+====================================++General, build and documentation changes:++* (None)++New APIs, features and enhancements:++* Add Pong event+* Add action message events (/me)++Bug fixes:++* (None)++Dependency changes:++* (None)+++++ irc-fun-client 0.2.0.0 -- 2015-09-22 ====================================
irc-fun-client.cabal view
@@ -1,5 +1,5 @@ name: irc-fun-client-version: 0.2.0.0+version: 0.3.0.0 synopsis: Another library for writing IRC clients. description: This is an IRC client library that uses @irc-fun-messages@ library package@@ -35,7 +35,7 @@ -- other-extensions: build-depends: auto-update , base >=4.7 && <5- , irc-fun-messages+ , irc-fun-messages >=0.2 , fast-logger >=2.4.1 , network >=2.3 , time >=1.5
src/Network/IRC/Fun/Client/ChannelLogger.hs view
@@ -42,6 +42,7 @@ = EnterChan NickName | LeaveChan NickName | MessageChan NickName String+ | ActInChan NickName String | RenameInChan NickName NickName deriving Show @@ -50,6 +51,7 @@ | Leave NickName ChannelName | LeaveAll NickName | Message NickName ChannelName String+ | Action NickName ChannelName String | Rename NickName NickName deriving Show @@ -91,6 +93,7 @@ EnterChan nick -> "|-->| " <> toLogStr nick <> " has joined" LeaveChan nick -> "|<--| " <> toLogStr nick <> " has left" MessageChan nick msg -> "<" <> toLogStr nick <> "> " <> toLogStr msg+ ActInChan nick msg -> "* " <> toLogStr nick <> " " <> toLogStr msg RenameInChan old new -> "|---| " <> toLogStr old <> " is now known as " <> toLogStr new @@ -113,5 +116,6 @@ Part chan nick _reason -> Just $ Leave nick chan Quit nick _reason -> Just $ LeaveAll nick ChannelMessage chan nick msg _notice -> Just $ Message nick chan msg+ ChannelAction chan nick msg -> Just $ Action nick chan msg NickChange old new -> Just $ Rename old new _ -> Nothing
src/Network/IRC/Fun/Client/Commands.hs view
@@ -25,7 +25,9 @@ , ircPartMulti , ircPartAll , ircSendToUser+ , ircActToUser , ircSendToChannel+ , ircActToChannel , ircQuit ) where@@ -113,6 +115,14 @@ ircSendToUser h nick msg = hPutIrc h $ PrivMsgMessage (UserTarget (Just nick) Nothing Nothing) msg +-- | Send a private /me message to an IRC user.+ircActToUser :: Handle -- ^ Handle to the open socket+ -> String -- ^ The user's nickname+ -> String -- ^ The message to send+ -> IO ()+ircActToUser h nick msg =+ hPutIrc h $ PrivActionMessage (UserTarget (Just nick) Nothing Nothing) msg+ -- | Send a message to an IRC channel. ircSendToChannel :: Handle -- ^ Handle to the open socket -> String -- ^ The channel name@@ -120,6 +130,14 @@ -> IO () ircSendToChannel h chan msg = hPutIrc h $ PrivMsgMessage (ChannelTarget chan) msg++-- | Send a /me message to an IRC channel.+ircActToChannel :: Handle -- ^ Handle to the open socket+ -> String -- ^ The channel name+ -> String -- ^ The message to send+ -> IO ()+ircActToChannel h chan msg =+ hPutIrc h $ PrivActionMessage (ChannelTarget chan) msg -- | Finish the IRC session, asking the server to close the connection. ircQuit :: Handle -- ^ Handle to the open socket
src/Network/IRC/Fun/Client/Events.hs view
@@ -38,6 +38,8 @@ -- optionally a server to forward the response to. They can be passed as-is -- directly to the PONG response. = Ping String (Maybe String)+ -- | A ping response sent by the server.+ | Pong String (Maybe String) -- | One or more users have been kicked from a channel for an optionally -- given reason. Parameters: Channel, nicknames, reason. | Kick String [String] (Maybe String)@@ -56,11 +58,15 @@ -- automatically send a response. Parameters: Channel, nickname, message, -- whether notice. | ChannelMessage String String String Bool+ -- | A channel message that is a virtual action (/me).+ | ChannelAction String String String -- | A private message sent specifically to the client from a user. The -- last parameter indicates whether the message is actually a notice. If -- yes, the client shouldn't send any automatic response. Parameters: -- Nickname, message, whether notice. | PrivateMessage String String Bool+ -- | A private message that is a virtual action (/me).+ | PrivateAction String String -- | A user's nickname has changed. Parameters: Old nick, new nick. | NickChange String String -- | Channel topic change. Parameterss: Channel, nickname of user who@@ -105,6 +111,7 @@ then other else one $ Topic chan sender $ fromMaybe "" topic PingMessage s ms -> one $ Ping s ms+ PongMessage s ms -> one $ Pong s ms KickMessage [] _ _ -> err KickMessage _ [] _ -> err KickMessage [chan] nicks comment ->@@ -119,11 +126,20 @@ if null sender then other else one $ ChannelMessage chan sender text False- PrivMsgMessage (UserTarget _ _ _) text ->+ PrivMsgMessage (UserTarget _ _ _) text -> if null sender then err else one $ PrivateMessage sender text False PrivMsgMessage (MaskTarget _) _ -> other+ PrivActionMessage (ChannelTarget chan) text ->+ if null sender+ then other+ else one $ ChannelAction chan sender text+ PrivActionMessage (UserTarget _ _ _) text ->+ if null sender+ then err+ else one $ PrivateAction sender text+ PrivActionMessage (MaskTarget _) _ -> other _ -> other where other = Right [OtherEvent $ show sm]