Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_POP3 Class Reference

A CP_NetProtoBase class to handle the POP3 internet protocol for receiving messages.

Inheritance diagram for CP_POP3:

CP_NetProtoBase CP_SigSlot::CP_SlotObject CP_Object CP_NoCopy List of all members.

Public Types

enum  { kCP_POP3PortNumber = 110 }
enum  POP3ConnectState { kCP_POP3Closed, kCP_POP3Connected }
enum  POP3ServerState { kCP_POP3Offline, kCP_POP3Authorization, kCP_POP3Transaction, kCP_POP3Update }

Public Member Functions

void SetID (FourCharCode inIdentifier)
FourCharCode GetID ()
void RegisterSignal (const CP_SignalHolder &inSignal)
CP_DataValueSignalFindSignal (const CP_String &inSignalName)
UInt32 GetNumberSignals ()
CP_String GetNthSignalName (UInt32 inSignalIndex)
void RegisterSlot (const CP_SlotHolder &inSlot)
CP_DataValueSlot FindSlot (const CP_String &inSlotName)
UInt32 GetNumberSlots ()
CP_String GetNthSlotName (UInt32 inSlotIndex)
template<class R, class P1, class P2>
CP_CommandHandlerSignalConnect (CPLAT::CP_CommandNo cmd, void(R::*handler)(P1, P2), SInt32 mode)
template<class R, class P1, class P2>
void Connect (CP_Object *control, const CPLAT::CP_String &signalName, void(R::*handler)(P1, P2))
void disconnect_all ()
void signal_connect (CP_Signal *inSender)
void signal_disconnect (CP_Signal *inSender)
Constructor / Destructor
 CP_POP3 (CP_Socket *inSocketConnection)
 Constructor.
virtual ~CP_POP3 () throw ()
 Destructor.
Connection
void Connect (const CP_String &inUser, const CP_String &inPassword, const CP_String &inAddress, SInt16 inPortNumber=CP_POP3::kCP_POP3PortNumber)
void Disconnect ()
void WaitForServerID ()
Commands
void SendLIST ()
void SendNOOP ()
void SendQUIT ()
void SendSTAT (UInt32 *inOutNumberMails, UInt32 *inOutTotalMailSize)
void SendTOP (UInt32 inMessageID, UInt32 inMessageLines, CP_MailMessage &inOutMessage)
void SendUIDL ()
Getters
POP3ConnectState GetConnectionState ()
POP3ServerState GetServerState ()
UInt32 GetMessageSize (UInt32 inMessageIndex)
UInt32 GetMessageID (UInt32 inMessageIndex)
void GetAllHeaders (CP_MailMessage_Array &inMailMessages)
void GetMailMessage (UInt32 inWhichMessage, CP_MailMessage &inOutMessage)

Static Public Member Functions

static void Connect (CP_Object *sender, const CP_String &signalName, CP_Object *receiver, const CP_String &slotName, const bool reciprocal=false)
static void Connect (CP_Object *sender, CP_Object *receiver, const bool reciprocal=false, const CP_String &signalName=kCP_Signal_ValueChanged, const CP_String &slotName=kCP_Slot_SetValue)

Protected Member Functions

void HandleIdle (CP_DataValueHolder &inDataValue, OSStatus &inOSStatus)
Sending
void SendAuthentication (const CP_String &inUser, const CP_String &inPassword)
void SendCommandWithMultiLineReply (CP_String &inCommand, CP_InternetProtocolProgress &inProtocolProgress)

Protected Attributes

POP3ConnectState fConnectState
POP3ServerState fServerState
UInt32 fLastTickleTicks
CP_UInt32s_Array fMessageSizes
CP_UInt32s_Array fMessageIDs
CP_TimedTaskfIdleTimer
CP_SocketfSocketConnection
CP_InternetResponsefLastServerResponse
CP_DataValueSignal fProgressSignal
CP_Signals_ArrayfSignals
CP_Slots_ArrayfSlots
FourCharCode fObjectID
sender_set fSenders

Static Protected Attributes

static FourCharCode fObjectIDCount = 0

Member Enumeration Documentation

anonymous enum
 

Enumeration values:
kCP_POP3PortNumber 

enum CP_POP3::POP3ConnectState
 

Enumeration values:
kCP_POP3Closed 
kCP_POP3Connected 

enum CP_POP3::POP3ServerState
 

Enumeration values:
kCP_POP3Offline 
kCP_POP3Authorization 
kCP_POP3Transaction 
kCP_POP3Update 


Constructor & Destructor Documentation

CPLAT_Begin_Namespace_CPLAT CP_POP3::CP_POP3 CP_Socket inSocketConnection  ) 
 

Constructor.

Parameters:
inSocketConnection The socket connection to the POP3 server.
Exceptions:
none 

CP_POP3::~CP_POP3  )  throw () [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

void CP_POP3::Connect const CP_String inUser,
const CP_String inPassword,
const CP_String inAddress,
SInt16  inPortNumber = CP_POP3::kCP_POP3PortNumber
 

Connects to the POP3 server.

Parameters:
inUser The name of the user.
inPassword The password for the user.
inAddress The address of the server.
inPortNumber Not used.
Exceptions:
NULL exceptions.
Returns:
void

void CP_POP3::Disconnect  ) 
 

Disconnects to the POP3 server.

Exceptions:
none 
Returns:
void

void CP_POP3::WaitForServerID  ) 
 

Waits for the POP3 server to reply with a server id.

Exceptions:
OSErrors/Server response errors.
Returns:
void

void CP_POP3::SendLIST  ) 
 

Sends the LIST command to the server.

Exceptions:
OSErrors/Server response errors.
Returns:
void

void CP_POP3::SendNOOP  ) 
 

Sends the NOOP command to the server.

Exceptions:
OSErrors/Server response errors.
Returns:
void

void CP_POP3::SendQUIT  ) 
 

Sends the QUIT command to the server.

Exceptions:
OSErrors/Server response errors.
Returns:
void

void CP_POP3::SendSTAT UInt32 inOutNumberMails,
UInt32 inOutTotalMailSize
 

Sends the STAT command to the server to retrieve the number of messages and size of the messages.

Parameters:
inOutNumberMails Location to return the number of messages in.
inOutTotalMailSize Location to return the total mail size.
Exceptions:
OSErrors/Server response errors.
Returns:
void

void CP_POP3::SendTOP UInt32  inMessageID,
UInt32  inMessageLines,
CP_MailMessage inOutMessage
 

Sends the TOP command to the server. This will return the message header in the inOutMessage parameter.

Parameters:
inMessageID ID of the message to retrieve.
inMessageLines Number of lines in message.
inOutMessage Location to return the mail message in.
Exceptions:
OSErrors/Server response errors.
Returns:
void

void CP_POP3::SendUIDL  ) 
 

Sends the UIDL command to the server.

Exceptions:
OSErrors/Server response errors.
Returns:
void

POP3ConnectState CP_POP3::GetConnectionState  ) 
 

Returns the connection state to the POP3 server.

Exceptions:
none 
Returns:
POP3ConnecctState Connection state.

POP3ServerState CP_POP3::GetServerState  ) 
 

Returns the state to the POP3 server.

Exceptions:
none 
Returns:
POP3ServerState Server state.

UInt32 CP_POP3::GetMessageSize UInt32  inMessageIndex  ) 
 

Returns the size of the message with the passed in message index.

Parameters:
inMessageIndex Index of the message to retrieve.
Exceptions:
CP_paramErr if not connected to the server.
Returns:
UInt32 The size of the message.

UInt32 CP_POP3::GetMessageID UInt32  inMessageIndex  ) 
 

Returns the id of the message at inMessageIndex.

Parameters:
inMessageIndex Index of the message to return the size of.
Exceptions:
CP_paramErr if not connected to the server.
Returns:
void

UInt32 The size of the message.

void CP_POP3::GetAllHeaders CP_MailMessage_Array inMailMessages  ) 
 

Return a CP_MailMessage for each message on the POP3 server with only the message header filled in.

Parameters:
inMailMessages Array to fill in with messages.
Exceptions:
OSErrors/Server errors.
Returns:
void

void CP_POP3::GetMailMessage UInt32  inWhichMessage,
CP_MailMessage inOutMessage
 

Retrieves a messsage from the server.

Parameters:
inWhichMessage Index of the message to retrieve.
inOutMessage CP_MailMessage to return the resulting message in.
Exceptions:
OSErrors/Server response errors.
Returns:
void

void CP_POP3::HandleIdle CP_DataValueHolder inDataValue,
OSStatus inOSStatus
[protected]
 

Sents a NOOP command to the server every so often to keep the connection to the server.

Parameters:
inDataValue Data value sent by the timer task.
inOSStatus Not used.
Exceptions:
none 
Returns:
void

void CP_POP3::SendAuthentication const CP_String inUser,
const CP_String inPassword
[protected]
 

Sends authentication information to the server.

Parameters:
inUser The name of the user.
inPassword The password for the user.
Exceptions:
OSErrors/Server response errors.
Returns:
void

void CP_POP3::SendCommandWithMultiLineReply CP_String inCommand,
CP_InternetProtocolProgress inProtocolProgress
[protected]
 

Send a command and wait for the server reply. We expect to get a multi-line reply from the server.

Parameters:
inCommand The command we are sending.
inProtocolProgress The progress object we will use to keep track of progress in.
Exceptions:
OSErrors/Server errors.
Returns:
void

virtual CP_InternetResponse* CP_NetProtoBase::GetServerResponse  )  [virtual, inherited]
 

Returns the last server response.

Exceptions:
none 
Returns:
CP_InternetResponse * The internet response for this protocol.

void CP_NetProtoBase::BroadcastProgress CP_InternetProtocolProgress inProtocolProgress  )  [inherited]
 

Broadcast our progress information to any objects that have added themselves as listeners to this object. This will send the signal kCP_Signal_InternetProgress which listeners should connect a slot to.

Parameters:
inProtocolProgress The internnet protocol progress object that contains the progress information. This is also the value of the data value holder for the signal being sent.
Exceptions:
none 
Returns:
void

SInt32 CP_NetProtoBase::ReadLine CP_Socket inSocket,
CP_String inOutResult
[protected, inherited]
 

Receive the next line from our server. We keep receiving until the end of line is reached.

Parameters:
inSocket The socket connection to the server. inOutResult Loction to return the result in.
Exceptions:
none 
Returns:
SInt32 A result code, either CP_noErr or CP_Err_ReceivingFromSocket.

bool CP_NetProtoBase::IsCommaDelimitedListOfSixOctets char *  p  )  [protected, inherited]
 

Return true if our passed in string is in the form of a 6 part address. (h1,h2,h3,h4,p1,p2)

Parameters:
p The string we are checking.
Exceptions:
none 
Returns:
bool True if the passed in string is in the form of a 6 part address.

void CP_NetProtoBase::SendCommand CP_String inCommand  )  [protected, inherited]
 

Sends a command to the server, but does not wait for a response.

Parameters:
inCommand The command to send.
Exceptions:
none 
Returns:
void

void CP_NetProtoBase::SendCommandWithReply CP_String inCommand  )  [protected, inherited]
 

Send the command, and wait for a response. The response will be placed in the CP_InternetResponse object associated with this object.

Parameters:
inCommand The command to send.
Exceptions:
none 
Returns:
void

void CP_NetProtoBase::SendData CP_String inData  )  [protected, inherited]
 

Send data to our socket connection. inData needs to be formatted correctly since we just send the bytes.

Parameters:
inData The data we are sending.
Exceptions:
none 
Returns:
void

void CP_NetProtoBase::SendData char *  inData,
UInt32  inDataLength
[protected, inherited]
 

Send data to our socket connection. inData needs to be formatted correctly since we just send the bytes.

Parameters:
inData The data we are sending.
inDataLength The length of the data being sent.
Exceptions:
none 
Returns:
void

void CP_Object::SetID FourCharCode  inIdentifier  )  [inherited]
 

Sets the identifier for this object. If a specific identifier is not set with this function, then a default id is used, which is simply a running count of the number of objects created.

Parameters:
inIdentifier The objects identifier.
Returns:
void

FourCharCode CP_Object::GetID  )  [inherited]
 

Returns the objects identifier.

Returns:
FourCharCode The identifier of this object.

void CP_Object::RegisterSignal const CP_SignalHolder inSignal  )  [inherited]
 

Registers the signal / signal name contained in the passed in inSignal object.

Parameters:
inSignal CP_SignalHolder that holds a signal and string identifier.
Returns:
void

CP_DataValueSignal * CP_Object::FindSignal const CP_String inSignalName  )  [inherited]
 

Finds the CP_DataValueSignal object that matches the passed in inSignalName.

Parameters:
inSignalName CP_String containing the identifier of the signal to return.
Returns:
CP_DataValueSignal * Returns a pointer to a CP_DataValueSignal object.

UInt32 CP_Object::GetNumberSignals  )  [inherited]
 

Returns the number of signals for this object.

Returns:
UInt32 The number of signals.

CP_String CP_Object::GetNthSignalName UInt32  inSignalIndex  )  [inherited]
 

Returns the signal name of the passed in signal index.

Parameters:
inSignalIndex Index of the name of the signal to return.
Returns:
CP_String The name of the nth signal being returned.

void CP_Object::RegisterSlot const CP_SlotHolder inSlot  )  [inherited]
 

Registers the slot / slot name contained in the passed in inSlot object.

Parameters:
inSlot CP_SignalHolder that holds a slot and string identifier.
Returns:
void

CP_DataValueSlot CP_Object::FindSlot const CP_String inSlotName  )  [inherited]
 

Finds the CP_Slot1 object that matches the passed in inSlotName.

Parameters:
inSlotName CP_String containing the identifier of the slot to return.
Returns:
CP_DataValueSlot Returns a pointer to a CP_DataValueSlot object.

UInt32 CP_Object::GetNumberSlots  )  [inherited]
 

Returns the number of slots for this object.

Returns:
UInt32 The number of slots.

CP_String CP_Object::GetNthSlotName UInt32  inSlotIndex  )  [inherited]
 

Returns the slot name of the passed in signal index.

Parameters:
inSlotIndex Index of the name of the slot to return.
Returns:
CP_String The name of the nth slot being returned.

template<class R, class P1, class P2>
CP_CommandHandlerSignal* CP_Object::Connect CPLAT::CP_CommandNo  cmd,
void(R::*)(P1, P2)  handler,
SInt32  mode
[inherited]
 

template<class R, class P1, class P2>
void CP_Object::Connect CP_Object control,
const CPLAT::CP_String &  signalName,
void(R::*)(P1, P2)  handler
[inherited]
 

void CP_Object::Connect CP_Object sender,
const CP_String signalName,
CP_Object receiver,
const CP_String slotName,
const bool  reciprocal = false
[static, inherited]
 

void CP_Object::Connect CP_Object sender,
CP_Object receiver,
const bool  reciprocal = false,
const CP_String signalName = kCP_Signal_ValueChanged,
const CP_String slotName = kCP_Slot_SetValue
[static, inherited]
 

void CP_SigSlot::CP_SlotObject::disconnect_all  )  [inherited]
 

void CP_SigSlot::CP_SlotObject::signal_connect CP_Signal inSender  )  [inherited]
 

void CP_SigSlot::CP_SlotObject::signal_disconnect CP_Signal inSender  )  [inherited]
 


Member Data Documentation

POP3ConnectState CP_POP3::fConnectState [protected]
 

POP3ServerState CP_POP3::fServerState [protected]
 

Connection state to the POP3 server.

UInt32 CP_POP3::fLastTickleTicks [protected]
 

POP3 server state.

CP_UInt32s_Array CP_POP3::fMessageSizes [protected]
 

Last time we communicated with the server.

CP_UInt32s_Array CP_POP3::fMessageIDs [protected]
 

List of the size of all messages on the server.

CP_TimedTask* CP_POP3::fIdleTimer [protected]
 

List of all messages ids on the server.

CP_Socket* CP_NetProtoBase::fSocketConnection [protected, inherited]
 

CP_InternetResponse* CP_NetProtoBase::fLastServerResponse [protected, inherited]
 

The CP_Socket object that communicates between CPLAT and the server.

CP_DataValueSignal CP_NetProtoBase::fProgressSignal [protected, inherited]
 

This object contains the last response for the server, each different protocol class will implement its own response class to handle server responses.

CP_Signals_Array* CP_Object::fSignals [protected, inherited]
 

CP_Slots_Array* CP_Object::fSlots [protected, inherited]
 

List of registered signals for this object.

FourCharCode CP_Object::fObjectID [protected, inherited]
 

List of registered slots for this object.

CPLAT_Begin_Namespace_CPLAT FourCharCode CP_Object::fObjectIDCount = 0 [static, protected, inherited]
 

Object identifier.

sender_set CP_SigSlot::CP_SlotObject::fSenders [protected, inherited]
 


The documentation for this class was generated from the following files:
Generated on Sat Sep 17 20:01:58 2005 for CPLAT by  doxygen 1.4.0