WriteMime::Message Class Reference

Pure virtual base class for email messages. More...

#include <writemime.h>

Inheritance diagram for WriteMime::Message:

Inheritance graph
[legend]
Collaboration diagram for WriteMime::Message:

Collaboration graph
[legend]

List of all members.

Public Types

enum  recpt_type { TO = 0, CC = 1, BCC = 2 }
 Destination address types.

Public Member Functions

virtual const char * format ()=0
 return 0-terminated formatted message text
virtual int addRecipient (const char *official, const char *nick=0, recpt_type tp=TO)
 Add recipient to one of the recipient lists.
virtual int parseAddRecipients (const char *in, recpt_type tp=TO)
 Parse a user-written recipient string and add recipients.
virtual const char ** getRecipients ()
 Return recipient list as a C string array.
virtual int setSubject (const char *subject)
 Set the subject field value.
virtual int setFrom (const Recipient &from)
 Set the 'From' field value.

Protected Member Functions

void setRecipientHeaders ()

Protected Attributes

list< Recipient > to
list< Recipient > cc
list< Recipient > bcc
list< Recipient > * recptlists [3]

Static Protected Attributes

static const char * recpth [3] = {"To", "Cc", "Bcc"}


Detailed Description

Pure virtual base class for email messages.

Member Function Documentation

int WriteMime::Message::addRecipient ( const char *  official,
const char *  nick = 0,
recpt_type  tp = TO 
) [virtual]

Add recipient to one of the recipient lists.

Parameters:
official will be placed inside <>.
nick will be printed before the formal address.
tp defines what kind of recipient this is (to, cc, bcc).

Referenced by parseAddRecipients().

const char ** WriteMime::Message::getRecipients (  )  [virtual]

Return recipient list as a C string array.

Returns:
an array of pointers to 0-terminated C strings. The last entry in the array is null. The caller should free the array of pointers when done, but *not* the individual strings.

Referenced by WriteMime::sendmail().

int WriteMime::Message::parseAddRecipients ( const char *  in,
recpt_type  tp = TO 
) [virtual]

Parse a user-written recipient string and add recipients.

The purpose of this routine is to help a program interpret text cut-and-pasted by a user into a Gui text field. This has little to do with rfc822 and does not even try to pretend to support everything that could get into an address string.

The function *CAN* fail if the syntax is bad (ie: unbalanced '<').

It supports comma-separated lists of addresses, where each address can contain comments '(bla)', and look like a simple address (dockes or dockes@my.dom.ain), or a full name + official address: jean-francois dockes <dockes>

The function also supports quoting with double-quotes, for exemple to avoid comma interpretation inside the full name part.

Exemple of a list of 2 addresses:

dockes, "Smith, Bill" <bill@smith.org> (The Bill Smith)
Parameters:
in the string to be parsed
tp defines the target recipient list (to, cc, or bcc).
Returns:
0 for success, -1 if parsing failed. Sets the message error string in this case.

References addRecipient(), and WriteMime::Entity::seterror().


The documentation for this class was generated from the following files:

Generated on Fri Feb 6 11:53:44 2009 for WriteMIME by  doxygen 1.5.7.1