Documentation

Horde_ActiveSync_Folder_Imap extends Horde_ActiveSync_Folder_Base
in package
implements Serializable

The class contains functionality for maintaining state for a single IMAP folder, and generating server deltas.

Tags
license

http://www.horde.org/licenses/gpl GPLv2

copyright

2012-2020 Horde LLC (http://www.horde.org)

author

Michael J Rubinsky mrubinsk@horde.org

Interfaces, Classes, Traits and Enums

Serializable

Table of Contents

COMPRESSION_LIMIT  = 500
HIGHESTMODSEQ  = 'highestmodseq'
MESSAGES  = 'messages'
UIDNEXT  = 'uidnext'
UIDVALIDITY  = 'uidvalidity'
VERSION  = 2
$haveInitialSync  : bool
Flag for indicating we have an initial sync for this collection.
$_added  : array<string|int, mixed>
Internal cache of message UIDs that have been added since last sync.
$_categories  : array<string|int, mixed>
Internal cache of custom message flags (i.e., categories). Should contain one entry for each UID listed in the $_changed array. An array keyed on message UID: uid => array('TestOne', 'TestTwo')
$_changed  : array<string|int, mixed>
Internal cache of message UIDs that have been modified on the server since the last sync. Used for transporting changes back to activesync.
$_class  : string
The collection class.
$_flags  : array<string|int, mixed>
Internal cache of message flag changes. Should be one entry for each UID also listed in the $_changed array. Used for transporting changes back to activesync. An array keyed by message UID: uid => array('read' => 1)
$_lastSinceDate  : int
Timestamp for the last sincedate used for SOFTDELETE.
$_messages  : array<string|int, mixed>
The folder's current message list.
$_primed  : bool
Internal flag to indicate initial first sync/prime.
$_removed  : array<string|int, mixed>
Internal cache of message UIDs that have been expunged from the IMAP server since last sync. Used for transporting changes back to activesync.
$_serverid  : string
The backend server id for this folder.
$_softDelete  : int
Timestamp for the last time we performed a SOFTDELETE
$_softDeleted  : array<string|int, mixed>
Array of messages to be SOFTDELETEd from client. Only used when we have a CONDSTORE server available, otherwise we calculate the uid list based on the cached data.
$_status  : array<string|int, mixed>
The folder's current internal property state.
__construct()  : mixed
Const'r
__toString()  : string
Convert the instance into a string.
added()  : array<string|int, mixed>
Return the list of UIDs that need to be added to the device.
categories()  : array<string|int, mixed>
Return the internal message category cache.
changed()  : array<string|int, mixed>
Return the list of UIDs that need to have flag changes sent to the device
checkValidity()  : mixed
Check the validity of various values.
collectionClass()  : string
Return the collection class for this collection.
flags()  : array<string|int, mixed>
Return the internal message flags changes cache.
getSoftDeleted()  : array<string|int, mixed>
Return a list of message uids that should be SOFTDELETEd from the client.
getSoftDeleteTimes()  : array<string|int, mixed>
Return the softdelete timestamps.
messages()  : array<string|int, mixed>
Return the list of UIDs currently on the device.
minuid()  : int
Return the minimum IMAP UID contained in this folder.
modseq()  : string
Return the folder's MODSEQ value.
primeFolder()  : mixed
Sets initial message collection for servers that support MODSEQ. Much more effecient than using setChanges() when we know this is the initial folder "priming".
removed()  : array<string|int, mixed>
Return the list of UIDs that need to be removed from the device.
serialize()  : string
Serialize this object.
serverid()  : string
Return the serverid for this collection.
setChanges()  : mixed
Set message changes.
setRemoved()  : mixed
Set the list of expunged message UIDs.
setServerId()  : mixed
Set a new value for the serverid.
setSoftDeleted()  : mixed
Set the list of uids to be SOFTDELETEd. Only needed for CONDSTORE servers.
setSoftDeleteTimes()  : mixed
Set the last softdelete timestamps used.
setStatus()  : mixed
Set the status for this collection.
total_messages()  : int
Return the total, unfiltered number of messages in the folder.
uidnext()  : string
Return the folder's next UID number.
uidvalidity()  : string|bool
Return the folder's UID validity.
unserialize()  : mixed
Reconstruct the object from serialized data.
updateState()  : mixed
Updates the internal UID cache if needed and clears the internal update/deleted/changed cache. To be called after all changes have been dealt with by the activesync client.
_fromSequenceString()  : array<string|int, mixed>
Parse an IMAP message sequence string into a list of indices.
_toSequenceString()  : string
Create an IMAP message sequence string from a list of indices.

Constants

COMPRESSION_LIMIT

public mixed COMPRESSION_LIMIT = 500

HIGHESTMODSEQ

public mixed HIGHESTMODSEQ = 'highestmodseq'

MESSAGES

public mixed MESSAGES = 'messages'

UIDNEXT

public mixed UIDNEXT = 'uidnext'

UIDVALIDITY

public mixed UIDVALIDITY = 'uidvalidity'

VERSION

public mixed VERSION = 2

Properties

$haveInitialSync

Flag for indicating we have an initial sync for this collection.

public bool $haveInitialSync = \false

$_added

Internal cache of message UIDs that have been added since last sync.

protected array<string|int, mixed> $_added = array()

Used for transporting changes back to activesync.

$_categories

Internal cache of custom message flags (i.e., categories). Should contain one entry for each UID listed in the $_changed array. An array keyed on message UID: uid => array('TestOne', 'TestTwo')

protected array<string|int, mixed> $_categories = array()

$_changed

Internal cache of message UIDs that have been modified on the server since the last sync. Used for transporting changes back to activesync.

protected array<string|int, mixed> $_changed = array()

$_class

The collection class.

protected string $_class

$_flags

Internal cache of message flag changes. Should be one entry for each UID also listed in the $_changed array. Used for transporting changes back to activesync. An array keyed by message UID: uid => array('read' => 1)

protected array<string|int, mixed> $_flags = array()

$_lastSinceDate

Timestamp for the last sincedate used for SOFTDELETE.

protected int $_lastSinceDate = 0

$_messages

The folder's current message list.

protected array<string|int, mixed> $_messages = array()

Note: This represents the folder list on the client and is affected by the FILTERTYPE on the collection.

$_primed

Internal flag to indicate initial first sync/prime.

protected bool $_primed = \false

$_removed

Internal cache of message UIDs that have been expunged from the IMAP server since last sync. Used for transporting changes back to activesync.

protected array<string|int, mixed> $_removed = array()

$_serverid

The backend server id for this folder.

protected string $_serverid

$_softDelete

Timestamp for the last time we performed a SOFTDELETE

protected int $_softDelete = 0

$_softDeleted

Array of messages to be SOFTDELETEd from client. Only used when we have a CONDSTORE server available, otherwise we calculate the uid list based on the cached data.

protected array<string|int, mixed> $_softDeleted = array()

$_status

The folder's current internal property state.

protected array<string|int, mixed> $_status = array()

Methods

__construct()

Const'r

public __construct(string $serverid, string $class[, array<string|int, mixed> $status = array() ]) : mixed
Parameters
$serverid : string

The backend serverid of this folder.

$class : string

The collection class.

$status : array<string|int, mixed> = array()

Internal folder state.

Return values
mixed —

__toString()

Convert the instance into a string.

public __toString() : string
Return values
string —

The string representation for this instance.

added()

Return the list of UIDs that need to be added to the device.

public added() : array<string|int, mixed>
Return values
array<string|int, mixed> —

The list of UIDs.

categories()

Return the internal message category cache.

public categories() : array<string|int, mixed>
Return values
array<string|int, mixed> —

The array of message categories. @see self::$_categories

changed()

Return the list of UIDs that need to have flag changes sent to the device

public changed() : array<string|int, mixed>
Return values
array<string|int, mixed> —

The list of UIDs.

checkValidity()

Check the validity of various values.

public checkValidity([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()

A status array containing status to check.

Tags
throws
Horde_ActiveSync_Exception_StaleState
Return values
mixed —

collectionClass()

Return the collection class for this collection.

public collectionClass() : string
Return values
string —

The collection class.

flags()

Return the internal message flags changes cache.

public flags() : array<string|int, mixed>
Return values
array<string|int, mixed> —

The array of message flag changes.

getSoftDeleted()

Return a list of message uids that should be SOFTDELETEd from the client.

public getSoftDeleted() : array<string|int, mixed>

Must be called after setChanges and setRemoved, but before updateState.

Return values
array<string|int, mixed> —

getSoftDeleteTimes()

Return the softdelete timestamps.

public getSoftDeleteTimes() : array<string|int, mixed>
Return values
array<string|int, mixed> —

An array with the last sincedate in the 0 element and the last timestamp in the 1 element.

messages()

Return the list of UIDs currently on the device.

public messages() : array<string|int, mixed>
Return values
array<string|int, mixed> —

The list of backend messages.

minuid()

Return the minimum IMAP UID contained in this folder.

public minuid() : int
Return values
int —

The IMAP UID.

modseq()

Return the folder's MODSEQ value.

public modseq() : string
Return values
string —

The MODSEQ number.

primeFolder()

Sets initial message collection for servers that support MODSEQ. Much more effecient than using setChanges() when we know this is the initial folder "priming".

public primeFolder(array<string|int, mixed> $messages) : mixed
Parameters
$messages : array<string|int, mixed>

Array of message UIDs for the initial message set for this folder.

Return values
mixed —

removed()

Return the list of UIDs that need to be removed from the device.

public removed() : array<string|int, mixed>
Return values
array<string|int, mixed> —

The list of UIDs.

serialize()

Serialize this object.

public serialize() : string
Return values
string —

The serialized data.

serverid()

Return the serverid for this collection.

public serverid() : string
Return values
string —

The serverid.

setChanges()

Set message changes.

public setChanges(array<string|int, mixed> $messages[, array<string|int, mixed> $flags = array() ][, array<string|int, mixed> $categories = array() ][, bool $resetMinUid = false ]) : mixed
Parameters
$messages : array<string|int, mixed>

An array of message UIDs.

$flags : array<string|int, mixed> = array()

A hash of message read flags, keyed by UID.

$categories : array<string|int, mixed> = array()

A hash of custom message flags, keyed by UID. @since 2.17.0

$resetMinUid : bool = false

If true, reset the minimum UID. Should be used when FilterType has widened and messages older than originally selected are being returned. @since 2.24.0

Return values
mixed —

setRemoved()

Set the list of expunged message UIDs.

public setRemoved(array<string|int, mixed> $uids) : mixed
Parameters
$uids : array<string|int, mixed>

An array of message UIDs that have been expunged.

Tags
throws
Horde_ActiveSync_Exception_StaleState
Return values
mixed —

setServerId()

Set a new value for the serverid.

public setServerId(string $id) : mixed
Parameters
$id : string

The new id.

Tags
since
2.4.0
todo

For H6 make these all __get/__set calls.

Return values
mixed —

setSoftDeleted()

Set the list of uids to be SOFTDELETEd. Only needed for CONDSTORE servers.

public setSoftDeleted(array<string|int, mixed> $softDeleted) : mixed
Parameters
$softDeleted : array<string|int, mixed>

The message UID list.

Return values
mixed —

setSoftDeleteTimes()

Set the last softdelete timestamps used.

public setSoftDeleteTimes(long $sincedate, long $ts) : mixed
Parameters
$sincedate : long

The sincedate used in the last softdelete check.

$ts : long

Time the softdelete check was performed.

Return values
mixed —

setStatus()

Set the status for this collection.

public setStatus(array<string|int, mixed> $status) : mixed
Parameters
$status : array<string|int, mixed>
Return values
mixed —

total_messages()

Return the total, unfiltered number of messages in the folder.

public total_messages() : int
Return values
int —

The total number of messages.

uidnext()

Return the folder's next UID number.

public uidnext() : string
Return values
string —

The next UID number.

uidvalidity()

Return the folder's UID validity.

public uidvalidity() : string|bool
Return values
string|bool —

The folder UID validity marker, or false if not set.

unserialize()

Reconstruct the object from serialized data.

public unserialize(string $data) : mixed
Parameters
$data : string

The serialized data.

Tags
throws
Horde_ActiveSync_Exception_StaleState
Return values
mixed —

updateState()

Updates the internal UID cache if needed and clears the internal update/deleted/changed cache. To be called after all changes have been dealt with by the activesync client.

public updateState() : mixed
Return values
mixed —

_fromSequenceString()

Parse an IMAP message sequence string into a list of indices.

protected _fromSequenceString(string $str) : array<string|int, mixed>
Parameters
$str : string

The IMAP message sequence string.

Tags
see
_toSequenceString()
Return values
array<string|int, mixed> —

An array of indices.

_toSequenceString()

Create an IMAP message sequence string from a list of indices.

protected _toSequenceString(array<string|int, mixed> $ids) : string

Index Format: range_start:range_end,uid,uid2,...

Parameters
$ids : array<string|int, mixed>

An array of UIDs.

Return values
string —

The IMAP message sequence string.

Search results