/**
* Unlocks a previously locked address book.
*
* @param string $abook Name of address book containing locked entry.
* @param string $bookEntry Name of entry to unlock.
*
* @throws Horde_Imsp_Exception
*/
public function unlockEntry($abook, $bookEntry)
{
// Start sending command.
$this->_imsp->send('UNLOCK ADDRESSBOOK ', true, false);
// {} for book name?
if (preg_match(Horde_Imsp_Client_Base::MUST_USE_LITERAL, $abook)) {
$biBook = sprintf("{%d}", strlen($abook));
$this->_imsp->send($biBook, false, true, true);
}
$this->_imsp->send("{$abook} ", false, false);
//How bout for entry name?
if (preg_match(Horde_Imsp_Client_Base::MUST_USE_LITERAL, $bookEntry)) {
$biEntry = sprintf("{%d}", strlen($bookEntry));
$this->_imsp->send($biEntry, false, true, true);
$this->_imsp->send($bookEntry, false, true);
} else {
$bookEntry = $this->_imsp->quoteSpacedString($bookEntry);
$this->_imsp->send("{$bookEntry}", false, true);
}
$response = $this->_imsp->receive();
switch ($response) {
case 'NO':
// Could not create abook.
$this->_imsp->_logger->err('IMSP server is unable to perform your request.');
throw new Horde_Imsp_Exception('IMSP server is unable to perform your request.');
case 'BAD':
$this->_imsp->_logger->err('The IMSP server did not understand your request.');
throw new Horde_Imsp_Exception('The IMSP server did not understand your request.');
case 'OK':
$this->_imsp->_logger->debug("UNLOCK ADDRESSBOOK on {$abook} {$bookEntry} OK");
}
}