-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A DCC message parsing and helper library for IRC clients
--
-- DCC (Direct Client-to-Client) is an IRC sub-protocol for establishing
-- and maintaining direct connections to exchange messages and files.
--
-- See http://www.irchelp.org/irchelp/rfc/ctcpspec.html for more
-- details.
@package irc-dcc
@version 1.0.0
-- | Functions for receiving files.
--
-- Each chunk is acknowledged by sending the total sum of bytes received
-- for a file. See the CTCP specification.
module Network.IRC.DCC.FileTransfer
-- | Accept a DCC file offer
acceptFile :: Integral a => OfferFile -> (PortNumber -> ExceptT String IO ()) -> (a -> IO ()) -> ExceptT String IO ()
-- | Accept a DCC file offer for a partially downloaded file
resumeFile :: Integral a => AcceptResumeFile -> (PortNumber -> ExceptT String IO ()) -> (a -> IO ()) -> ExceptT String IO ()
module Network.IRC.DCC
-- | Class for types that can be sent as CTCP commands
class CtcpCommand a
encodeCtcp :: CtcpCommand a => a -> CTCPByteString
-- | Type of DCC service offered
data Service
-- | Offer chat session
Messaging :: OpenChat -> Service
-- | Offer file transfer
FileTransfer :: OfferFile -> Service
-- | Type of DCC chat to open
data OpenChat
-- | Text messages exchange
Chat :: IPv4 -> PortNumber -> OpenChat
-- | Drawing commands exchange
Whiteboard :: IPv4 -> PortNumber -> OpenChat
-- | Signal intent to close DCC chat connection
data CloseChat
CloseChat :: CloseChat
-- | DCC file transfer instructions
data OfferFile
OfferFile :: TransferType -> FileMetadata -> OfferFile
-- | Signal intent to resume DCC file transfer at specific position
data TryResumeFile
TryResumeFile :: TransferType -> FileMetadata -> FileOffset -> TryResumeFile
-- | Signal acceptance to resume DCC file transfer at specific position
data AcceptResumeFile
AcceptResumeFile :: TransferType -> FileMetadata -> FileOffset -> AcceptResumeFile
-- | Signal readiness to accept a connection
data OfferFileSink
OfferFileSink :: Token -> FileMetadata -> IPv4 -> PortNumber -> OfferFileSink
-- | Type of a DCC file transfer connection
data TransferType
-- | Connection where the owner of the file offers a socket to connect to
Active :: IPv4 -> PortNumber -> TransferType
-- | Connection where the recipient of the file offers a socket to connect
-- to
Passive :: IPv4 -> Token -> TransferType
-- | Properties of a file
data FileMetadata
FileMetadata :: Path Rel File -> Maybe FileOffset -> FileMetadata
[fileName] :: FileMetadata -> Path Rel File
[fileSize] :: FileMetadata -> Maybe FileOffset
-- | An identifier for knowing which negotiation a request belongs to
data Token
Token :: ByteString -> Token
type FileOffset = Word64
runParser :: Parser a -> CTCPByteString -> Either String a
parseService :: Parser Service
parseOpenChat :: Parser OpenChat
parseCloseChat :: Parser CloseChat
parseOfferFile :: Parser OfferFile
parseTryResumeFile :: OfferFile -> Parser TryResumeFile
parseAcceptResumeFile :: TryResumeFile -> Parser AcceptResumeFile
parseOfferFileSink :: AcceptResumeFile -> Parser (Maybe OfferFileSink)