PHP Class Horde_ActiveSync_Imap_Adapter, horde

Author: Michael J Rubinsky ([email protected])
ファイルを表示 Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_defaultNamespace string
$_imap Horde_ActiveSync_Interface_ImapFactory
$_logger Horde_Log_Logger
$_procid integer Process id used for logging.

Public Methods

Method Description
__construct ( array $params = [] ) Cont'r
appendMessage ( string $folderid, string | stream $msg, array $flags = [] ) : integer | boolean Append a message to the specified mailbox. Used for saving sent email.
categoriesToFlags ( $mailbox, $categories, $uid )
createMailbox ( string $name, string $parent = null ) : string Create a new mailbox on the server, and subscribe to it.
deleteMailbox ( string $name ) Delete a mailbox
deleteMessages ( array $uids, string $folderid ) : array Permanently delete a mail message.
emptyMailbox ( string $mbox ) Completely empty specified mailbox.
getAttachment ( string $mailbox, string $uid, string $part ) : Horde_Mime_Part Return the content of a specific MIME part of the specified message.
getImapMessage ( string $mailbox, array | integer $uid, array $options = [] ) : array Return a complete Horde_ActiveSync_Imap_Message object for the requested uid.
getMailboxes ( ) : array Return an array of available mailboxes. Uses's the mail/mailboxList API method for obtaining the list.
getMessageChanges ( Horde_ActiveSync_Folder_Imap $folder, array $options = [] ) : Horde_ActiveSync_Folder_Imap Return message changes from the specified mailbox.
getMessages ( string $folderid, array $messages, array $options = [] ) : array Return AS mail messages, from the given IMAP UIDs.
getSpecialMailboxes ( ) : array Return the list of special mailboxes.
getUidFromMid ( string $mid, Horde_ActiveSync_Folder_Imap $folder ) : integer Return an array of message UIDs from a list of Message-IDs.
getUidFromMidInFolders ( $id, array $folders ) : array Attempt to find a Message-ID in a list of mail folders.
moveMessage ( string $folderid, array $ids, string $newfolderid ) : array Move a mail message
ping ( Horde_ActiveSync_Folder_Imap $folder ) : boolean Ping a mailbox. This detects only if any new messages have arrived in the specified mailbox.
queryMailbox ( array $query ) : array Perform a search from a search mailbox request.
renameMailbox ( string $old, string $new, string $parent = null ) : string Rename a mailbox
setImapFlag ( string $mailbox, integer $uid, string $flag ) Set a IMAP message flag.
setLogger ( Horde_Log_Logger $logger ) Set this instance's logger.
setMessageFlag ( string $mailbox, integer $uid, Horde_ActiveSync_Message_Flag $flag ) Set a POOMMAIL_FLAG on a mail message. This method differs from setReadFlag() in that it is passed a Flag object, which contains other data beside the seen status. Used for setting flagged for followup and potentially creating tasks based on the email.
setReadFlag ( string $mailbox, string $uid, integer $flag ) Set the message's read status.

Protected Methods

Method Description
_buildBodyPart ( Horde_ActiveSync_Imap_MessageBodyData $mbd, array $options, Horde_ActiveSync_Message_AirSyncBaseBodypart $message )
_buildHtmlPart ( Horde_ActiveSync_Imap_MessageBodyData $mbd, Horde_ActiveSync_Message_AirSyncBaseBody $message ) Build the HTML body and populate the appropriate message object.
_buildMailMessage ( Horde_Imap_Client_Mailbox $mbox, Horde_Imap_Client_Data_Fetch $data, array $options = [] ) : Horde_ActiveSync_Message_Mail Builds a proper AS mail message object.
_buildSubQuery ( array $query ) : Horde_Imap_Client_Search_Query Helper to build a subquery
_defaultNamespace ( ) : array Return the default namespace.
_doQuery ( array $query ) : array Perform an IMAP search based on a SEARCH request.
_getEASImportance ( string $importance ) : integer Map Importance header values to EAS importance values.
_getImapOb ( ) : Horde_Imap_Client_Base Helper to obtain a valid IMAP client. Can't inject it since the user is not yet authenticated at the time of object creation.
_getMailMessages ( Horde_Imap_Client_Mailbox $mbox, array $uids, array $options = [] ) : Horde_Imap_Fetch_Results
_getMsgFlags ( )
_getNamespace ( $path )
_getNamespacelist ( ) : array Return the list of configured namespaces on the IMAP server.
_getiTipStatus ( Horde_Icalendar $vCal ) Return the attendee participation status.
_mailboxExists ( string $mbox ) : boolean Check existence of a mailbox.
_prependNamespace ( string $name ) : string Prefix the default namespace to mailbox name if needed.

Method Details

__construct() public method

Cont'r
public __construct ( array $params = [] )
$params array Parameters: - factory: (Horde_ActiveSync_Interface_ImapFactory) Factory object DEFAULT: none - REQUIRED

_buildBodyPart() protected method

protected _buildBodyPart ( Horde_ActiveSync_Imap_MessageBodyData $mbd, array $options, Horde_ActiveSync_Message_AirSyncBaseBodypart $message )
$mbd Horde_ActiveSync_Imap_MessageBodyData
$options array
$message Horde_ActiveSync_Message_AirSyncBaseBodypart

_buildHtmlPart() protected method

Build the HTML body and populate the appropriate message object.
protected _buildHtmlPart ( Horde_ActiveSync_Imap_MessageBodyData $mbd, Horde_ActiveSync_Message_AirSyncBaseBody $message )
$mbd Horde_ActiveSync_Imap_MessageBodyData The body data array.
$message Horde_ActiveSync_Message_AirSyncBaseBody The body or bodypart object.

_buildMailMessage() protected method

Builds a proper AS mail message object.
protected _buildMailMessage ( Horde_Imap_Client_Mailbox $mbox, Horde_Imap_Client_Data_Fetch $data, array $options = [] ) : Horde_ActiveSync_Message_Mail
$mbox Horde_Imap_Client_Mailbox The IMAP mailbox.
$data Horde_Imap_Client_Data_Fetch The fetch results.
$options array Additional Options: - truncation: (integer) Truncate the message body to this length. DEFAULT: No truncation. - bodyprefs: (array) Bodyprefs, if sent from device. DEFAULT: none (No body prefs sent or enforced). - bodypartprefs: (array) Bodypartprefs, if sent from device. DEFAULT: none (No body part prefs sent or enforced). - 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 version to support. DEFAULT: 2.5
return Horde_ActiveSync_Message_Mail The message object suitable for streaming to the device.

_buildSubQuery() protected method

Helper to build a subquery
protected _buildSubQuery ( array $query ) : Horde_Imap_Client_Search_Query
$query array A subquery array.
return Horde_Imap_Client_Search_Query The query object.

_defaultNamespace() protected method

Return the default namespace.
protected _defaultNamespace ( ) : array
return array The namespace data.

_doQuery() protected method

Perform an IMAP search based on a SEARCH request.
protected _doQuery ( array $query ) : array
$query array The search query.
return array The results array containing an array of hashes: 'uniqueid' => [The unique identifier of the result] 'searchfolderid' => [The mailbox name that this result comes from]

_getEASImportance() protected method

Map Importance header values to EAS importance values.
protected _getEASImportance ( string $importance ) : integer
$importance string The importance [high|normal|low].
return integer The EAS importance value [0|1|2].

_getImapOb() protected method

Helper to obtain a valid IMAP client. Can't inject it since the user is not yet authenticated at the time of object creation.
protected _getImapOb ( ) : Horde_Imap_Client_Base
return Horde_Imap_Client_Base

_getMailMessages() protected method

protected _getMailMessages ( Horde_Imap_Client_Mailbox $mbox, array $uids, array $options = [] ) : Horde_Imap_Fetch_Results
$mbox Horde_Imap_Client_Mailbox The mailbox
$uids array An array of message uids
$options array An options array - headers: (boolean) Fetch header text if true. DEFAULT: false (Do not fetch header text). - structure: (boolean) Fetch message structure. DEFAULT: true (Fetch message structure). - flags: (boolean) Fetch messagge flags. DEFAULT: true (Fetch message flags). - envelope: (boolen) Fetch the envelope data. DEFAULT: false (Do not fetch envelope). @since 2.4.0
return Horde_Imap_Fetch_Results The results.

_getMsgFlags() protected method

protected _getMsgFlags ( )

_getNamespace() protected method

protected _getNamespace ( $path )

_getNamespacelist() protected method

Return the list of configured namespaces on the IMAP server.
protected _getNamespacelist ( ) : array
return array

_getiTipStatus() protected method

Return the attendee participation status.
protected _getiTipStatus ( Horde_Icalendar $vCal )
$vCal Horde_Icalendar The vCalendar component.

_mailboxExists() protected method

Check existence of a mailbox.
protected _mailboxExists ( string $mbox ) : boolean
$mbox string The mailbox name.
return boolean

_prependNamespace() protected method

Prefix the default namespace to mailbox name if needed.
protected _prependNamespace ( string $name ) : string
$name string The mailbox name.
return string The mailbox name with the default namespace added, if needed.

appendMessage() public method

Append a message to the specified mailbox. Used for saving sent email.
public appendMessage ( string $folderid, string | stream $msg, array $flags = [] ) : integer | boolean
$folderid string The mailbox
$msg string | stream The message
$flags array Any flags to set on the newly appended message.
return integer | boolean The imap uid of the appended message or false on failure. @since 2.37.0

categoriesToFlags() public method

public categoriesToFlags ( $mailbox, $categories, $uid )

createMailbox() public method

Create a new mailbox on the server, and subscribe to it.
public createMailbox ( string $name, string $parent = null ) : string
$name string The new mailbox name.
$parent string The parent mailbox, if any. @return string The new serverid for the mailbox. This is the UTF-8 name of the mailbox. @since 2.9.0 @throws Horde_ActiveSync_Exception, Horde_ActiveSync_Exception_FolderExists
return string

deleteMailbox() public method

Delete a mailbox
public deleteMailbox ( string $name )
$name string The mailbox name to delete.

deleteMessages() public method

Permanently delete a mail message.
public deleteMessages ( array $uids, string $folderid ) : array
$uids array The message UIDs
$folderid string The folder id.
return array An array of uids that were successfully deleted.

emptyMailbox() public method

Completely empty specified mailbox.
Since: 2.18.0
public emptyMailbox ( string $mbox )
$mbox string The mailbox to empty.

getAttachment() public method

Return the content of a specific MIME part of the specified message.
public getAttachment ( string $mailbox, string $uid, string $part ) : Horde_Mime_Part
$mailbox string The mailbox name.
$uid string The message UID.
$part string The MIME part identifier.
return Horde_Mime_Part The attachment data

getImapMessage() public method

Return a complete Horde_ActiveSync_Imap_Message object for the requested uid.
public getImapMessage ( string $mailbox, array | integer $uid, array $options = [] ) : array
$mailbox string The mailbox name.
$uid array | integer The message uid.
$options array Additional options: - headers: (boolean) Also fetch the message headers if this is true. DEFAULT: false (Do not fetch headers).
return array An array of Horde_ActiveSync_Imap_Message objects.

getMailboxes() public method

Return an array of available mailboxes. Uses's the mail/mailboxList API method for obtaining the list.
public getMailboxes ( ) : array
return array

getMessageChanges() public method

Return message changes from the specified mailbox.
public getMessageChanges ( Horde_ActiveSync_Folder_Imap $folder, array $options = [] ) : Horde_ActiveSync_Folder_Imap
$folder Horde_ActiveSync_Folder_Imap The folder object.
$options array Additional options: - sincedate: (integer) Timestamp of earliest message to retrieve. DEFAULT: 0 (Don't filter). - protocolversion: (float) EAS protocol version to support. DEFAULT: none REQUIRED - softdelete: (boolean) If true, calculate SOFTDELETE data. @since 2.8.0 - refreshfilter: (boolean) If true, force refresh the query to reflect changes in FILTERTYPE (using the sincedate) @since 2.28.0
return Horde_ActiveSync_Folder_Imap The folder object, containing any change instructions for the device.

getMessages() public method

Return AS mail messages, from the given IMAP UIDs.
public getMessages ( string $folderid, array $messages, array $options = [] ) : array
$folderid string The mailbox folder.
$messages array List of IMAP message UIDs
$options array Additional Options: - truncation: (integer) The truncation constant, if sent from device. DEFAULT: false (No truncation). - bodyprefs: (array) The bodypref settings, if sent from device. DEFAULT: none (No body prefs sent, or enforced). - bodypartprefs: (array) The bodypartprefs settings, if present. - 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 version to support. DEFAULT: 2.5
return array An array of Horde_ActiveSync_Message_Mail objects.

getSpecialMailboxes() public method

Return the list of special mailboxes.
public getSpecialMailboxes ( ) : array
return array

getUidFromMid() public method

Return an array of message UIDs from a list of Message-IDs.
public getUidFromMid ( string $mid, Horde_ActiveSync_Folder_Imap $folder ) : integer
$mid string The Message-ID
$folder Horde_ActiveSync_Folder_Imap The folder object to search.
return integer The UID

getUidFromMidInFolders() public method

Attempt to find a Message-ID in a list of mail folders.
Deprecation: This is unused and should be removed.
public getUidFromMidInFolders ( $id, array $folders ) : array
$folders array
return array An array with the 0 element being the mbox

moveMessage() public method

Move a mail message
public moveMessage ( string $folderid, array $ids, string $newfolderid ) : array
$folderid string The existing folderid.
$ids array The message UIDs of the messages to move.
$newfolderid string The folder id to move $id to.
return array An hash of oldUID => newUID.

ping() public method

Ping a mailbox. This detects only if any new messages have arrived in the specified mailbox.
public ping ( Horde_ActiveSync_Folder_Imap $folder ) : boolean
$folder Horde_ActiveSync_Folder_Imap The folder object.
return boolean True if changes were detected, otherwise false.

queryMailbox() public method

Perform a search from a search mailbox request.
public queryMailbox ( array $query ) : array
$query array The query array.
return array An array of 'uniqueid', 'searchfolderid' hashes.

renameMailbox() public method

Rename a mailbox
public renameMailbox ( string $old, string $new, string $parent = null ) : string
$old string The old mailbox name.
$new string The new mailbox name.
$parent string The parent mailbox, if any.
return string The new serverid for the mailbox. @since 2.9.0

setImapFlag() public method

Set a IMAP message flag.
public setImapFlag ( string $mailbox, integer $uid, string $flag )
$mailbox string The mailbox name.
$uid integer The message UID.
$flag string The flag to set. A Horde_ActiveSync:: constant.

setLogger() public method

Set this instance's logger.
public setLogger ( Horde_Log_Logger $logger )
$logger Horde_Log_Logger The logger.

setMessageFlag() public method

Set a POOMMAIL_FLAG on a mail message. This method differs from setReadFlag() in that it is passed a Flag object, which contains other data beside the seen status. Used for setting flagged for followup and potentially creating tasks based on the email.
public setMessageFlag ( string $mailbox, integer $uid, Horde_ActiveSync_Message_Flag $flag )
$mailbox string The mailbox name.
$uid integer The message uid.
$flag Horde_ActiveSync_Message_Flag The flag

setReadFlag() public method

Set the message's read status.
public setReadFlag ( string $mailbox, string $uid, integer $flag )
$mailbox string The mailbox name.
$uid string The message uid.
$flag integer Horde_ActiveSync_Message_Mail::FLAG_* constant

Property Details

$_defaultNamespace protected_oe property

protected string $_defaultNamespace
return string

$_imap protected_oe property

protected Horde_ActiveSync_Interface_ImapFactory $_imap
return Horde_ActiveSync_Interface_ImapFactory

$_logger protected_oe property

protected Horde_Log_Logger $_logger
return Horde_Log_Logger

$_procid protected_oe property

Process id used for logging.
protected int $_procid
return integer