POP3 Class Reference

POP3 provides a class interface to a POP3 session. Basically it encapsulates in C++ classes the fundamental things you do with a connection to a POP3 server. Here's how you use an object of type POP3: More...

#include <pop3.h>

Collaboration diagram for POP3:
Collaboration graph
[legend]

List of all members.

Classes

struct  Attachment
struct  Body
struct  Header
struct  Impl
struct  Message
struct  User
 sets connect status to not_connected More...

Public Types

enum  constants {
  ok,
  connected,
  not_connected,
  connect_failed,
  last_constant
}
typedef std::string string
typedef std::list< stringstringlist_t
typedef std::list< Useruserlist_t

Public Member Functions

char const * connect (string server, string user, string password)
int connect_status () const
 If connection is successful, you a null pointer returned. Otherwise you get a pointer to an error message. This function not only connects to the server, it also downloads all the messages. If an error occurs at any time in this process, the status of the session goes back to not_connected.
void disconnect ()
 Returns one of:
char const * message_body (size_t message_number, Body **header)
 Get a pointer to the header for a given message. If successful, the pointer will be returned and the message_header() function will return 0. Otherwise, this function will return an error message.
char const * message_header (size_t message_number, Header **header)
size_t messages () const
 Returns count of available messages.
 POP3 ()
 ~POP3 ()

Private Attributes

Implimpl_
 Actual implementation type.

Detailed Description

POP3 provides a class interface to a POP3 session. Basically it encapsulates in C++ classes the fundamental things you do with a connection to a POP3 server. Here's how you use an object of type POP3:

include <pop3>

...

POP3 session;

char const *error = session.connect("server", "userid", "password");

if(error) cout << "Connect error is " << error << endl; else {

size_t message_count = session.messages();

POP3::Header* h;

error = session.message_header(4, &h);

if(error) cout << "Error retrieving header for message 4, " << error << endl; else { cout << "Subject of message 4 is " << h->subject_ << endl; }

POP3::Body* b;

error = session.message_body(4, &b);

if(error) cout << "huh? Why does message 4 not have a body: " << error << endl; else for(size_t i; i < b->lines_.size(); ++i) cout << "Line " << i << ": b->lines_[i] << endl;

}

When serious errors occur, the session's connect status goes to 'not_connected', or 'connect_failed'. Queries for non-existent messages do not cause this, but io errors do cause it.

Definition at line 37 of file pop3.h.


Member Typedef Documentation

typedef std::string string

Definition at line 93 of file pop3.h.

typedef std::list<string> stringlist_t

Definition at line 94 of file pop3.h.

typedef std::list<User> userlist_t

Definition at line 143 of file pop3.h.


Member Enumeration Documentation

enum constants
Enumerator:
ok 
connected 
not_connected 
connect_failed 
last_constant 

Definition at line 96 of file pop3.h.


Constructor & Destructor Documentation

POP3 (  ) 

Definition at line 57 of file pop3.cxx.

~POP3 (  ) 

Definition at line 65 of file pop3.cxx.

Here is the call graph for this function:


Member Function Documentation

char const * connect ( string  server,
string  user,
string  password 
)

Definition at line 86 of file pop3.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

int connect_status (  )  const

If connection is successful, you a null pointer returned. Otherwise you get a pointer to an error message. This function not only connects to the server, it also downloads all the messages. If an error occurs at any time in this process, the status of the session goes back to not_connected.

Definition at line 139 of file pop3.cxx.

void disconnect (  ) 

Returns one of:

connected (connect was successfull) not_connected (never tried to connect) connect_failed (tried and failed)

Definition at line 119 of file pop3.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

char const * message_body ( size_t  message_number,
Body **  header 
)

Get a pointer to the header for a given message. If successful, the pointer will be returned and the message_header() function will return 0. Otherwise, this function will return an error message.

Definition at line 157 of file pop3.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

char const * message_header ( size_t  message_number,
Header **  header 
)

Definition at line 145 of file pop3.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

size_t messages (  )  const

Returns count of available messages.

Definition at line 132 of file pop3.cxx.

Here is the caller graph for this function:


Member Data Documentation

Impl* impl_ [private]

Actual implementation type.

Pointer to opaque type holding real implementation

Definition at line 88 of file pop3.h.


The documentation for this class was generated from the following files:
Generated on Wed Feb 29 22:51:55 2012 for CXXUtilities by  doxygen 1.6.3