protected function _parseNamespace(Horde_Imap_Client_Interaction_Pipeline $pipeline, Horde_Imap_Client_Tokenize $data)
{
$namespace_array = array(Horde_Imap_Client_Data_Namespace::NS_PERSONAL, Horde_Imap_Client_Data_Namespace::NS_OTHER, Horde_Imap_Client_Data_Namespace::NS_SHARED);
$c = array();
// Per RFC 2342, response from NAMESPACE command is:
// (PERSONAL NAMESPACES) (OTHER_USERS NAMESPACE) (SHARED NAMESPACES)
foreach ($namespace_array as $val) {
$entry = $data->next();
if (is_null($entry)) {
continue;
}
while ($data->next() !== false) {
$ob = Horde_Imap_Client_Mailbox::get($data->next(), true);
$ns = new Horde_Imap_Client_Data_Namespace();
$ns->delimiter = $data->next();
$ns->name = strval($ob);
$ns->type = $val;
$c[strval($ob)] = $ns;
// RFC 4466: NAMESPACE extensions
while (($ext = $data->next()) !== false) {
switch (Horde_String::upper($ext)) {
case 'TRANSLATION':
// RFC 5255 [3.4] - TRANSLATION extension
$data->next();
$ns->translation = $data->next();
$data->next();
break;
}
}
}
}
$pipeline->data['namespace'] = new Horde_Imap_Client_Namespace_List($c);
}