Page MenuHomePhabricator

D19954.diff
No OneTemporary

D19954.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3373,11 +3373,15 @@
'PhabricatorMacroTransactionQuery' => 'applications/macro/query/PhabricatorMacroTransactionQuery.php',
'PhabricatorMacroTransactionType' => 'applications/macro/xaction/PhabricatorMacroTransactionType.php',
'PhabricatorMacroViewController' => 'applications/macro/controller/PhabricatorMacroViewController.php',
+ 'PhabricatorMailAttachment' => 'applications/metamta/message/PhabricatorMailAttachment.php',
'PhabricatorMailConfigTestCase' => 'applications/metamta/storage/__tests__/PhabricatorMailConfigTestCase.php',
'PhabricatorMailEmailHeraldField' => 'applications/metamta/herald/PhabricatorMailEmailHeraldField.php',
'PhabricatorMailEmailHeraldFieldGroup' => 'applications/metamta/herald/PhabricatorMailEmailHeraldFieldGroup.php',
+ 'PhabricatorMailEmailMessage' => 'applications/metamta/message/PhabricatorMailEmailMessage.php',
'PhabricatorMailEmailSubjectHeraldField' => 'applications/metamta/herald/PhabricatorMailEmailSubjectHeraldField.php',
'PhabricatorMailEngineExtension' => 'applications/metamta/engine/PhabricatorMailEngineExtension.php',
+ 'PhabricatorMailExternalMessage' => 'applications/metamta/message/PhabricatorMailExternalMessage.php',
+ 'PhabricatorMailHeader' => 'applications/metamta/message/PhabricatorMailHeader.php',
'PhabricatorMailImplementationAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationAdapter.php',
'PhabricatorMailImplementationAmazonSESAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php',
'PhabricatorMailImplementationMailgunAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php',
@@ -3443,7 +3447,6 @@
'PhabricatorMetaMTAApplicationEmailQuery' => 'applications/metamta/query/PhabricatorMetaMTAApplicationEmailQuery.php',
'PhabricatorMetaMTAApplicationEmailTransaction' => 'applications/metamta/storage/PhabricatorMetaMTAApplicationEmailTransaction.php',
'PhabricatorMetaMTAApplicationEmailTransactionQuery' => 'applications/metamta/query/PhabricatorMetaMTAApplicationEmailTransactionQuery.php',
- 'PhabricatorMetaMTAAttachment' => 'applications/metamta/storage/PhabricatorMetaMTAAttachment.php',
'PhabricatorMetaMTAConfigOptions' => 'applications/config/option/PhabricatorMetaMTAConfigOptions.php',
'PhabricatorMetaMTAController' => 'applications/metamta/controller/PhabricatorMetaMTAController.php',
'PhabricatorMetaMTADAO' => 'applications/metamta/storage/PhabricatorMetaMTADAO.php',
@@ -9182,11 +9185,15 @@
'PhabricatorMacroTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorMacroTransactionType' => 'PhabricatorModularTransactionType',
'PhabricatorMacroViewController' => 'PhabricatorMacroController',
+ 'PhabricatorMailAttachment' => 'Phobject',
'PhabricatorMailConfigTestCase' => 'PhabricatorTestCase',
'PhabricatorMailEmailHeraldField' => 'HeraldField',
'PhabricatorMailEmailHeraldFieldGroup' => 'HeraldFieldGroup',
+ 'PhabricatorMailEmailMessage' => 'PhabricatorMailExternalMessage',
'PhabricatorMailEmailSubjectHeraldField' => 'PhabricatorMailEmailHeraldField',
'PhabricatorMailEngineExtension' => 'Phobject',
+ 'PhabricatorMailExternalMessage' => 'Phobject',
+ 'PhabricatorMailHeader' => 'Phobject',
'PhabricatorMailImplementationAdapter' => 'Phobject',
'PhabricatorMailImplementationAmazonSESAdapter' => 'PhabricatorMailImplementationPHPMailerLiteAdapter',
'PhabricatorMailImplementationMailgunAdapter' => 'PhabricatorMailImplementationAdapter',
@@ -9259,7 +9266,6 @@
'PhabricatorMetaMTAApplicationEmailQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorMetaMTAApplicationEmailTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorMetaMTAApplicationEmailTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
- 'PhabricatorMetaMTAAttachment' => 'Phobject',
'PhabricatorMetaMTAConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorMetaMTAController' => 'PhabricatorController',
'PhabricatorMetaMTADAO' => 'PhabricatorLiskDAO',
diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php
--- a/src/applications/audit/editor/PhabricatorAuditEditor.php
+++ b/src/applications/audit/editor/PhabricatorAuditEditor.php
@@ -611,7 +611,7 @@
$commit->getCommitIdentifier());
$template->addAttachment(
- new PhabricatorMetaMTAAttachment(
+ new PhabricatorMailAttachment(
$raw_patch,
$commit_name.'.patch',
'text/x-patch; charset='.$encoding));
diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
--- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
@@ -364,7 +364,7 @@
->setEvents(array($event))
->writeICSDocument();
- $ics_attachment = new PhabricatorMetaMTAAttachment(
+ $ics_attachment = new PhabricatorMailAttachment(
$ics_data,
$event->getICSFilename(),
'text/calendar');
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -715,7 +715,7 @@
$name = pht('D%s.%s.patch', $object->getID(), $diff->getID());
$mime_type = 'text/x-patch; charset=utf-8';
$body->addAttachment(
- new PhabricatorMetaMTAAttachment($patch, $name, $mime_type));
+ new PhabricatorMailAttachment($patch, $name, $mime_type));
}
}
}
diff --git a/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php
--- a/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php
@@ -193,7 +193,7 @@
$data = Filesystem::readFile($attachment);
$name = basename($attachment);
$mime = Filesystem::getMimeType($attachment);
- $file = new PhabricatorMetaMTAAttachment($data, $name, $mime);
+ $file = new PhabricatorMailAttachment($data, $name, $mime);
$mail->addAttachment($file);
}
diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAAttachment.php b/src/applications/metamta/message/PhabricatorMailAttachment.php
rename from src/applications/metamta/storage/PhabricatorMetaMTAAttachment.php
rename to src/applications/metamta/message/PhabricatorMailAttachment.php
--- a/src/applications/metamta/storage/PhabricatorMetaMTAAttachment.php
+++ b/src/applications/metamta/message/PhabricatorMailAttachment.php
@@ -1,6 +1,6 @@
<?php
-final class PhabricatorMetaMTAAttachment extends Phobject {
+final class PhabricatorMailAttachment extends Phobject {
private $data;
private $filename;
diff --git a/src/applications/metamta/message/PhabricatorMailEmailMessage.php b/src/applications/metamta/message/PhabricatorMailEmailMessage.php
new file mode 100644
--- /dev/null
+++ b/src/applications/metamta/message/PhabricatorMailEmailMessage.php
@@ -0,0 +1,103 @@
+<?php
+
+final class PhabricatorMailEmailMessage
+ extends PhabricatorMailExternalMessage {
+
+ const MESSAGETYPE = 'email';
+
+ private $fromAddress;
+ private $replyToAddress;
+ private $toAddresses = array();
+ private $ccAddresses = array();
+ private $headers = array();
+ private $attachments = array();
+ private $subject;
+ private $textBody;
+ private $htmlBody;
+
+ public function setFromAddress(PhutilEmailAddress $from_address) {
+ $this->fromAddress = $from_address;
+ return $this;
+ }
+
+ public function getFromAddress() {
+ return $this->fromAddress;
+ }
+
+ public function setReplyToAddress(PhutilEmailAddress $address) {
+ $this->replyToAddress = $address;
+ return $this;
+ }
+
+ public function getReplyToAddress() {
+ return $this->replyToAddress;
+ }
+
+ public function setToAddresses(array $addresses) {
+ assert_instances_of($addresses, 'PhutilEmailAddress');
+ $this->toAddresses = $addresses;
+ return $this;
+ }
+
+ public function getToAddresses() {
+ return $this->toAddresses;
+ }
+
+ public function setCCAddresses(array $addresses) {
+ assert_instances_of($addresses, 'PhutilEmailAddress');
+ $this->ccAddresses = $addresses;
+ return $this;
+ }
+
+ public function getCCAddresses() {
+ return $this->ccAddresses;
+ }
+
+ public function setHeaders(array $headers) {
+ assert_instances_of($headers, 'PhabricatorMailHeader');
+ $this->headers = $headers;
+ return $this;
+ }
+
+ public function getHeaders() {
+ return $this->headers;
+ }
+
+ public function setAttachments(array $attachments) {
+ assert_instances_of($attachments, 'PhabricatorMailAttachment');
+ $this->attachments = $attachments;
+ return $this;
+ }
+
+ public function getAttachments() {
+ return $this->attachments;
+ }
+
+ public function setSubject($subject) {
+ $this->subject = $subject;
+ return $this;
+ }
+
+ public function getSubject() {
+ return $this->subject;
+ }
+
+ public function setTextBody($text_body) {
+ $this->textBody = $text_body;
+ return $this;
+ }
+
+ public function getTextBody() {
+ return $this->textBody;
+ }
+
+ public function setHTMLBody($html_body) {
+ $this->htmlBody = $html_body;
+ return $this;
+ }
+
+ public function getHTMLBody() {
+ return $this->htmlBody;
+ }
+
+}
diff --git a/src/applications/metamta/message/PhabricatorMailExternalMessage.php b/src/applications/metamta/message/PhabricatorMailExternalMessage.php
new file mode 100644
--- /dev/null
+++ b/src/applications/metamta/message/PhabricatorMailExternalMessage.php
@@ -0,0 +1,10 @@
+<?php
+
+abstract class PhabricatorMailExternalMessage
+ extends Phobject {
+
+ final public function getMessageType() {
+ return $this->getPhobjectClassConstant('MESSAGETYPE');
+ }
+
+}
diff --git a/src/applications/metamta/message/PhabricatorMailHeader.php b/src/applications/metamta/message/PhabricatorMailHeader.php
new file mode 100644
--- /dev/null
+++ b/src/applications/metamta/message/PhabricatorMailHeader.php
@@ -0,0 +1,27 @@
+<?php
+
+final class PhabricatorMailHeader
+ extends Phobject {
+
+ private $name;
+ private $value;
+
+ public function setName($name) {
+ $this->name = $name;
+ return $this;
+ }
+
+ public function getName() {
+ return $this->name;
+ }
+
+ public function setValue($value) {
+ $this->value = $value;
+ return $this;
+ }
+
+ public function getValue() {
+ return $this->value;
+ }
+
+}
diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
--- a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
+++ b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
@@ -191,7 +191,7 @@
return $this;
}
- public function addAttachment(PhabricatorMetaMTAAttachment $attachment) {
+ public function addAttachment(PhabricatorMailAttachment $attachment) {
$this->parameters['attachments'][] = $attachment->toDictionary();
return $this;
}
@@ -201,7 +201,7 @@
$result = array();
foreach ($dicts as $dict) {
- $result[] = PhabricatorMetaMTAAttachment::newFromDictionary($dict);
+ $result[] = PhabricatorMailAttachment::newFromDictionary($dict);
}
return $result;
}
@@ -236,7 +236,7 @@
}
public function setAttachments(array $attachments) {
- assert_instances_of($attachments, 'PhabricatorMetaMTAAttachment');
+ assert_instances_of($attachments, 'PhabricatorMailAttachment');
$this->setParam('attachments', mpull($attachments, 'toDictionary'));
return $this;
}
diff --git a/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php b/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php
--- a/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php
+++ b/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php
@@ -155,11 +155,11 @@
/**
* Add an attachment.
*
- * @param PhabricatorMetaMTAAttachment Attachment.
+ * @param PhabricatorMailAttachment Attachment.
* @return this
* @task compose
*/
- public function addAttachment(PhabricatorMetaMTAAttachment $attachment) {
+ public function addAttachment(PhabricatorMailAttachment $attachment) {
$this->attachments[] = $attachment;
return $this;
}
@@ -187,7 +187,7 @@
/**
* Retrieve attachments.
*
- * @return list<PhabricatorMetaMTAAttachment> Attachments.
+ * @return list<PhabricatorMailAttachment> Attachments.
* @task render
*/
public function getAttachments() {

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 11, 8:31 PM (20 h, 21 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6985163
Default Alt Text
D19954.diff (12 KB)

Event Timeline