Properties

$_user

$_user : string

The username to sync with the backend as

Type

string

$_authUser

$_authUser : string

Authenticating user

Type

string

$_authPass

$_authPass : string

User password

Type

string

$_logger

$_logger : \Horde_Log_Logger

Logger instance

Type

\Horde_Log_Logger

$_params

$_params : array

Parameters

Type

array

$_version

$_version : float

Protocol version

Type

float

$_state

$_state : \Horde_ActiveSync_State_Base

The state driver for this request. Needs to be injected into this class.

Type

\Horde_ActiveSync_State_Base

$_tempMap

$_tempMap : array

Temporary serverid to uid map. Used when creating the hierarchy for the first time

Type

array

$_typeMap

$_typeMap : 

Type

Methods

__construct()

__construct(array  $params = array()) : \Horde_ActiveSync_Driver

Const'r

Parameters

array $params

Any configuration parameters or injected objects the concrete driver may need.

  • logger: (Horde_Log_Logger) The logger. DEFAULT: none (No logging).
  • state: (Horde_ActiveSync_State_Base) The state driver. DEFAULT: none (REQUIRED).

Returns

\Horde_ActiveSync_Driver

__destruct()

__destruct() 

Prevent circular dependency issues.

setLogger()

setLogger(\Horde_Log_Logger  $logger) 

Setter for the logger instance

Parameters

\Horde_Log_Logger $logger

The logger

setProtocolVersion()

setProtocolVersion(float  $version) 

Set the protocol version. Can't do it in constructer since we don't know the version at the time this driver is instantiated.

Parameters

float $version

The EAS protocol version to use.

getHeartbeatConfig()

getHeartbeatConfig() : array

Obtain the ping heartbeat settings

Returns

array

authenticate()

authenticate(string  $username, string  $password, string  $domain = null) : mixed

Any code needed to authenticate to backend as the actual user.

Parameters

string $username

The username to authenticate as

string $password

The password

string $domain

The user domain (unused in this driver).

Returns

mixed —

Boolean true on success, boolean false on credential failure or Horde_ActiveSync::AUTHREASON* constant on policy failure.

getUser()

getUser() : string

Get the username for this request.

Returns

string —

The current username

clearAuthentication()

clearAuthentication() : boolean

Clear authentication

Returns

boolean

setup()

setup(string  $user) : boolean

Setup sync parameters. The user provided here is the user the backend will sync with. This allows you to authenticate as one user, and sync as another, if the backend supports this.

Parameters

string $user

The username to sync as on the backend.

Returns

boolean

fetch()

fetch(string  $folderid, string  $id, array  $collection) : \Horde_ActiveSync_Message_Base

Obtain the FULL message from the backend, regardless of any truncation options.

Parameters

string $folderid

Folder id containing data to fetch.

string $id

Server id of data to fetch.

array $collection

The collection data.

Returns

\Horde_ActiveSync_Message_Base

The message data

addDefaultBodyPrefTruncation()

addDefaultBodyPrefTruncation(array  $bodyprefs) : array

Add default truncation values for this driver.

Parameters

array $bodyprefs

BODYPREFERENCE data.

Returns

array —

The BODYPREFERENCE data, with default truncationsize values.

setDevice()

setDevice(\Horde_ActiveSync_Device  $device) 

Set the currently connected device

Parameters

\Horde_ActiveSync_Device $device

The device object.

buildFbString()

buildFbString(\stdClass  $fb, \Horde_Date  $start, \Horde_Date  $end) : string

Build a EAS style FB string. Essentially, each digit represents 1/2 hour.

The values are as follows: 0 - Free 1 - Tentative 2 - Busy 3 - OOF 4 - No data available.

Though currently we only provide a Free/Busy/Unknown differentiation.

Parameters

\stdClass $fb

The fb information. An object containing:

  • s: The start of the period covered.
  • e: The end of the period covered.
  • b: An array of busy periods.
\Horde_Date $start

The start of the period requested by the client.

\Horde_Date $end

The end of the period requested by the client.

Returns

string —

The EAS freebusy string.

getSyncStamp()

getSyncStamp(  $collection) : integer

Return the SyncStamp - the value used to determine the end of the current sync range. Default implementation uses timestamps. Concrete drivers can override this to provide another method to do this, such as using modification sequences.

Parameters

$collection

string The collection id we are currently requesting.

Returns

integer —

The SyncStamp

deleteFolder()

deleteFolder(string  $id, string  $parent = \Horde_ActiveSync::FOLDER_ROOT) 

Delete a folder on the server.

Parameters

string $id

The server's folder id.

string $parent

The folder's parent, if needed.

changeFolder()

changeFolder(string  $id, string  $displayname, string  $parent, string  $uid = null) : \Horde_ActiveSync_Message_Folder

Change a folder on the server.

Parameters

string $id

The server's folder id

string $displayname

The new display name.

string $parent

The folder's parent, if needed.

string $uid

The existing folder uid, if this is an edit. @since 2.9.0 (@todo Look at this for H6. It's here now to save an extra DB lookup for data we already have.)

Throws

\Horde_ActiveSync_Exception

Returns

\Horde_ActiveSync_Message_Folder

moveMessage()

moveMessage(string  $folderid, array  $ids, string  $newfolderid) : array

Move message

Parameters

string $folderid

Existing folder id

array $ids

Message UIDs

string $newfolderid

The new folder id

Returns

array —

The new uids for the message.

getSearchResults()

getSearchResults(string  $type, array  $query) : array

Returns array of items which contain contact information

Parameters

string $type

The search type; ['gal'|'mailbox']

array $query

The search query. An array containing:

  • query: (string) The search term. DEFAULT: none, REQUIRED
  • range: (string) A range limiter. DEFAULT: none (No range used).

Returns

array —

An array containing:

  • rows: An array of search results
  • status: The search store status code.

statFolder()

statFolder(string  $id, mixed  $parent, mixed  $mod = null) : \a

Stat folder. Note that since the only thing that can ever change for a folder is the name, we use that as the 'mod' value.

Parameters

string $id

The folder id

mixed $parent

The parent folder (or 0 if none).

mixed $mod

Modification indicator. For folders, this is the name of the folder, since that's the only thing that can change.

Returns

\a —

stat hash

getFolder()

getFolder(string  $id) : \Horde_ActiveSync_Message_Folder

Return the ActiveSync message object for the specified folder.

Parameters

string $id

The folder's server id.

Returns

\Horde_ActiveSync_Message_Folder

object.

getFolderList()

getFolderList() : array

Get the list of folder stat arrays @see self::statFolder()

Returns

array —

An array of folder stat arrays.

getFolders()

getFolders() : array

Return an array of folder objects.

Returns

array —

An array of Horde_ActiveSync_Message_Folder objects.

getServerChanges()

getServerChanges(\Horde_ActiveSync_Folder_Base  $folder, integer  $from_ts, integer  $to_ts, integer  $cutoffdate, boolean  $ping) : array

Get a list of server changes that occured during the specified time period.

Parameters

\Horde_ActiveSync_Folder_Base $folder

The ActiveSync folder object to request changes for.

integer $from_ts

The starting timestamp.

integer $to_ts

The ending timestamp.

integer $cutoffdate

The earliest date to retrieve back to.

boolean $ping

If true, returned changeset may not contain the full changeset, may only contain a single change, designed only to indicate some change has taken place. The value should not be used to determine what change has taken place.

Throws

\Horde_Exception_AuthenticationFailure

Thrown when the requested collection appears to be no longer available. For H6, we should have the application APIs be responsible for differentiating between deleted/not-visible.

Returns

array —

A list of messge uids that have chnaged in the specified time period.

statMessage()

statMessage(string  $folderId, string  $id) : \hash

Get a message stat.

Parameters

string $folderId

The folder id

string $id

The message id (??)

Returns

\hash —

with 'id', 'mod', and 'flags' members

getMessage()

getMessage(string  $folderid, string  $id, array  $collection) : \Horde_ActiveSync_Message_Base

Obtain an ActiveSync message from the backend.

Parameters

string $folderid

The server's folder id this message is from

string $id

The server's message id

array $collection

The colletion data. May contain things like:

  • mimesupport: (integer) Indicates if the device has MIME support. DEFAULT: 0 (No MIME support)
  • truncation: (integer) Non-MIME truncation limit. Anything larger than this amount of bytes will be truncated. DEFAULT: 0 (No truncation)
  • mimetruncation: (integer) MIME truncation limit. Anything larger than this amount of bytes will be truncated. DEFAULT: 0 (No truncation)
  • bodyprefs: (array) The bodypref array from the device.

Throws

\Horde_ActiveSync_Exception,

Horde_Exception_NotFound

Returns

\Horde_ActiveSync_Message_Base

The message data

deleteMessage()

deleteMessage(string  $folderid, array  $ids) 

Delete a message

Parameters

string $folderid

The folder id containing the messages.

array $ids

An array of message ids to delete.

getWasteBasket()

getWasteBasket(string  $class) : string|boolean

Get the wastebasket folder.

Parameters

string $class

The collection class.

Returns

string|boolean —

Returns name of the trash folder, or false if not using a trash folder.

changeMessage()

changeMessage(string  $folderid, string  $id, \Horde_ActiveSync_Message_Base  $message, \Horde_ActiveSync_Device  $device) : array|boolean

Add/Edit a message

Parameters

string $folderid

The server id for the folder the message belongs to.

string $id

The server's uid for the message if this is a change to an existing message, null if new.

\Horde_ActiveSync_Message_Base $message

The activesync message

\Horde_ActiveSync_Device $device

The device information

Returns

array|boolean —

A stat array if successful, otherwise false.

setReadFlag()

setReadFlag(string  $folderid, integer  $uid, integer  $flag) 

Set the read (\seen) flag on the specified message.

Parameters

string $folderid

The folder id containing the message.

integer $uid

The message IMAP UID.

integer $flag

The value to set the flag to.

sendMail()

sendMail(mixed  $rfc822, integer  $forward = null, integer  $reply = null, string  $parent = null, boolean  $save = true) : boolean

Sends the email represented by the rfc822 string received by the client.

Parameters

mixed $rfc822

The rfc822 mime message, a string or stream resource.

integer $forward

The UID of the message, if forwarding.

integer $reply

The UID of the message if replying.

string $parent

The collection id of parent message if forwarding/replying.

boolean $save

Save in sent messages.

Returns

boolean

getAttachment()

getAttachment(string  $name, array  $options = array()) : array

Return the specified attachment.

Parameters

string $name

The attachment identifier. For this driver, this consists of 'mailbox:uid:mimepart'

array $options

Any options requested. Currently supported:

  • stream: (boolean) Return a stream resource for the mime contents.

Returns

array —

The attachment in the form of an array with the following structure: array('content-type' => {the content-type of the attachement}, 'data' => {the raw attachment data})

itemOperationsGetAttachmentData()

itemOperationsGetAttachmentData(string  $filereference) : 

Return the specified attachement data for an ITEMOPERATIONS request.

Parameters

string $filereference

The attachment identifier.

Returns

itemOperationsFetchMailbox()

itemOperationsFetchMailbox(string  $longid, array  $bodyprefs, boolean  $mimesupport) : \Horde_ActiveSync_Message_Base

Returnmail object represented by the specified longid. Used to fetch email objects from a search result, which only returns a 'longid'.

Parameters

string $longid

The unique search result identifier.

array $bodyprefs

The bodypreference array.

boolean $mimesupport

Mimesupport flag.

Returns

\Horde_ActiveSync_Message_Base

The message requested.

itemOperationsGetDocumentLibraryLink()

itemOperationsGetDocumentLibraryLink(string  $linkid, array  $cred) : array

Return a documentlibrary item.

Parameters

string $linkid

The linkid

array $cred

A credential array:

  • username: A hash with 'username' and 'domain' key/values.
  • password: User password

Returns

array —

An array containing the data and metadata:

statMailMessage()

statMailMessage(string  $folderid, integer|array  $id) : array

Build a stat structure for an email message.

Parameters

string $folderid

The mailbox name.

integer|array $id

The message(s) to stat (IMAP UIDs).

Returns

array

getSpecialFolderNameByType()

getSpecialFolderNameByType(string  $type) : string

Return the server id of the specified special folder type.

Parameters

string $type

The self::SPECIAL_* constant.

Returns

string —

The folder's server id.

getCurrentPolicy()

getCurrentPolicy() : array

Return the security policies.

Returns

array —

An array of provisionable properties and values.

getSettings()

getSettings(array  $settings, \Horde_ActiveSync_Device  $device) : array

Return settings from the backend for a SETTINGS request.

Parameters

array $settings

An array of settings to return.

\Horde_ActiveSync_Device $device

The device to obtain settings for.

Returns

array —

The requested settings.

setSettings()

setSettings(array  $settings, \Horde_ActiveSync_Device  $device) : array

Set backend settings from a SETTINGS request.

Parameters

array $settings

The settings to store.

\Horde_ActiveSync_Device $device

The device to store settings for.

Returns

array —

An array of status responses for each set request. e.g.,: array('oof' => Horde_ActiveSync_Request_Settings::STATUS_SUCCESS, 'deviceinformation' => Horde_ActiveSync_Request_Settings::STATUS_SUCCESS);

autoDiscover()

autoDiscover() : array

Return properties for an AUTODISCOVER request.

Returns

array —

An array of properties.

getUsernameFromEmail()

getUsernameFromEmail(string  $email) : string

Attempt to guess a username based on the email address passed from EAS Autodiscover requests.

Parameters

string $email

The email address

Returns

string —

The username to use to authenticate to Horde with.

resolveRecipient()

resolveRecipient(string  $type, string  $search, array  $options = array()) : array

Handle ResolveRecipient requests

Parameters

string $type

The type of recipient request. e.g., 'certificate'

string $search

The email to resolve.

array $options

Returns

array —

An array of results containing any of the following:

  • type: (string) The type of result a GAL entry or personal address book entry. A Horde_ActiveSync::RESOLVE_RESULT constant.
  • displayname: (string) The display name of the contact.
  • emailaddress: (string) The emailaddress.
  • entries: (array) An array of certificates.
  • availability: (string) A EAS style FB string.
  • picture: (Horde_ActiveSync_Message_ResolveRecipientsPicture)

getProvisioning()

getProvisioning() : mixed

Returns the provisioning support for the current request.

Returns

mixed —

The value of the provisiong support flag.

meetingResponse()

meetingResponse(array  $response) : string

Hanlde meeting responses.

Parameters

array $response

The response data. Contains:

  • requestid: The identifier of the meeting request. Used by the server to fetch the original meeting request details.
  • response: The user's response to the request. One of the response code constants.
  • folderid: The collection id that contains the meeting request.

Throws

\Horde_ActiveSync_Exception,

Horde_Exception_NotFound

Returns

string —

The UID of any created calendar entries, otherwise false.

getFreebusy()

getFreebusy(string  $user, array  $options = array()) : mixed

Request freebusy information from the server

Parameters

string $user

The user to request FB information for.

array $options

Options.

Returns

mixed —

boolean|array The FB information, if available. Otherwise false.

_getFolderUidForBackendId()

_getFolderUidForBackendId(string  $id, string  $type = null, string  $old_id = null) : string

Get an activesync uid for the given backend serverid. If we've seen this serverid before, return the previously created uid, otherwise return a new one.

Parameters

string $id

The server's current folder name E.g., INBOX

string $type

The folder type, a Horde_ActiveSync::FOLDERTYPE* constant. If empty, assumes FOLDER_TYPE_USER_MAIL

string $old_id

The previous folder name for this folder, if the folder is being renamed. @since 2.15.0 @todo This is tempoarary until 3.0 (H6) when we will have the collection manager take care of ALL of the folder name <-> UID mapping management.

Returns

string —

A unique identifier for the specified backend folder id. The first character indicates the foldertype as such: 'F' - Email 'C' - Contact 'A' - Appointment 'T' - Task 'N' - Note

_getClassFromType()

_getClassFromType(integer  $type) : string

Convert a TYPE constant into it's associated CLASS constant.

Parameters

integer $type

The TYPE.

Returns

string —

The CLASS

_isSpecialMailbox()

_isSpecialMailbox(string  $server_id) : True

Return if the specified folder is a special folder.

Parameters

string $server_id

The server id of the folder.

Returns

True —

if $server_id is a special folder, otherwise false.