NAME

Connection::NNTP - Zero Knowledge Network News Transport Protocol


SYNOPSIS

    use Connection::NNTP;

    $nntp = new Connection::NNTP();
    $nntp = new Connection::NNTP( User => $user );


REQUIRES

    Perl5.004+
    Net::NNTP
    User::Base (Subclass)


EXPORTS

Nothing


DESCRIPTION

This is the NNTP protocol encapsulation class. This class implements a client interface to the NNTP protocol enabling perl applications to talk to NNTP servers. This implementation assumes that you are familiar with the concepts of the NNTP protocol described in RFC977.

The Connection::NNTP object must be created with the new method. Once this has been done, all NNTP commands are accessed through this object.

The Connection::NNTP class is subclass of Connection::Base.


EXAMPLE

    #!/usr/bin/perl C<-w>

    use User::Net;
    use Message::NewsMessage;
    use Connection::NNTP;

    $user = new User::Net();
    $message = new Message::NewsMessage();

    $nntp = new Connection::NNTP();

    $nntp->connect( $user );
    $nntp->post( $message );
    $nntp->quit();


CONSTRUCTOR

new Connection::NNTP( [ USER ] )

This is the constructor for the Connection::NNTP object. USER is the user for authentication to the server. The USER parameter is a sub-class of the User::Base class hiearchy and is optional.

Constructor options must be passed in a hash-like fashion, using key and value pairs.

Example:

  $nntp = new Connection::NNTP( User => $server );


METHODS

connect( [ USER ] )

Open the connection to the remote NNTP server. If USER was not specified at object creation, then it MUST be provided for successful connection to the remote server. USER is one of the sub-classes of the User::Base class hierachy.

user ( USER )

Return the user object associated with this NNTP server connection. If USER is supplied, then it wil be used for future connections, but will not affect the current news server connection.

post( MESSAGE )

Post a new message to the news server. The MESSAGE parameter is of type Message::MailMessage.

next()

Grab the next message from the news server. If the current message is the first message in the group, then it will be returned and the internal message pointer will be moved to the next waiting message. If the current message is the last message in the group then undef will be returned.

prev()

Grab the previous message from the news server. If the current message is the last message in the group then it willbe returned and the internal message pointer will be moved to the previous message. If the current message is the first message in the group, then undef willbe returned.

headers()

Grab a list of the message headers from the news server. If the group is contains no messages then undef will be returned.

msgs()

Grab a list of the message from the news server. The messages returned will be of the type Message::NewsMessage. If the group is empty, then undef willbe returned.

group( GROUP )

Set the current (active) newsgroup to GROUP. This method will in effect set the active group to the name specified and reset the internal message pointer to the first message in the group.

quit()

Close the connection to remote NNTP server.


CLASS VARIABLES

None Present


SEE ALSO

Net::NNTP, Connection::Base, User::Net, User::Nym, Message::NewsMessage


AUTHOR

Kris Smith <krissmi@zeroknowledge.com> Philippe McLean <phillipem@zeroknowledge.com>


COPYRIGHT

Copyright 2000 Zero Knowledge Systems, Inc. All rights reserved