protected function _serverResponse(Horde_Imap_Client_Interaction_Pipeline $pipeline, Horde_Imap_Client_Interaction_Server $ob)
{
$token = $ob->token;
/* First, catch untagged responses where the name appears first on the
* line. */
switch ($first = Horde_String::upper($token->current())) {
case 'CAPABILITY':
$this->_parseCapability($pipeline, $token->flushIterator());
break;
case 'LIST':
case 'LSUB':
$this->_parseList($pipeline, $token);
break;
case 'STATUS':
// Parse a STATUS response (RFC 3501 [7.2.4]).
$this->_parseStatus($token);
break;
case 'SEARCH':
case 'SORT':
// Parse a SEARCH/SORT response (RFC 3501 [7.2.5] & RFC 5256 [4]).
$this->_parseSearch($pipeline, $token->flushIterator());
break;
case 'ESEARCH':
// Parse an ESEARCH response (RFC 4466 [2.6.2]).
$this->_parseEsearch($pipeline, $token);
break;
case 'FLAGS':
$token->next();
$this->_mailboxOb()->setStatus(Horde_Imap_Client::STATUS_FLAGS, array_map('Horde_String::lower', $token->flushIterator()));
break;
case 'QUOTA':
$this->_parseQuota($pipeline, $token);
break;
case 'QUOTAROOT':
// Ignore this line - we can get this information from
// the untagged QUOTA responses.
break;
case 'NAMESPACE':
$this->_parseNamespace($pipeline, $token);
break;
case 'THREAD':
$this->_parseThread($pipeline, $token);
break;
case 'ACL':
$this->_parseACL($pipeline, $token);
break;
case 'LISTRIGHTS':
$this->_parseListRights($pipeline, $token);
break;
case 'MYRIGHTS':
$this->_parseMyRights($pipeline, $token);
break;
case 'ID':
// ID extension (RFC 2971)
$this->_parseID($pipeline, $token);
break;
case 'ENABLED':
// ENABLE extension (RFC 5161)
$this->_parseEnabled($token);
break;
case 'LANGUAGE':
// LANGUAGE extension (RFC 5255 [3.2])
$this->_parseLanguage($token);
break;
case 'COMPARATOR':
// I18NLEVEL=2 extension (RFC 5255 [4.7])
$this->_parseComparator($pipeline, $token);
break;
case 'VANISHED':
// QRESYNC extension (RFC 7162 [3.2.10])
$this->_parseVanished($pipeline, $token);
break;
case 'ANNOTATION':
// Parse an ANNOTATION response.
$this->_parseAnnotation($pipeline, $token);
break;
case 'METADATA':
// Parse a METADATA response.
$this->_parseMetadata($pipeline, $token);
break;
default:
// Next, look for responses where the keywords occur second.
switch (Horde_String::upper($token->next())) {
case 'EXISTS':
// EXISTS response - RFC 3501 [7.3.2]
$mbox_ob = $this->_mailboxOb();
// Increment UIDNEXT if it is set.
if ($mbox_ob->open && ($uidnext = $mbox_ob->getStatus(Horde_Imap_Client::STATUS_UIDNEXT))) {
$mbox_ob->setStatus(Horde_Imap_Client::STATUS_UIDNEXT, $uidnext + $first - $mbox_ob->getStatus(Horde_Imap_Client::STATUS_MESSAGES));
}
$mbox_ob->setStatus(Horde_Imap_Client::STATUS_MESSAGES, $first);
break;
case 'RECENT':
// RECENT response - RFC 3501 [7.3.1]
$this->_mailboxOb()->setStatus(Horde_Imap_Client::STATUS_RECENT, $first);
break;
case 'EXPUNGE':
// EXPUNGE response - RFC 3501 [7.4.1]
$this->_deleteMsgs($this->_selected, $this->getIdsOb($first, true), array('decrement' => true, 'pipeline' => $pipeline));
$pipeline->data['expunge_seen'] = true;
break;
case 'FETCH':
// FETCH response - RFC 3501 [7.4.2]
$this->_parseFetch($pipeline, $first, $token);
break;
}
break;
}
}