Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/query/PhabricatorMetaMTAActor.php
<?php | <?php | ||||
final class PhabricatorMetaMTAActor extends Phobject { | final class PhabricatorMetaMTAActor extends Phobject { | ||||
const STATUS_DELIVERABLE = 'deliverable'; | const STATUS_DELIVERABLE = 'deliverable'; | ||||
const STATUS_UNDELIVERABLE = 'undeliverable'; | const STATUS_UNDELIVERABLE = 'undeliverable'; | ||||
const REASON_NONE = 'none'; | |||||
const REASON_UNLOADABLE = 'unloadable'; | const REASON_UNLOADABLE = 'unloadable'; | ||||
const REASON_UNMAILABLE = 'unmailable'; | const REASON_UNMAILABLE = 'unmailable'; | ||||
const REASON_NO_ADDRESS = 'noaddress'; | const REASON_NO_ADDRESS = 'noaddress'; | ||||
const REASON_DISABLED = 'disabled'; | const REASON_DISABLED = 'disabled'; | ||||
const REASON_MAIL_DISABLED = 'maildisabled'; | const REASON_MAIL_DISABLED = 'maildisabled'; | ||||
const REASON_EXTERNAL_TYPE = 'exernaltype'; | const REASON_EXTERNAL_TYPE = 'exernaltype'; | ||||
const REASON_RESPONSE = 'response'; | const REASON_RESPONSE = 'response'; | ||||
const REASON_SELF = 'self'; | const REASON_SELF = 'self'; | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | final class PhabricatorMetaMTAActor extends Phobject { | ||||
public function isDeliverable() { | public function isDeliverable() { | ||||
return ($this->status === self::STATUS_DELIVERABLE); | return ($this->status === self::STATUS_DELIVERABLE); | ||||
} | } | ||||
public function getDeliverabilityReasons() { | public function getDeliverabilityReasons() { | ||||
return $this->reasons; | return $this->reasons; | ||||
} | } | ||||
public static function isDeliveryReason($reason) { | |||||
switch ($reason) { | |||||
case self::REASON_NONE: | |||||
case self::REASON_FORCE: | |||||
case self::REASON_FORCE_HERALD: | |||||
return true; | |||||
default: | |||||
// All other reasons cause the message to not be delivered. | |||||
return false; | |||||
} | |||||
} | |||||
public static function getReasonName($reason) { | |||||
$names = array( | |||||
self::REASON_NONE => pht('None'), | |||||
self::REASON_DISABLED => pht('Disabled Recipient'), | |||||
self::REASON_BOT => pht('Bot Recipient'), | |||||
self::REASON_NO_ADDRESS => pht('No Address'), | |||||
self::REASON_EXTERNAL_TYPE => pht('External Recipient'), | |||||
self::REASON_UNMAILABLE => pht('Not Mailable'), | |||||
self::REASON_RESPONSE => pht('Similar Reply'), | |||||
self::REASON_SELF => pht('Self Mail'), | |||||
self::REASON_MAIL_DISABLED => pht('Mail Disabled'), | |||||
self::REASON_MAILTAGS => pht('Mail Tags'), | |||||
self::REASON_UNLOADABLE => pht('Bad Recipient'), | |||||
self::REASON_FORCE => pht('Forced Mail'), | |||||
self::REASON_FORCE_HERALD => pht('Forced by Herald'), | |||||
); | |||||
return idx($names, $reason, pht('Unknown ("%s")', $reason)); | |||||
} | |||||
public static function getReasonDescription($reason) { | public static function getReasonDescription($reason) { | ||||
$descriptions = array( | $descriptions = array( | ||||
self::REASON_NONE => pht( | |||||
'No special rules affected this mail.'), | |||||
self::REASON_DISABLED => pht( | self::REASON_DISABLED => pht( | ||||
'This user is disabled; disabled users do not receive mail.'), | 'This user is disabled; disabled users do not receive mail.'), | ||||
self::REASON_BOT => pht( | self::REASON_BOT => pht( | ||||
'This user is a bot; bot accounts do not receive mail.'), | 'This user is a bot; bot accounts do not receive mail.'), | ||||
self::REASON_NO_ADDRESS => pht( | self::REASON_NO_ADDRESS => pht( | ||||
'Unable to load an email address for this PHID.'), | 'Unable to load an email address for this PHID.'), | ||||
self::REASON_EXTERNAL_TYPE => pht( | self::REASON_EXTERNAL_TYPE => pht( | ||||
'Only external accounts of type "email" are deliverable; this '. | 'Only external accounts of type "email" are deliverable; this '. | ||||
Show All 38 Lines |