public function sync($mailbox, $token, array $opts = array())
{
if (($token = base64_decode($token, true)) === false) {
throw new Horde_Imap_Client_Exception_Sync('Bad token.', Horde_Imap_Client_Exception_Sync::BAD_TOKEN);
}
$sync = array();
foreach (explode(',', $token) as $val) {
$sync[substr($val, 0, 1)] = substr($val, 1);
}
return new Horde_Imap_Client_Data_Sync($this, $mailbox, $sync, $this->_syncStatus($mailbox), isset($opts['criteria']) ? $opts['criteria'] : Horde_Imap_Client::SYNC_ALL, isset($opts['ids']) ? $opts['ids'] : null);
}