/**
  * Returns a list of addressbooks, filtered by ids.
  *
  * Output format identical to rcmail::get_address_sources().
  *
  * @param array $ids      IDs of addressbooks.
  * @param bool  $writable If set to true, fetches only writable addressbooks.
  *
  * @see rcmail::get_address_sources().
  *
  * @return array Addressbooks sources.
  */
 protected function get_addressbooks(array $ids, $writable = true)
 {
     $ids = array_flip($ids);
     // handle 'sql' addressbook properly: get_address_sources identifies sql addressbook as '0'
     if (isset($ids['sql'])) {
         unset($ids['sql']);
         $ids[0] = 0;
     }
     $all_addresbooks = $this->rcmail->get_address_sources($writable);
     // return standard output from get_address_sources including only addressbooks specified in $ids
     return array_intersect_key($all_addresbooks, $ids);
 }