rcube_result_thread

Class for accessing IMAP's THREAD result

package

Framework

subpackage

Storage

Methods

Object constructor.

__construct($mailbox = null, $data = null) 

Arguments

$mailbox

$data

Initializes object with IMAP command response

init(string $data = null) 

Arguments

$data

string

IMAP response string

Checks the result from IMAP command

is_error() : bool

Response

bool

True if the result is an error, False otherwise

Checks if the result is empty

is_empty() : bool

Response

bool

True if the result is empty, False otherwise

Returns number of elements (threads) in the result

count() : int

Response

int

Number of elements

Returns number of all messages in the result

count_messages() : int

Response

int

Number of elements

Returns maximum message identifier in the result

max() : int

Response

int

Maximum message identifier

Returns minimum message identifier in the result

min() : int

Response

int

Minimum message identifier

Slices data set.

slice(mixed $offset, mixed $length) 

Arguments

$offset

mixed

Offset (as for PHP's array_slice())

$length

mixed

Number of elements (as for PHP's array_slice())

Filters data set. Removes threads not listed in $roots list.

filter(array $roots) 

Arguments

$roots

array

List of IDs of thread roots.

Reverts order of elements in the result

revert() 

Check if the given message ID exists in the object

exists(int $msgid, bool $get_index = false) : boolean

Arguments

$msgid

int

Message ID

$get_index

bool

When enabled element's index will be returned.

                   Elements are indexed starting with 0

Response

boolean

True on success, False if message ID doesn't exist

Return IDs of all messages in the result. Threaded data will be flattened.

get() : array

Response

array

List of message identifiers

Return all messages in the result.

get_compressed() : array

Response

array

List of message identifiers

Return result element at specified index (all messages, not roots)

get_element(int|string $index) : int

Arguments

$index

int|string

Element's index or "FIRST" or "LAST"

Response

int

Element value

Returns response parameters e.g. MAILBOX, ORDER

get_parameters(string $param = null) : array|string

Arguments

$param

string

Parameter name

Response

array|string

Response parameters or parameter value

THREAD=REFS sorting implementation (based on provided index)

sort(\rcube_result_index $index) 

Arguments

$index

\rcube_result_index

Sorted message identifiers

Returns data as tree

get_tree() : array

Response

array

Data tree

Returns thread depth and children data

get_thread_data() : array

Response

array

Thread data

Creates 'depth' and 'children' arrays from stored thread 'tree' data.

build_thread_data($data, &$depth, &$children, $level) 

Arguments

$data

$depth

$children

$level

Converts part of the raw thread into an array

build_thread($items, $level = 1, &$pos) 

Arguments

$items

$level

$pos

IMAP THREAD response parser

parse_thread($str, $begin, $end, $depth) 

Arguments

$str

$begin

$end

$depth

Constants

SEPARATOR_ELEMENT

SEPARATOR_ELEMENT

SEPARATOR_ITEM

SEPARATOR_ITEM

SEPARATOR_LEVEL

SEPARATOR_LEVEL

Properties

raw_data

raw_data : 

mailbox

mailbox : 

meta

meta : 

order

order :