|
|
@ -1293,15 +1293,15 @@ class rcube_imap_generic
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param string $ref Reference name
|
|
|
|
* @param string $ref Reference name
|
|
|
|
* @param string $mailbox Mailbox name
|
|
|
|
* @param string $mailbox Mailbox name
|
|
|
|
* @param array $status_opts (see self::_listMailboxes)
|
|
|
|
* @param array $return_opts (see self::_listMailboxes)
|
|
|
|
* @param array $select_opts (see self::_listMailboxes)
|
|
|
|
* @param array $select_opts (see self::_listMailboxes)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return array List of mailboxes or hash of options if $status_opts argument
|
|
|
|
* @return array List of mailboxes or hash of options if $return_opts argument
|
|
|
|
* is non-empty.
|
|
|
|
* is non-empty.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function listMailboxes($ref, $mailbox, $status_opts=array(), $select_opts=array())
|
|
|
|
function listMailboxes($ref, $mailbox, $return_opts=array(), $select_opts=array())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return $this->_listMailboxes($ref, $mailbox, false, $status_opts, $select_opts);
|
|
|
|
return $this->_listMailboxes($ref, $mailbox, false, $return_opts, $select_opts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -1309,14 +1309,14 @@ class rcube_imap_generic
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param string $ref Reference name
|
|
|
|
* @param string $ref Reference name
|
|
|
|
* @param string $mailbox Mailbox name
|
|
|
|
* @param string $mailbox Mailbox name
|
|
|
|
* @param array $status_opts (see self::_listMailboxes)
|
|
|
|
* @param array $return_opts (see self::_listMailboxes)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return array List of mailboxes or hash of options if $status_opts argument
|
|
|
|
* @return array List of mailboxes or hash of options if $return_opts argument
|
|
|
|
* is non-empty.
|
|
|
|
* is non-empty.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function listSubscribed($ref, $mailbox, $status_opts=array())
|
|
|
|
function listSubscribed($ref, $mailbox, $return_opts=array())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return $this->_listMailboxes($ref, $mailbox, true, $status_opts, NULL);
|
|
|
|
return $this->_listMailboxes($ref, $mailbox, true, $return_opts, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -1325,9 +1325,9 @@ class rcube_imap_generic
|
|
|
|
* @param string $ref Reference name
|
|
|
|
* @param string $ref Reference name
|
|
|
|
* @param string $mailbox Mailbox name
|
|
|
|
* @param string $mailbox Mailbox name
|
|
|
|
* @param bool $subscribed Enables returning subscribed mailboxes only
|
|
|
|
* @param bool $subscribed Enables returning subscribed mailboxes only
|
|
|
|
* @param array $status_opts List of STATUS options
|
|
|
|
* @param array $return_opts List of RETURN options (RFC5819: LIST-STATUS, RFC5258: LIST-EXTENDED)
|
|
|
|
* (RFC5819: LIST-STATUS: MESSAGES, RECENT, UIDNEXT, UIDVALIDITY, UNSEEN)
|
|
|
|
* Possible: MESSAGES, RECENT, UIDNEXT, UIDVALIDITY, UNSEEN,
|
|
|
|
* or RETURN options (RFC5258: LIST_EXTENDED: SUBSCRIBED, CHILDREN)
|
|
|
|
* MYRIGHTS, SUBSCRIBED, CHILDREN
|
|
|
|
* @param array $select_opts List of selection options (RFC5258: LIST-EXTENDED)
|
|
|
|
* @param array $select_opts List of selection options (RFC5258: LIST-EXTENDED)
|
|
|
|
* Possible: SUBSCRIBED, RECURSIVEMATCH, REMOTE,
|
|
|
|
* Possible: SUBSCRIBED, RECURSIVEMATCH, REMOTE,
|
|
|
|
* SPECIAL-USE (RFC6154)
|
|
|
|
* SPECIAL-USE (RFC6154)
|
|
|
@ -1336,7 +1336,7 @@ class rcube_imap_generic
|
|
|
|
* is non-empty.
|
|
|
|
* is non-empty.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected function _listMailboxes($ref, $mailbox, $subscribed=false,
|
|
|
|
protected function _listMailboxes($ref, $mailbox, $subscribed=false,
|
|
|
|
$status_opts=array(), $select_opts=array())
|
|
|
|
$return_opts=array(), $select_opts=array())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!strlen($mailbox)) {
|
|
|
|
if (!strlen($mailbox)) {
|
|
|
|
$mailbox = '*';
|
|
|
|
$mailbox = '*';
|
|
|
@ -1354,17 +1354,23 @@ class rcube_imap_generic
|
|
|
|
$args[] = $this->escape($ref);
|
|
|
|
$args[] = $this->escape($ref);
|
|
|
|
$args[] = $this->escape($mailbox);
|
|
|
|
$args[] = $this->escape($mailbox);
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($status_opts) && $this->getCapability('LIST-EXTENDED')) {
|
|
|
|
if (!empty($return_opts) && $this->getCapability('LIST-EXTENDED')) {
|
|
|
|
$rets = array_intersect($status_opts, array('SUBSCRIBED', 'CHILDREN'));
|
|
|
|
$rets = array_intersect($return_opts, array('SUBSCRIBED', 'CHILDREN'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($status_opts) && $this->getCapability('LIST-STATUS')) {
|
|
|
|
if (!empty($return_opts) && $this->getCapability('LIST-STATUS')) {
|
|
|
|
$status_opts = array_intersect($status_opts, array('MESSAGES', 'RECENT', 'UIDNEXT', 'UIDVALIDITY', 'UNSEEN'));
|
|
|
|
$lstatus = true;
|
|
|
|
|
|
|
|
$status_opts = array('MESSAGES', 'RECENT', 'UIDNEXT', 'UIDVALIDITY', 'UNSEEN');
|
|
|
|
|
|
|
|
$opts = array_diff($return_opts, $status_opts);
|
|
|
|
|
|
|
|
$status_opts = array_diff($return_opts, $opts);
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($status_opts)) {
|
|
|
|
if (!empty($status_opts)) {
|
|
|
|
$lstatus = true;
|
|
|
|
|
|
|
|
$rets[] = 'STATUS (' . implode(' ', $status_opts) . ')';
|
|
|
|
$rets[] = 'STATUS (' . implode(' ', $status_opts) . ')';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($opts)) {
|
|
|
|
|
|
|
|
$rets = array_merge($rets, $opts);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($rets)) {
|
|
|
|
if (!empty($rets)) {
|
|
|
@ -1388,9 +1394,10 @@ class rcube_imap_generic
|
|
|
|
$line = substr($response, $last, $pos - $last);
|
|
|
|
$line = substr($response, $last, $pos - $last);
|
|
|
|
$last = $pos + 2;
|
|
|
|
$last = $pos + 2;
|
|
|
|
|
|
|
|
|
|
|
|
if (!preg_match('/^\* (LIST|LSUB|STATUS) /i', $line, $m)) {
|
|
|
|
if (!preg_match('/^\* (LIST|LSUB|STATUS|MYRIGHTS) /i', $line, $m)) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$cmd = strtoupper($m[1]);
|
|
|
|
$cmd = strtoupper($m[1]);
|
|
|
|
$line = substr($line, strlen($m[0]));
|
|
|
|
$line = substr($line, strlen($m[0]));
|
|
|
|
|
|
|
|
|
|
|
@ -1421,13 +1428,20 @@ class rcube_imap_generic
|
|
|
|
$this->data['LIST'][$mailbox], $opts));
|
|
|
|
$this->data['LIST'][$mailbox], $opts));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// * STATUS <mailbox> (<result>)
|
|
|
|
else if ($lstatus) {
|
|
|
|
else if ($cmd == 'STATUS') {
|
|
|
|
// * STATUS <mailbox> (<result>)
|
|
|
|
list($mailbox, $status) = $this->tokenizeResponse($line, 2);
|
|
|
|
if ($cmd == 'STATUS') {
|
|
|
|
|
|
|
|
list($mailbox, $status) = $this->tokenizeResponse($line, 2);
|
|
|
|
for ($i=0, $len=count($status); $i<$len; $i += 2) {
|
|
|
|
|
|
|
|
list($name, $value) = $this->tokenizeResponse($status, 2);
|
|
|
|
for ($i=0, $len=count($status); $i<$len; $i += 2) {
|
|
|
|
$folders[$mailbox][$name] = $value;
|
|
|
|
list($name, $value) = $this->tokenizeResponse($status, 2);
|
|
|
|
|
|
|
|
$folders[$mailbox][$name] = $value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// * MYRIGHTS <mailbox> <acl>
|
|
|
|
|
|
|
|
else if ($cmd == 'MYRIGHTS') {
|
|
|
|
|
|
|
|
list($mailbox, $acl) = $this->tokenizeResponse($line, 2);
|
|
|
|
|
|
|
|
$folders[$mailbox]['MYRIGHTS'] = $acl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|