nntp-0.0.1: Library to connect to an NNTP Server

Portabilityportable
Stabilitynone
Maintaineruzytkownik2@gmail.com

Network.NNTP

Contents

Description

This module contains the common features and common interface.

Synopsis

Classes

class Connection c whereSource

Methods

articleFromIDSource

Arguments

:: c

Connection

-> String

ID of the article

-> IO (Maybe Article)

Returns the article | Returns the Article of given number from given Group. Please note that it may or may not fetch the header and body. Preferred is lazy loading.

Returns the Article for given ID. Please note that it may or may not fetch the header and body. Preferred is lazy loading.

If you need to fetch the article you may use: articleFromID c >=> maybe (return Nothing) (fmap Just . fetchArticleLazy)

articleFromNoSource

Arguments

:: c

Connection

-> Group

Group

-> Integer

Number of article in group

-> IO (Maybe Article)

The article | Returns the Group of given name.

groupFromNameSource

Arguments

:: c

Connection

-> String

Name of group

-> IO (Maybe Group)

Group

forGroupsSource

Arguments

:: c

Connection

-> (Group -> IO a)

Function called each time

-> IO [a]

Collected values | Iterates over new group on server collecting values. Please note that the function may be called before all I/O operations finished and the implementation may or may not allaw to call other NNTP functions during the call.

Iterates over every group on server collecting values. Please note that the function may be called before all I/O operations finished and the implementation may or may not allaw to call other NNTP functions during the call.

forNewGroupsSource

Arguments

:: c

Connection

-> UTCTime

Groups only newer thet this time will be returned

-> (Group -> IO a)

Function called each time

-> IO [a]

Collected values | Iterates over the articles in group collecting values. Please note that the function may be called before all I/O operations finished and the implementation may or may not allaw to call other NNTP functions during the call.

forArticlesSource

Arguments

:: c

Connection

-> Group

Group which we iterate

-> (Article -> IO a)

Function called each time

-> IO [a]

Collected values | Iterates over the new articles in group collecting values. Please note that the function may be called before all I/O operations finished and the implementation may or may not allaw to call other NNTP functions during the call.

forNewArticlesSource

Arguments

:: c

Connection

-> Group

Group which we iterate

-> UTCTime

Articles only newer thet this time will be returned

-> (Article -> IO a)

Function called each time

-> IO [a]

Collected values

listGroupsSource

Arguments

:: c

Connection

-> IO [Group]

List of groups

Lists the groups. It has default implementation.

listNewGroupsSource

Arguments

:: c

Connection

-> UTCTime

Groups only newer thet this time will be returned

-> IO [Group]

List of groups

Lists the new groups. It has default implementation.

listArticlesSource

Arguments

:: c

Connection

-> Group

Group which we list

-> IO [Article]

List of articles

Lists the articles. It has default implementation.

listNewArticlesSource

Arguments

:: c

Connection

-> Group

Group which we list

-> UTCTime

Articles only newer thet this time will be returned

-> IO [Article]

List of articles

Lists the new articles. It has default implementation.

fetchArticleSource

Arguments

:: c

Connection

-> Article

An article

-> IO Article

Updated article

Fetch the article. It has default implementation defined in terms of fetchArticleHeader and fetchArticleBody.

fetchArticleHeaderSource

Arguments

:: c

Connection

-> Article

An article

-> IO Article

Updated article

Fetch the article header. It has default implementation defined in terms of fetchArticle.

fetchArticleBodySource

Arguments

:: c

Connection

-> Article

An article

-> IO Article

Updated article

Fetch the article header. It has default implementation defined in terms of fetchArticle.

fetchArticleLazySource

Arguments

:: c

Connection

-> Article

An article

-> IO Article

Updated article

Fetchs the article only if it is not fetched. It has default implementation.

fetchArticleHeaderLazySource

Arguments

:: c

Connection

-> Article

An article

-> IO Article

Updated article

Fetchs the article header if it is not fetched. It has default implementation.

fetchArticleBodyLazySource

Arguments

:: c

Connection

-> Article

An article

-> IO Article

Updated article

Fetchs the article body if it is not fetched. It has default implementation.

fetchGroupSource

Arguments

:: c

Connection

-> Group

A group

-> IO Group

Updated group

Updates group.

postSource

Arguments

:: c

Connection

-> ByteString

Article content

-> IO () 

Posts an article.

disconnectSource

Arguments

:: c

Connection

-> IO () 

Disconnects gently

Types

data Article Source

Represents a single article. Please note that except the splitting into header and body no parsing is done.

Constructors

Article 

Fields

articleID :: String

Returns the article ID

articleHeader :: Maybe ByteString

Returns the article header. Data.Maybe.Nothing indicates not fetched header.

articleBody :: Maybe ByteString

Returns the article body. Data.Maybe.Nothing indicates not fetched body.

Instances

data Group Source

Represents a single group.

Constructors

Group 

Fields

groupName :: String

Returns the group name.

groupArticleFirst :: Integer

Returns the number of first article avaible.

groupArticleLast :: Integer

Returns the number of last article avaible.

Instances

Errors

data NNTPError Source

Indicates an error of handling NNTP connection. Please note that this should indicate client errors only (with the exception of ServiceDiscontinued and in some cases PostingFailed).

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