PTLib
Version 2.14.3
|
A TCP/IP socket for the Post Office Protocol version 3. More...
#include <inetmail.h>
Public Member Functions | |
PPOP3Server () | |
Create a TCP/IP POP3 protocol socket channel. More... | |
PBoolean | ProcessCommand () |
Process commands, dispatching to the appropriate virtual function. More... | |
virtual PBoolean | HandleOpenMailbox (const PString &username, const PString &password) |
Log the specified user into the mail system and return sizes of each message in mail box. More... | |
virtual void | HandleSendMessage (PINDEX messageNumber, const PString &id, PINDEX lines) |
Handle the sending of the specified message to the remote client. More... | |
virtual void | HandleDeleteMessage (PINDEX messageNumber, const PString &id) |
Handle the deleting of the specified message from the mail box. More... | |
Protected Member Functions | |
PBoolean | OnOpen () |
This callback is executed when the Open() function is called with open channels. More... | |
virtual void | OnUSER (const PString &name) |
virtual void | OnPASS (const PString &passwd) |
virtual void | OnQUIT () |
virtual void | OnRSET () |
virtual void | OnNOOP () |
virtual void | OnSTAT () |
virtual void | OnLIST (PINDEX msg) |
Get the size of a message in mailbox. More... | |
virtual void | OnRETR (PINDEX msg) |
virtual void | OnDELE (PINDEX msg) |
virtual void | OnTOP (PINDEX msg, PINDEX count) |
virtual void | OnUIDL (PINDEX msg) |
Get unique ID for message in mailbox. More... | |
virtual PBoolean | OnUnknown (const PCaselessString &command) |
Handle an unknown command. More... | |
![]() | |
PPOP3 () | |
virtual PINDEX | ParseResponse (const PString &line) |
Parse a response line string into a response code and any extra info on the line. More... | |
![]() | |
PInternetProtocol (const char *defaultServiceName, PINDEX cmdCount, char const *const *cmdNames) | |
Protected Attributes | |
PString | username |
PUnsignedArray | messageSizes |
PStringArray | messageIDs |
PBYTEArray | messageDeletions |
Additional Inherited Members | |
![]() | |
enum | Commands { USER, PASS, QUIT, RSET, NOOP, STATcmd, LIST, RETR, DELE, APOP, TOP, UIDL, AUTH, NumCommands } |
![]() | |
static PString | GetErrorText (Errors lastError, int osError=0) |
Get error message description. More... | |
![]() | |
static const char * | Class () |
Get the name of the class as a C string. More... | |
static __inline const PObject * | PTraceObjectInstance (const char *) |
static __inline const PObject * | PTraceObjectInstance (const PObject *obj) |
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size) |
Internal function caled from CompareObjectMemoryDirect() More... | |
![]() | |
enum | StuffState { DontStuff, StuffIdle, StuffCR, StuffCRLF, StuffCRLFdot, StuffCRLFdotCR } |
![]() | |
static const PString & | okResponse () |
static const PString & | errResponse () |
![]() |
A TCP/IP socket for the Post Office Protocol version 3.
When acting as a server, a descendant class would be created to override at least the HandleOpenMailbox(), HandleSendMessage() and HandleDeleteMessage() functions. Other functions may be overridden for further enhancement to the sockets capabilities, but these will give a basic POP3 server functionality.
The server socket thread would continuously call the ProcessMessage() function until it returns false. This will then call the appropriate virtual function on parsing the POP3 protocol.
PPOP3Server::PPOP3Server | ( | ) |
Create a TCP/IP POP3 protocol socket channel.
The parameterless form creates an unopened socket, the form with the address
parameter makes a connection to a remote system, opening the socket. The form with the socket
parameter opens the socket to an incoming call from a "listening" socket.
|
virtual |
Handle the deleting of the specified message from the mail box.
This is called when the OnQUIT command is called for each message that was deleted using the DELE command.
messageNumber | Number of message to send. |
id | Unique id of message to send. |
|
virtual |
Log the specified user into the mail system and return sizes of each message in mail box.
The user override of this function is expected to populate the protected member fields messageSizes
and messageIDs
.
username | User name for mail box |
password | Password for user name |
|
virtual |
Handle the sending of the specified message to the remote client.
The data written to the socket will automatically have the '.' character stuffing enabled.
messageNumber | Number of message to send. |
id | Unique id of message to send. |
lines | Nuumber of lines in body of message to send. |
|
protectedvirtual |
msg | Number of message. |
|
protectedvirtual |
Get the size of a message in mailbox.
If msg
is 0 then get sizes of all messages in mailbox.
msg | Number of message. |
|
protectedvirtual |
|
protectedvirtual |
This callback is executed when the Open() function is called with open channels.
It may be used by descendent channels to do any handshaking required by the protocol that channel embodies.
The default behaviour is to simply return true.
Reimplemented from PIndirectChannel.
|
protectedvirtual |
passwd | Password for account. |
|
protectedvirtual |
|
protectedvirtual |
msg | Number of message. |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
msg | Number of message. |
count | Count of messages |
|
protectedvirtual |
Get unique ID for message in mailbox.
If msg
is 0 then get all IDs for all messages in mailbox.
msg | Number of message. |
|
protectedvirtual |
Handle an unknown command.
command | Complete command line received. |
|
protectedvirtual |
name | Name of user. |
PBoolean PPOP3Server::ProcessCommand | ( | ) |
Process commands, dispatching to the appropriate virtual function.
This is used when the socket is acting as a server.
|
protected |
|
protected |
|
protected |
|
protected |