PHP Class Horde_ActiveSync_Imap_Message, horde

Some Mime parsing code taken from Imp_Contents.
Author: Michael J Rubinsky ([email protected])
ファイルを表示 Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_basePart Horde_ActiveSync_Mime Message structure.
$_data Horde_Imap_Client_Data_Fetch Message data.
$_hasAttachments boolean Flag to indicate if this message contains attachments.
$_imap Horde_Imap_Client_Base The imap client.
$_lastBodyPartDecode boolean Cache if the last body part was encoded or not.

Public Methods

Method Description
__construct ( Horde_Imap_Client_Base $imap, Horde_Imap_Client_Mailbox $mbox, Horde_Imap_Client_Data_Fetch $data ) Constructor
__destruct ( )
__get ( string $property ) : mixed Accessor
contentTypeMap ( ) : array Return this message's content map
getAttachments ( float $version ) : array Return an array of Horde_ActiveSync_Message_Attachment objects for the current message.
getAttachmentsMimeParts ( ) : array Return an array of mime parts for each message attachment.
getBodyPart ( integer $id, array $options ) : mixed Gets the raw text for one section of the message.
getCc ( ) : string Return the CC addresses for this message.
getDate ( ) : Horde_Date Return the message date.
getFlag ( string $flag ) : boolean Get a message flag
getFlags ( ) : array Return all message flags.
getForwardHeaders ( ) : string Return nicely formatted text representing the headers to display with in-line forwarded messages.
getFromAddress ( ) : string Return the message's From: address.
getFullMsg ( boolean $stream = false ) : mixed Return the full message text.
getHeaders ( ) : Horde_Mime_Headers Return this message's base part headers.
getMessageBodyData ( array $options = [] ) : array Returns the main text body of the message suitable for sending over EAS response.
getMessageBodyDataObject ( array $options = [] ) : Horde_ActiveSync_Imap_MessageBodyData Returns the main text body of the message suitable for sending over EAS response.
getMimePart ( integer $id, array $options = [] ) : Horde_Mime_Part Fetch a part of a MIME message.
getPartName ( Horde_Mime_Part $part, boolean $use_descrip = false ) : string Return the descriptive part label, making sure it is not empty.
getReplyTo ( ) : string Return the ReplyTo Address
getStructure ( ) : Horde_Mime_Part Return the message's base Mime part.
getSubject ( ) : string Return the message subject.
getToAddresses ( ) : array Return the To addresses from this message.
hasAttachments ( ) : boolean Return the hasAttachments flag
hasiCalendar ( ) : mixed Return the MIME part of the iCalendar attachment, if available.
isAttachment ( string $id, string $mime_type ) : boolean Determines if a MIME type is an attachment.
isEncrypted ( Horde_Mime_Part $message = null ) : boolean Return the S/MIME encryption status of this message (RFC2633)
isSigned ( Horde_Mime_Part $message = null ) : boolean Return the S/MIME signature status of this message (RFC2633)

Protected Methods

Method Description
_buildEasAttachmentFromMime ( integer $id, Horde_Mime_Part $mime_part, float $version ) : Horde_ActiveSync_Message_AirSyncBaseAttachment Build an appropriate attachment object from the given mime part.
_decodeTnefData ( integer | Horde_Mime_part $data ) : Horde_Mime_Part Convert a TNEF attachment into a multipart/mixed part.

Method Details

__construct() public method

Constructor
public __construct ( Horde_Imap_Client_Base $imap, Horde_Imap_Client_Mailbox $mbox, Horde_Imap_Client_Data_Fetch $data )
$imap Horde_Imap_Client_Base The imap client object.
$mbox Horde_Imap_Client_Mailbox The mailbox object.
$data Horde_Imap_Client_Data_Fetch The data returned from a FETCH must contain at least uid, structure and flags.

__destruct() public method

public __destruct ( )

__get() public method

Accessor
public __get ( string $property ) : mixed
$property string The property.
return mixed

_buildEasAttachmentFromMime() protected method

Build an appropriate attachment object from the given mime part.
protected _buildEasAttachmentFromMime ( integer $id, Horde_Mime_Part $mime_part, float $version ) : Horde_ActiveSync_Message_AirSyncBaseAttachment
$id integer The mime id for the part
$mime_part Horde_Mime_Part The mime part.
$version float The EAS version.
return Horde_ActiveSync_Message_AirSyncBaseAttachment | Horde_ActiveSync_Message_Attachment

_decodeTnefData() protected method

Convert a TNEF attachment into a multipart/mixed part.
protected _decodeTnefData ( integer | Horde_Mime_part $data ) : Horde_Mime_Part
$data integer | Horde_Mime_part Either a mime part id or a Horde_Mime_Part object containing the TNEF attachment.
return Horde_Mime_Part The multipart/mixed MIME part containing any attachment data we can decode.

contentTypeMap() public method

Return this message's content map
public contentTypeMap ( ) : array
return array The content map, with mime ids as keys and content type as values.

getAttachments() public method

Return an array of Horde_ActiveSync_Message_Attachment objects for the current message.
public getAttachments ( float $version ) : array
$version float The EAS protocol version this is for.
return array An array of Horde_ActiveSync_Message_Attachment objects.

getAttachmentsMimeParts() public method

Return an array of mime parts for each message attachment.
public getAttachmentsMimeParts ( ) : array
return array An array of Horde_Mime_Part objects.

getBodyPart() public method

Gets the raw text for one section of the message.
public getBodyPart ( integer $id, array $options ) : mixed
$id integer The ID of the MIME part.
$options array Additional options: - decode: (boolean) Attempt to decode the bodypart on the remote server. If successful, sets self::$_lastBodyPartDecode to the content-type of the decoded data. DEFAULT: No - length: (integer) If set, only download this many bytes of the bodypart from the server. DEFAULT: All data is retrieved. - mimeheaders: (boolean) Include the MIME headers also? DEFAULT: No - stream: (boolean) If true, return a stream. DEFAULT: No
return mixed The text of the part or a stream resource if 'stream' is true.

getCc() public method

Return the CC addresses for this message.
public getCc ( ) : string
return string The Cc address string.

getDate() public method

Return the message date.
public getDate ( ) : Horde_Date
return Horde_Date The messages's envelope date.

getFlag() public method

Get a message flag
public getFlag ( string $flag ) : boolean
$flag string The flag to search for.
return boolean

getFlags() public method

Return all message flags.
Since: 2.17.0
public getFlags ( ) : array
return array An array of message flags.

getForwardHeaders() public method

Return nicely formatted text representing the headers to display with in-line forwarded messages.
public getForwardHeaders ( ) : string
return string

getFromAddress() public method

Return the message's From: address.
public getFromAddress ( ) : string
return string The From address of this message.

getFullMsg() public method

Return the full message text.
public getFullMsg ( boolean $stream = false ) : mixed
$stream boolean Return data as a stream?
return mixed A string or stream resource.

getHeaders() public method

Return this message's base part headers.
public getHeaders ( ) : Horde_Mime_Headers
return Horde_Mime_Headers The message headers.

getMessageBodyData() public method

Returns the main text body of the message suitable for sending over EAS response.
public getMessageBodyData ( array $options = [] ) : array
$options array An options array containgin: - bodyprefs: (array) Bodypref settings DEFAULT: none (No bodyprefs used). - mimesupport: (integer) Indicates if MIME is supported or not. Possible values: 0 - Not supported 1 - Only S/MIME or 2 - All MIME. DEFAULT: 0 (No MIME support) - protocolversion: (float) The EAS protocol we are supporting. DEFAULT 2.5
return array An array of one or both of 'plain' and 'html' content.

getMessageBodyDataObject() public method

Returns the main text body of the message suitable for sending over EAS response.
public getMessageBodyDataObject ( array $options = [] ) : Horde_ActiveSync_Imap_MessageBodyData
$options array An options array containgin: - bodyprefs: (array) Bodypref settings DEFAULT: none (No bodyprefs used). - mimesupport: (integer) Indicates if MIME is supported or not. Possible values: 0 - Not supported 1 - Only S/MIME or 2 - All MIME. DEFAULT: 0 (No MIME support) - protocolversion: (float) The EAS protocol we are supporting. DEFAULT 2.5
return Horde_ActiveSync_Imap_MessageBodyData The result.

getMimePart() public method

Fetch a part of a MIME message.
public getMimePart ( integer $id, array $options = [] ) : Horde_Mime_Part
$id integer The MIME index of the part requested.
$options array Additional options: - length: (integer) If set, only download this many bytes of the bodypart from the server. DEFAULT: All data is retrieved. - nocontents: (boolean) If true, don't add the contents to the part DEFAULT: Contents are added to the part
return Horde_Mime_Part The raw MIME part asked for.

getPartName() public method

Return the descriptive part label, making sure it is not empty.
public getPartName ( Horde_Mime_Part $part, boolean $use_descrip = false ) : string
$part Horde_Mime_Part The MIME Part object.
$use_descrip boolean Use description? If false, uses name.
return string The part label (non-empty).

getReplyTo() public method

Return the ReplyTo Address
public getReplyTo ( ) : string
return string

getStructure() public method

Return the message's base Mime part.
public getStructure ( ) : Horde_Mime_Part
return Horde_Mime_Part

getSubject() public method

Return the message subject.
public getSubject ( ) : string
return string The subject.

getToAddresses() public method

Return the To addresses from this message.
public getToAddresses ( ) : array
return array An array containing arrays of 'to' and 'displayto' addresses. @since 2.37.1, ensures the text is UTF8.

hasAttachments() public method

Return the hasAttachments flag
public hasAttachments ( ) : boolean
return boolean

hasiCalendar() public method

Return the MIME part of the iCalendar attachment, if available.
public hasiCalendar ( ) : mixed
return mixed The mime part, if present, false otherwise.

isAttachment() public method

For our purposes, an attachment is any MIME part that can be downloaded by itself (i.e. all the data needed to view the part is contained within the download data).
Deprecation: Will be removed in 3.0 (Only used in self::hasAttachments call).
public isAttachment ( string $id, string $mime_type ) : boolean
$id string The MIME Id for the part we are checking.
$mime_type string The MIME type.
return boolean True if an attachment.

isEncrypted() public method

Return the S/MIME encryption status of this message (RFC2633)
public isEncrypted ( Horde_Mime_Part $message = null ) : boolean
$message Horde_Mime_Part A mime part to check. If omitted, use self::$_message.
return boolean True if message is S/MIME signed or encrypted, false otherwise.

isSigned() public method

Return the S/MIME signature status of this message (RFC2633)
public isSigned ( Horde_Mime_Part $message = null ) : boolean
$message Horde_Mime_Part A mime part to check. If omitted, use self::$_message.
return boolean True if message is S/MIME signed, false otherwise.

Property Details

$_basePart protected_oe property

Message structure.
protected Horde_ActiveSync_Mime $_basePart
return Horde_ActiveSync_Mime

$_data protected_oe property

Message data.
protected Horde_Imap_Client_Data_Fetch $_data
return Horde_Imap_Client_Data_Fetch

$_hasAttachments protected_oe property

Flag to indicate if this message contains attachments.
protected bool $_hasAttachments
return boolean

$_imap protected_oe property

The imap client.
protected Horde_Imap_Client_Base $_imap
return Horde_Imap_Client_Base

$_lastBodyPartDecode protected_oe property

Cache if the last body part was encoded or not.
protected bool $_lastBodyPartDecode
return boolean