packages feed

irc-dcc 1.0.0 → 1.1.0

raw patch · 4 files changed

+93/−37 lines, 4 filesdep ~attoparsecdep ~binarydep ~bytestringPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: attoparsec, binary, bytestring, errors, hspec-attoparsec, io-streams, iproute, irc-ctcp, network, path, tasty, tasty-hspec, transformers, utf8-string

API changes (from Hackage documentation)

- Network.IRC.DCC: data Token
- Network.IRC.DCC: type FileOffset = Word64
+ Network.IRC.DCC: data FileOffset
+ Network.IRC.DCC: newtype Token

Files

irc-dcc.cabal view
@@ -1,5 +1,5 @@ name:                 irc-dcc-version:              1.0.0+version:              1.1.0 synopsis:             A DCC message parsing and helper library for IRC clients description:          DCC (Direct Client-to-Client) is an IRC sub-protocol for                       establishing and maintaining direct connections to@@ -26,17 +26,17 @@                       , Network.Socket.ByteString.Extended   -- other-extensions:   build-depends:        base >= 4.7 && < 5-                      , attoparsec-                      , binary-                      , bytestring-                      , errors-                      , io-streams-                      , iproute-                      , irc-ctcp-                      , network-                      , path-                      , transformers-                      , utf8-string+                      , attoparsec >= 0.13.0.1 && < 0.14+                      , binary >= 0.7.5.0 && < 0.8+                      , bytestring >= 0.10.6.0 && < 0.11+                      , errors >= 2.1.2 && < 2.2+                      , io-streams >= 1.3.5.0 && < 1.4+                      , iproute >= 1.7.0 && < 1.8+                      , irc-ctcp >= 0.1.3.0 && < 0.2+                      , network >= 2.6.2.1 && < 2.7+                      , path >= 0.5.7 && < 0.6+                      , transformers >= 0.4.2.0 && < 0.5+                      , utf8-string >= 1.0.1.1 && < 1.1   default-language:     Haskell2010   ghc-options:          -Wall -fno-warn-unused-do-bind @@ -48,17 +48,17 @@                       , Network.IRC.DCC.Internal   type:                 exitcode-stdio-1.0   build-depends:        base >= 4.7 && < 5-                      , tasty-                      , tasty-hspec-                      , hspec-attoparsec-                      , attoparsec-                      , binary-                      , bytestring-                      , iproute-                      , irc-ctcp-                      , network-                      , path-                      , utf8-string+                      , tasty >= 0.11.0.2 && < 0.12+                      , tasty-hspec >= 1.1.2 && < 1.2+                      , hspec-attoparsec >= 0.1.0.2 && < 0.2+                      , attoparsec >= 0.13.0.1 && < 0.14+                      , binary >= 0.7.5.0 && < 0.8+                      , bytestring >= 0.10.6.0 && < 0.11+                      , iproute >= 1.7.0 && < 1.8+                      , irc-ctcp >= 0.1.3.0 && < 0.2+                      , network >= 2.6.2.1 && < 2.7+                      , path >= 0.5.7 && < 0.6+                      , utf8-string >= 1.0.1.1 && < 1.1   default-language:     Haskell2010  source-repository head
src/Network/IRC/DCC.hs view
@@ -1,3 +1,13 @@+{-| DCC command parsing and encoding module.++    Example of parsing an offer file command:++    > runParser parseOfferFile ctcpMessage++    Example of encoding an offer file command:++    > encodeCtcp offerFile+-} module Network.IRC.DCC (   -- * Types   -- ** DCC service
src/Network/IRC/DCC/FileTransfer.hs view
@@ -18,7 +18,7 @@ import           Path                               (File, Path, Rel,                                                      fromRelFile) import           Prelude                            hiding (length, null)-import           System.IO                          (BufferMode (NoBuffering), IOMode (WriteMode, AppendMode))+import           System.IO                          (BufferMode (NoBuffering), IOMode (AppendMode, WriteMode)) import           System.IO.Streams                  (OutputStream,                                                      withFileAsOutputExt, write) 
src/Network/IRC/DCC/Internal.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE OverloadedStrings          #-}  module Network.IRC.DCC.Internal where @@ -29,29 +30,70 @@  -- | Type of DCC chat to open data OpenChat-  -- | Text messages exchange+  {-| Text messages exchange++      > DCC CHAT chat <ip> <port>+  -}   = Chat IPv4 PortNumber-  -- | Drawing commands exchange+  {-| Drawing commands exchange++      > DCC CHAT wboard <ip> <port>+  -}   | Whiteboard IPv4 PortNumber   deriving (Eq, Show)  -- | Signal intent to close DCC chat connection-data CloseChat = CloseChat+data CloseChat+  -- | > DCC CLOSE+  = CloseChat+  deriving (Eq, Show)  -- | DCC file transfer instructions-data OfferFile = OfferFile TransferType FileMetadata+data OfferFile+  {-| DCC:++      > DCC SEND <fileName> <ip> <port> (<fileSize>)++      Reverse DCC:++      > DCC SEND <fileName> <ip> 0 <fileSize> <token>+  -}+  = OfferFile TransferType FileMetadata   deriving (Eq, Show)  -- | Signal intent to resume DCC file transfer at specific position-data TryResumeFile = TryResumeFile TransferType FileMetadata FileOffset+data TryResumeFile+  {-| DCC:++      > DCC RESUME <fileName> <port> <position>++      Reverse DCC:++      > DCC RESUME <fileName> 0 <position> <token>+    -}+  = TryResumeFile TransferType FileMetadata FileOffset   deriving (Eq, Show)  -- | Signal acceptance to resume DCC file transfer at specific position-data AcceptResumeFile = AcceptResumeFile TransferType FileMetadata FileOffset+data AcceptResumeFile+  {-| DCC:++      > DCC ACCEPT <fileName> <port> <position>++      Reverse DCC:++      > DCC ACCEPT <fileName> 0 <position> <token>+  -}+  = AcceptResumeFile TransferType FileMetadata FileOffset   deriving (Eq, Show) --- | Signal readiness to accept a connection-data OfferFileSink = OfferFileSink Token FileMetadata IPv4 PortNumber+-- | Signal readiness to accept a connection (only Reverse DCC)+data OfferFileSink+  {-| Reverse DCC:++      > DCC SEND <fileName> <ip> <port> <fileSize> <token>+  -}+  = OfferFileSink Token FileMetadata IPv4 PortNumber   deriving (Eq, Show)  -- | Type of a DCC file transfer connection@@ -68,11 +110,15 @@   deriving (Eq, Show)  -- | An identifier for knowing which negotiation a request belongs to-data Token = Token ByteString+newtype Token = Token ByteString   deriving (Eq, Show) -type FileOffset = Word64+newtype FileOffset = FileOffset { toWord :: Word64 }+  deriving (Eq, Ord, Num, Integral, Enum, Real, Bounded) +instance Show FileOffset where+  show = show . toWord+ -- | Class for types that can be sent as CTCP commands class CtcpCommand a where     encodeCtcp :: a -> CTCPByteString@@ -302,10 +348,10 @@ encodeTcpPort = pack . show  parseFileOffset :: Parser FileOffset-parseFileOffset = decimal+parseFileOffset = FileOffset <$> decimal  encodeFileOffset :: FileOffset -> ByteString-encodeFileOffset = pack . show+encodeFileOffset = pack . show . toWord  parseToken :: Parser Token parseToken = Token <$> takeByteString