Path: blob/master/src/applications/conpherence/mail/ConpherenceReplyHandler.php
12256 views
<?php12final class ConpherenceReplyHandler extends PhabricatorMailReplyHandler {34private $mailAddedParticipantPHIDs;56public function setMailAddedParticipantPHIDs(array $phids) {7$this->mailAddedParticipantPHIDs = $phids;8return $this;9}10public function getMailAddedParticipantPHIDs() {11return $this->mailAddedParticipantPHIDs;12}1314public function validateMailReceiver($mail_receiver) {15if (!($mail_receiver instanceof ConpherenceThread)) {16throw new Exception(17pht(18'Mail receiver is not a %s!', '19ConpherenceThread'));20}21}2223public function getPrivateReplyHandlerEmailAddress(PhabricatorUser $user) {24return $this->getDefaultPrivateReplyHandlerEmailAddress($user, 'Z');25}2627public function getPublicReplyHandlerEmailAddress() {28return $this->getDefaultPublicReplyHandlerEmailAddress('Z');29}3031protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {32$conpherence = $this->getMailReceiver();33$user = $this->getActor();34if (!$conpherence->getPHID()) {35$conpherence36->attachParticipants(array());37} else {38$participants = id(new ConpherenceParticipant())39->loadAllWhere('conpherencePHID = %s', $conpherence->getPHID());40$participants = mpull($participants, null, 'getParticipantPHID');41$conpherence->attachParticipants($participants);42}4344$content_source = $mail->newContentSource();4546$editor = id(new ConpherenceEditor())47->setActor($user)48->setContentSource($content_source)49->setParentMessageID($mail->getMessageID());5051$body = $mail->getCleanTextBody();52$body = $this->enhanceBodyWithAttachments($body, $mail->getAttachments());5354$xactions = array();55if ($this->getMailAddedParticipantPHIDs()) {56$xactions[] = id(new ConpherenceTransaction())57->setTransactionType(58ConpherenceThreadParticipantsTransaction::TRANSACTIONTYPE)59->setNewValue(array('+' => $this->getMailAddedParticipantPHIDs()));60}6162$xactions = array_merge(63$xactions,64$editor->generateTransactionsFromText(65$user,66$conpherence,67$body));6869$editor->applyTransactions($conpherence, $xactions);7071return $conpherence;72}7374}757677