CWMessage


Discussion

This class is used to describe Internet messages. This class extends the CWPart class and inherit all its methods.

Conforms to

NSCoding

Superclass

CWPart

Declared In

CWMessage.h



Methods

-addHeader: withValue:
-addHeader:withValue:
-addHeadersFromData:record:
-addRecipient:
-allReferences
-baseSubject
-flags
-folder
-forward:
-from
-initWithHeaders:
-initWithHeadersFromData:
-inReplyTo
-isInitialized
-messageID
-messageNumber
-MIMEVersion
-organization
-propertyForKey:
-rawSource
-receivedDate
-recipients
-recipientsCount
-removeAllRecipients
-removeRecipient:
-reply:
-replyTo
-resentDate
-resentFrom
-resentMessageID
-resentSubject
-setBaseSubject:
-setFlags:
-setFolder:
-setFrom:
-setHeadersFromData:record:
-setInitialized:
-setInReplyTo:
-setMessageID:
-setMessageNumber:
-setMIMEVersion:
-setOrganization:
-setProperty: forKey:
-setProperty:forKey:
-setRawSource:
-setReceivedDate:
-setRecipients:
-setReferences:
-setReplyTo:
-setResentDate:
-setResentFrom:
-setResentMessageID:
-setResentSubject:
-setSubject:
-subject

addHeader: withValue:


- (void) addHeader: (NSString *) theName withValue: (NSString *) theValue; 
Parameters
theName

The header name, which should normally begin with an "X-".

theValue

The header value.

Discussion

This method is used to add an extra header to the list of headers of the message.

See Also

addHeader:withValue:


addHeader:withValue:


- (void) addHeader: (NSString *) theName withValue: (NSString *) theValue; 
Parameters
theName

The header name, which should normally begin with an "X-".

theValue

The header value.

Discussion

This method is used to add an extra header to the list of headers of the message.

See Also

addHeader: withValue:


addHeadersFromData:record:


- (void) addHeadersFromData: (NSData *) theHeaders record: (cache_record *) theRecord; 
Parameters
The

additional headers, in their raw representation.

theRecord

The cache_record to update.

Discussion

This method is used to add addionnal headers from their raw representation. It will not erase the currently defined headers. It also updates the cache record theRecord with the decoded information.


addRecipient:


- (void) addRecipient: (CWInternetAddress *) theAddress; 
Parameters
theAddress

The CWInternetAddress instance holding the recipient to add to the list.

Discussion

This method is used to add a recipient to the list of all recipients for the receiver. The recipient type is determined by calling the -type method on the CWInternetAddress's instance.


allReferences


- (NSArray *) allReferences; 
Return Value

The value of the "References" header. This corresponds to a NSArray of NSString instances. Each instance is normally a Message-ID.

Discussion

This method is used to obtain the value of the "References" header. The values are particularly useful for message threading.


baseSubject


- (NSString *) baseSubject; 
Return Value

The base subject.

Discussion

This method is used to obtain the base subject. The base subject is basically the value of the "Subject" header but without the "re" or "fwd" (or whatever) prefix.


flags


- (CWFlags *) flags; 
Return Value

The CWFlags instance of the receiver.

Discussion

This method is used to obtain the flags associated to the receiver.


folder


- (CWFolder *) folder; 
Return Value

The CWFolder instance in which the message is stored, nil if no folder holds the receiver.

Discussion

This method is used to get the associated receiver's folder.


forward:


- (CWMessage *) forward: (PantomimeForwardMode) theMode; 
Parameters
theMode

The type of forward operation to do.

Return Value

A CWMessage instance used for forwarding.

Discussion

This method is used to contruct a new CWMessage instance to be used when forward a message. The returned message will always use the UTF-8 charset.


from


- (CWInternetAddress *) from; 
Return Value

The value of the "From" header, as an CWInternetAddress instance.

Discussion

This method is used to obtain the value of the "From" header.


initWithHeaders:


- (id) initWithHeaders: (NSDictionary *) theHeaders; 
Parameters
theHeaders

The NSDictionary instance holding all headers / values.

Return Value

A Message instance, nil on error.

Discussion

This method is used to initialize the receiver with a predefined set of headers. The headers are specified in a NSDictionary instance where the keys are the header names (for example, "Content-Type") and the values are the respective values of for each keys. This method class -setHeaders:.


initWithHeadersFromData:


- (id) initWithHeadersFromData: (NSData *) theHeaders; 
Parameters
theHeaders

The headers in their raw represnetation.

Return Value

A Message instance, nil on error.

Discussion

This method is used to initialize the receiver with a predefined set of headers in their raw representation. This method calls -setHeadersFromData:.


inReplyTo


- (NSString *) inReplyTo; 
Return Value

The value of the "In-Reply-To" header.

Discussion

This method is used to obtain the value of the "In-Reply-To" header.


isInitialized


- (BOOL) isInitialized; 
Return Value

YES if the message is initialized, NO otherwise.

Discussion

This method is used to verify if a message has been initialized or not. An inititalized message is a message for which all parts have been initilized. A message for which only the headers are set is not an initialized message.


messageID


- (NSString *) messageID; 
Return Value

The value of the "Message-ID" header.

Discussion

This method is used to obtain the value of the "Message-ID" header.


messageNumber


- (unsigned int) messageNumber; 
Return Value

The MSN, 0 if none was previously set.

Discussion

This method is used to obtain the message sequence number (MSN) of the receiver. MSN have a special meaning for IMAP messages (see 2.3.1.2. of RFC3501 for details).


MIMEVersion


- (NSString *) MIMEVersion; 
Return Value

The value of the header, nil if none was set.

Discussion

This method is used to obtain the value of the "MIME-Version" header.


organization


- (NSString *) organization; 
Return Value

The value of the "Organization" header.

Discussion

This method is used to obtain the value of the "Organization" header.


propertyForKey:


- (id) propertyForKey: (id) theKey; 
Return Value

The property for the specified key, nil if key isn't found.

Discussion

This method is used to get an extra property for the specified key.


rawSource


- (NSData *) rawSource; 
Return Value

The raw representation, or nil if it has not been loaded.

Discussion

This method is used to obtain the raw representation of the receiver. Subclasses will overwrite this method so it's not blocking (see the documentation of this method for CWIMAPMessage, for example).


receivedDate


- (NSCalendarDate *) receivedDate; 
Return Value

The value of the "Date" header, as a NSCalendarDate instance.

Discussion

This method is used to obtain the value of the "Date" header.


recipients


- (NSArray *) recipients; 
Return Value

The array of recipients which are all CWInternetAddress instances.

Discussion

This method is used to obtain the list of recipients of the receiver. All recipient types are returned.


recipientsCount


- (unsigned int) recipientsCount; 
Return Value

The count.

Discussion

This method is used to obtain the number of recipients the receiver has.


removeAllRecipients


- (void) removeAllRecipients; 
Discussion

This method is used to remove all recipients from the receiver.


removeRecipient:


- (void) removeRecipient: (CWInternetAddress *) theAddress; 
Parameters
theAddress

The recipient to remove.

Discussion

This method is used to remove the specified recipient from the receiver's list of recipients.


reply:


- (CWMessage *) reply: (PantomimeReplyMode) theMode; 
Parameters
theMode

The type of reply operation to do. The default mode is PantomimeNormalReplyMode.

Return Value

A CWMessage instance used for replying.

Discussion

This method is used to contruct a new CWMessage instance to be used when replying to a message. The returned message will always use the UTF-8 charset. The message will NOT have a content other than the plain text one(s).


replyTo


- (NSArray *) replyTo; 
Return Value

The value of the "Reply-To" header, as an array of CWInternetAddress instances. If there are none, nil is returned.

Discussion

This method is used to obtain the value of the "Reply-To" header.


resentDate


- (NSCalendarDate *) resentDate; 
Return Value

The value of the "Resent-Date" header.

Discussion

This method is used to obtain the value of the "Resent-Date" header.


resentFrom


- (CWInternetAddress *) resentFrom; 
Return Value

The value of the "Resent-From" header.

Discussion

This method is used to obtain the value of the "Resent-From" header.


resentMessageID


- (NSString *) resentMessageID; 
Return Value

The value of the "Resent-Message-ID" header.

Discussion

This method is used to obtain the value of the "Resent-Message-ID" header.


resentSubject


- (NSString *) resentSubject; 
Return Value

The value of the "Resent-Subject" header.

Discussion

This method is used to obtain the value of the "Resent-Subject" header.


setBaseSubject:


- (void) setBaseSubject: (NSString *) theBaseSubject; 
Parameters
theBaseSubject

The base subject to set.

Discussion

This method is used to set the base subject of the receiver.


setFlags:


- (void) setFlags: (CWFlags *) theFlags; 
Parameters
theFlags

The new flags for the receiver.

Discussion

This method is used to set the flags of the receiver, replacing any previous values set. Subclasses of CWMessage sometimes overwrite this method.


setFolder:


- (void) setFolder: (CWFolder *) theFolder; 
Parameters
theFolder

The folder which holds the receiver.

Discussion

This method is used to set the associated folder to the message.


setFrom:


- (void) setFrom: (CWInternetAddress *) theInternetAddress; 
Parameters
theInternetAddress

The CWInternetAddress instance.

Discussion

This method is used to set the value of the "From:" header.


setHeadersFromData:record:


- (void) setHeadersFromData: (NSData *) theHeaders record: (cache_record *) theRecord; 
Parameters
theHeaders

The bytes to use.

Discussion

This method initalize all the headers of a message from the raw data source. It replaces previously defined values of headers found in theHeaders. It also updates the cache record theRecord with the decoded information.


setInitialized:


- (void) setInitialized: (BOOL) theBOOL; 
Parameters
theBOOL

YES if we want to load the content of the message and initialize the receiver with it. NO if we want to free the resources taken by the decoded content.

Discussion

This method is used to initialize the message or free the resources taken by its content. Subclasses of CWMessage sometimes overwrite this method.


setInReplyTo:


- (void) setInReplyTo: (NSString *) theInReplyTo; 
Parameters
theInReplyTo

The value of the "In-Reply-To" header.

Discussion

This method is used to set the value of the "In-Reply-To" header.


setMessageID:


- (void) setMessageID: (NSString *) theMessageID; 
Parameters
theMessageID

The value of the "Message-ID" header.

Discussion

This method is used to set the value of the "Message-ID" header.


setMessageNumber:


- (void) setMessageNumber: (unsigned int) theMessageNumber; 
Parameters
theMessageNumber

The value.

Discussion

This method is used to set the message number value of the receiver.


setMIMEVersion:


- (void) setMIMEVersion: (NSString *) theMIMEVersion; 
Parameters
theMIMEVersion

The new value for the header.

Discussion

This method is used to set the value of the "MIME-Version" header, replacing any values previously set.


setOrganization:


- (void) setOrganization: (NSString *) theOrganization; 
Parameters
theOrganization

The new value of the header.

Discussion

This method is used to set the value of the "Organization" header.


setProperty: forKey:


- (void) setProperty: (id) theProperty forKey: (id) theKey; 
Parameters
theProperty

The value of the property.

theKey

The key of the property.

Discussion

This method is used to set an extra property for the specified key on this folder. If nil is passed for theProperty parameter, the value will actually be REMOVED for theKey.

See Also

setProperty:forKey:


setProperty:forKey:


- (void) setProperty: (id) theProperty forKey: (id) theKey; 
Parameters
theProperty

The value of the property.

theKey

The key of the property.

Discussion

This method is used to set an extra property for the specified key on this folder. If nil is passed for theProperty parameter, the value will actually be REMOVED for theKey.

See Also

setProperty: forKey:


setRawSource:


- (void) setRawSource: (NSData *) theRawSource; 
Parameters
theRawSource

The raw source of the message.

Discussion

This method is used to set the raw representation of the receiver. No specific actions are taken when invoking this method.


setReceivedDate:


- (void) setReceivedDate: (NSCalendarDate *) theDate; 
Parameters
theDate

The NSCalendarDate instance.

Discussion

This method is used to set the value of the "Date" header.


setRecipients:


- (void) setRecipients: (NSArray *) theRecipients; 
Parameters
theRecipients

The array of CWInternetAddress instances to add to the receiver's list of recipients.

Discussion

This method is used to add theRecipients to the list of the receiver's recipients.


setReferences:


- (void) setReferences: (NSArray *) theReferences; 
Parameters
theReferences

The array of references.

Discussion

This method is used to the value of the "References" header, replacing any previously defined value.


setReplyTo:


- (void) setReplyTo: (NSArray *) theAddressList; 
Parameters
theAddressList

An array of CWInternetAddress instances.

Discussion

This method is used to set the value of the "Reply-To:" header.


setResentDate:


- (void) setResentDate: (NSCalendarDate *) theResentDate; 
Parameters
theResentDate

The new value of the header.

Discussion

This method is used to set the value of the "Resent-Date" header.


setResentFrom:


- (void) setResentFrom: (CWInternetAddress *) theInternetAddress; 
Parameters
theInternetAddress

The new value of the header.

Discussion

This method is used to set the value of the "Resent-From" header.


setResentMessageID:


- (void) setResentMessageID: (NSString *) theResentMessageID; 
Parameters
theResentMessageID

The new value of the header.

Discussion

This method is used to set the value of the "Resent-Message-ID" header.


setResentSubject:


- (void) setResentSubject: (NSString *) theResentSubject; 
Parameters
theResentSubject

The new value of the header.

Discussion

This method is used to set the value of the "Resent-Subject" header.


setSubject:


- (void) setSubject: (NSString *) theSubject; 
Parameters
theSubject

The value to set.

Discussion

This method is used to set the value of the "Subject" header.


subject


- (NSString *) subject; 
Return Value

The value of the "Subject" header.

Discussion

This method is used to obtain the value of the "Subject" header.


Member Data

_flags
_folder
_initialized
_message_number
_properties
_rawSource
_recipients
_references

_flags


private

CWFlags *_flags;

_folder


private

CWFolder *_folder;

_initialized


private

BOOL _initialized;

_message_number


private

unsigned int _message_number;

_properties


private

NSMutableDictionary *_properties;

_rawSource


protected

NSData *_rawSource;

_recipients


private

NSMutableArray *_recipients;

_references


private

NSArray *_references;