/** * @param string $cc * @param string $to * @param \Conjoon\Data\Entity\Mail\MailAccountEntity $usedAccount The mail account * which is most likely used to answer to this message * * @return array */ protected function buildCcAddressList(array $cc, array $to, \Conjoon\Data\Entity\Mail\MailAccountEntity $usedAccount = null) { if (!$this->replyAll) { return array(); } $accounts = $this->accountService->getMailAccounts(); $filterAddressList = array(); for ($i = 0, $len = count($accounts); $i < $len; $i++) { if ($usedAccount && $usedAccount->getId() == $accounts[$i]->getId()) { $filterAddressList[] = $accounts[$i]->getAddress(); break; } } $merge = array(); for ($i = 0, $len = max(count($cc), count($to)); $i < $len; $i++) { if (isset($cc[$i]) && !in_array($cc[$i]['address'], $filterAddressList)) { $merge[] = $cc[$i]; } if (isset($to[$i]) && !in_array($to[$i]['address'], $filterAddressList)) { $merge[] = $to[$i]; } } return $merge; }
/** * Returns a pooled connection. * * @param \Conjoon\Data\Entity\Mail\MailAccountEntity $mailAccount * * @return \Conjoon\Data\Repository\Remote\RemoteConnection */ protected function getConnectionFromPoolForAccount(\Conjoon\Data\Entity\Mail\MailAccountEntity $mailAccount) { $id = $mailAccount->getId(); if (!isset($this->connectionPool[$id])) { $this->connectionPool[$id] = $this->createConnectionForAccount($mailAccount); } return $this->connectionPool[$id]; }