Zend Framework

Add sort() to Zend_Mail_Storage_Imap

Details

  • Type: New Feature New Feature
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.10.1
  • Fix Version/s: None
  • Component/s: Zend_Mail_Storage
  • Labels:
    None

Description

It should be possible to get a list of sequence numbers sorted by a criterion. This is only supported by imap servers that provide the SORT capability.

In Storage_Imap there should be something like this:

/**
 * get sequence ids sorted by a criterion
 *
 * @param string $sortBy
 * @return array
 */
public function listSorted($sortBy = null)
{
	$params = array($sortBy, 'utf-8', 'ALL');
	return $this->_protocol->sort($params);
}

In Protocol_Imap then

/**
 * do a sort request
 *
 * @internal
 * @return array message sequence ids
 */
public function sort(array $params)
{
	$response = $this->requestAndResponse('SORT', $params);
	if (!$response) {
		return $response;
	}
		foreach ($response as $ids) {
		if ($ids[0] == 'SORT') {
			array_shift($ids);
			return $ids;
		}
	}
	return array();
}

This should do the trick.

Activity

There are no comments yet on this issue.

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated: