public function getMailboxArray($msgnum)
{
$this->_buildMailbox();
$overview = $to_process = $uids = array();
/* Build the list of mailboxes and messages. */
foreach ($msgnum as $i) {
/* Make sure that the index is actually in the slice of messages
we're looking at. If we're hiding deleted messages, for
example, there may be gaps here. */
if (isset($this->_sorted[$i - 1])) {
$to_process[strval($this->_getMbox($i - 1))][$i] = $this->_sorted[$i - 1];
}
}
$fetch_query = new Horde_Imap_Client_Fetch_Query();
$fetch_query->envelope();
$fetch_query->flags();
$fetch_query->size();
$fetch_query->uid();
$fetch_query->headers('imp', array_merge(self::$headersUsed, IMP_Contents_Message::$headersUsed), array('cache' => true, 'peek' => true));
/* Retrieve information from each mailbox. */
foreach ($to_process as $mbox => $ids) {
try {
$imp_imap = IMP_Mailbox::get($mbox)->imp_imap;
if ($imp_imap->config->atc_structure) {
$query = clone $fetch_query;
$query->structure();
} else {
$query = $fetch_query;
}
$fetch_res = $imp_imap->fetch($mbox, $query, array('ids' => $imp_imap->getIdsOb($ids)));
$mbox_ids = array();
foreach ($ids as $k => $v) {
if (!isset($fetch_res[$v])) {
continue;
}
$f = $fetch_res[$v];
$uid = $f->getUid();
$v = array('envelope' => $f->getEnvelope(), 'flags' => $f->getFlags(), 'headers' => $f->getHeaders('imp', Horde_Imap_Client_Data_Fetch::HEADER_PARSE), 'idx' => $k, 'mailbox' => $mbox, 'size' => $f->getSize(), 'structure' => $f->getStructure(), 'uid' => $uid);
$overview[] = $v;
$mbox_ids[] = $uid;
}
$uids[$mbox] = $mbox_ids;
} catch (IMP_Imap_Exception $e) {
}
}
return array('overview' => $overview, 'uids' => new IMP_Indices($uids));
}