nntp-0.0.4: Library to connect to an NNTP Server

Portabilityportable
Stabilitynone
Maintaineruzytkownik2@gmail.com

Network.NNTP.Internal

Contents

Description

This module contains internalities of NNTP library

Synopsis

Types

newtype NntpT m a Source

NntpT represents a connection. Since some servers have short timeouts it is recommended to keep the connections short.

Constructors

NntpT 

Fields

runNntpT :: NntpState m -> m (NntpState m, Either NntpError a)
 

Instances

data NntpState m Source

NntpState represents a state at given moment. Please note that this type is not a part of stable API (when we will have one).

Constructors

NntpState 

data NntpConnection m Source

NntpConnection represents a connection in a NntpT monad.

Please note that for runNntpWithConnection you need to supply both input and output functions.

Constructors

NntpConnection 

Fields

input :: ByteString

Input is an stream which is from a server.

output :: ByteString -> m ()

Output is a function which sends the data to a server.

data NntpError Source

Indicates an error of handling NNTP connection. Please note that this should indicate client errors only (with the exception of ServiceDiscontinued, in some cases PostingFailed and NoSuchCommand. The last one if propagated outside NNTP module indicates a bug in library or server.).

Constructors

NoSuchGroup

Indicates that operation was performed on group that does not exists.

NoSuchArticle

Indicates that operation was performed on article that does not exists.

PostingFailed

Indicates that posting operation failed for some reason.

PostingNotAllowed

Indicates that posting is not allowed.

ServiceDiscontinued

Indicates that service was discontinued.

NoSuchCommand

Indicates that command does not exists.

Functions

runNntpParser :: Monad m => NntpParser m a -> NntpT m aSource

Transforms NntpParser into NntpT monad taking care about input position

nntpPutStr :: Monad m => ByteString -> NntpT m ()Source

Puts an argument to output.

nntpPutStrLn :: Monad m => ByteString -> NntpT m ()Source

Puts an argument to output followed by end-of-line.

nntpSendCommandSource

Arguments

:: Monad m 
=> String

Command.

-> ByteString

Arguments.

-> [(Int, NntpParser m a)]

Parser of output.

-> NntpT m a

Returned value from parser.

Sends a command.

nntpSendTextSource

Arguments

:: Monad m 
=> ByteString

Text

-> [(Int, NntpParser m a)]

Parser of output.

-> NntpT m a

Returned value from parser.

Sends text

nntpPSendCommandSource

Arguments

:: Monad m 
=> String

Command.

-> ByteString

Arguments.

-> [(Int, NntpParser m a)]

Parser of output.

-> NntpParser m a

Returned value from parser.

Sends a command.

nntpPSendTextSource

Arguments

:: Monad m 
=> ByteString

Text

-> [(Int, NntpParser m a)]

Parser of output.

-> NntpParser m a

Returned value from parser.

Sends text

tryCommandsSource

Arguments

:: Monad m 
=> [NntpT m a]

Possible command.

-> NntpT m a

Result

Try commands one by one to check for existing command.

postize :: ByteString -> ByteStringSource

Converts into postable form.

depostize :: ByteString -> ByteStringSource

Converts from postable form