From 2e30f44d1cd66748fe7787e8a2293cef8d9c5989 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 9 Feb 2010 23:07:31 -0700 Subject: [PATCH] Set inferred attributes if using LIST-EXTENDED --- framework/Imap_Client/lib/Horde/Imap/Client/Socket.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php b/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php index da389d783..430b7691d 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php @@ -993,6 +993,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base $t = &$this->_temp; $t['mailboxlist'] = array( 'check' => $check, + 'ext' => false, 'options' => $options, 'subexist' => ($mode == Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS), 'subscribed' => ($check ? array_flip($subscribed) : null) @@ -1001,6 +1002,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base if ($this->queryCapability('LIST-EXTENDED')) { $cmd = 'LIST'; + $t['mailboxlist']['ext'] = true; $return_opts = $select_opts = array(); @@ -1121,10 +1123,10 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base return; } else if ((!$ml['check'] && $ml['subexist']) || (empty($mlo['flat']) && !empty($mlo['attributes']))) { - $attr = array_map('strtolower', $data[1]); + $attr = array_flip(array_map('strtolower', $data[1])); if ($ml['subexist'] && !$ml['check'] && - in_array('\\nonexistent', $attr)) { + isset($attr['\\nonexistent'])) { return; } } @@ -1136,7 +1138,16 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base if (empty($mlo['flat'])) { $tmp = array('mailbox' => $mbox); if (!empty($mlo['attributes'])) { - $tmp['attributes'] = $attr; + /* RFC 5258 [3.4]: inferred attributes. */ + if ($ml['ext']) { + if (isset($attr['\\noinferiors'])) { + $attr['\\hasnochildren'] = 1; + } + if (isset($attr['\\nonexistent'])) { + $attr['\\noselect'] = 1; + } + } + $tmp['attributes'] = array_keys($attr); } if (!empty($mlo['delimiter'])) { $tmp['delimiter'] = $data[2]; -- 2.11.0