Skip to content

Commit

Permalink
[mms] Delimiter information is now always returned from Horde_Imap_Cl…
Browse files Browse the repository at this point in the history
…ient_Base#listMailboxes().
  • Loading branch information
slusarz committed Jun 11, 2014
1 parent 0ca089a commit e70a817
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 26 deletions.
2 changes: 2 additions & 0 deletions framework/Imap_Client/doc/Horde/Imap/Client/UPGRADING
Expand Up @@ -19,6 +19,8 @@ Upgrading to 2.23.0
- listMailboxes()

Added the Horde_Imap_Client::MBOX_ALL_SUBSCRIBED $mode option.
Removed the 'delimiter' option (delimiter information is always
returned now).


Upgrading to 2.22.0
Expand Down
8 changes: 2 additions & 6 deletions framework/Imap_Client/lib/Horde/Imap/Client/Base.php
Expand Up @@ -1278,11 +1278,8 @@ abstract protected function _subscribeMailbox(Horde_Imap_Client_Mailbox $mailbox
* option, or if the CHILDREN extension is available, but it
* is not guaranteed.
* DEFAULT: false
* - delimiter: (boolean) If true, return delimiter information under
* the'delimiter' key.
* DEFAULT: Do not return this information.
* - flat: (boolean) If true, return a flat list of mailbox names only.
* Overrides both the 'attributes' and 'delimiter' options.
* Overrides the 'attributes' option.
* DEFAULT: Do not return flat list.
* - recursivematch: (boolean) Force the server to return information
* about parent mailboxes that don't match other
Expand Down Expand Up @@ -1321,8 +1318,7 @@ abstract protected function _subscribeMailbox(Horde_Imap_Client_Mailbox $mailbox
* with these keys:
* - attributes: (array) List of lower-cased attributes [only if
* 'attributes' option is true].
* - delimiter: (string) The delimiter for the mailbox [only if
* 'delimiter' option is true].
* - delimiter: (string) The delimiter for the mailbox.
* - extended: (TODO) TODO [only if 'recursivematch' option is true and
* LIST-EXTENDED extension is supported on the server].
* - mailbox: (Horde_Imap_Client_Mailbox) The mailbox object.
Expand Down
10 changes: 4 additions & 6 deletions framework/Imap_Client/lib/Horde/Imap/Client/Socket.php
Expand Up @@ -1190,7 +1190,6 @@ protected function _listMailboxes($pattern, $mode, $options)
$pattern,
Horde_Imap_Client::MBOX_SUBSCRIBED,
array(
'delimiter' => !empty($options['delimiter']),
'flat' => !empty($options['flat']),
'no_listext' => true
)
Expand Down Expand Up @@ -1449,7 +1448,10 @@ protected function _parseList(
return;
}

$tmp = array('mailbox' => $mbox);
$tmp = array(
'delimiter' => $delimiter,
'mailbox' => $mbox
);

if ($attr || !empty($ml['opts']['attributes'])) {
if (is_null($attr)) {
Expand All @@ -1468,10 +1470,6 @@ protected function _parseList(
$tmp['attributes'] = array_keys($attr);
}

if (!empty($ml['opts']['delimiter'])) {
$tmp['delimiter'] = $delimiter;
}

if ($data->next() !== false) {
$tmp['extended'] = $data->flushIterator();
}
Expand Down
17 changes: 6 additions & 11 deletions framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php
Expand Up @@ -501,18 +501,13 @@ protected function _subscribeMailbox(Horde_Imap_Client_Mailbox $mailbox,
*/
protected function _listMailboxes($pattern, $mode, $options)
{
$tmp = array(
'mailbox' => Horde_Imap_Client_Mailbox::get('INBOX')
return array(
'INBOX' => array(
'attributes' => array(),
'delimiter' => '',
'mailbox' => Horde_Imap_Client_Mailbox::get('INBOX')
)
);

if (!empty($options['attributes'])) {
$tmp['attributes'] = array();
}
if (!empty($options['delimiter'])) {
$tmp['delimiter'] = '';
}

return array('INBOX' => $tmp);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions framework/Imap_Client/package.xml
Expand Up @@ -21,6 +21,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Delimiter information is now always returned from Horde_Imap_Client_Base#listMailboxes().
* [mms] Fix broken MBOX_UNSUBSCRIBED behavior on IMAP servers that support LIST-EXTENDED.
* [mms] Added the MBOX_ALL_SUBSCRIBED mode to Horde_Imap_Client_Base#listMailboxes().
</notes>
Expand Down Expand Up @@ -2468,6 +2469,7 @@
<date>2014-06-06</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Delimiter information is now always returned from Horde_Imap_Client_Base#listMailboxes().
* [mms] Fix broken MBOX_UNSUBSCRIBED behavior on IMAP servers that support LIST-EXTENDED.
* [mms] Added the MBOX_ALL_SUBSCRIBED mode to Horde_Imap_Client_Base#listMailboxes().
</notes>
Expand Down
Expand Up @@ -118,9 +118,9 @@ public function testCommands()
// Listing subscribed mailboxes (flat format).
$this->imap->listMailboxes('*', Horde_Imap_Client::MBOX_SUBSCRIBED, array('flat' => true));

// Listing unsubscribed mailboxes in base level (with attribute and
// delimiter information).
$this->imap->listMailboxes('%', Horde_Imap_Client::MBOX_UNSUBSCRIBED, array('attributes' => true, 'delimiter' => true));
// Listing unsubscribed mailboxes in base level (with attribute
// information).
$this->imap->listMailboxes('%', Horde_Imap_Client::MBOX_UNSUBSCRIBED, array('attributes' => true));

// Re-create mailboxes for tests.
$this->imap->createMailbox($test_mbox);
Expand Down

0 comments on commit e70a817

Please sign in to comment.