Some Renames:

- EMail => EMail
- toEmail => toAddress
- fromEmail => fromAddress
This commit is contained in:
Philipp Holzer 2020-01-26 23:47:16 +01:00
parent f6878b5bcf
commit 765a0d8892
No known key found for this signature in database
GPG Key ID: D8365C3D36B77D90
5 changed files with 23 additions and 25 deletions

View File

@ -15,10 +15,8 @@ use Friendica\Model\ItemContent;
use Friendica\Model\Notify; use Friendica\Model\Notify;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Model\UserItem; use Friendica\Model\UserItem;
use Friendica\Object\EMail; use Friendica\Object\Email;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Emailer;
/** /**
* Creates a notification entry and possibly sends a mail * Creates a notification entry and possibly sends a mail
@ -610,7 +608,7 @@ function notification($params)
'$content_allowed' => $content_allowed, '$content_allowed' => $content_allowed,
]); ]);
$email = new EMail($sender_name, $sender_email, $sender_email, $params['to_email'], $email = new Email($sender_name, $sender_email, $sender_email, $params['to_email'],
$datarray['subject'], $email_html_body, $email_text_body, $datarray['subject'], $email_html_body, $email_text_body,
$datarray['headers'], $params['uid']); $datarray['headers'], $params['uid']);

View File

@ -23,7 +23,7 @@ interface IEmail
* *
* @return string * @return string
*/ */
function getFromEmail(); function getFromAddress();
/** /**
* Gets the UID of the sender of this email * Gets the UID of the sender of this email
@ -44,7 +44,7 @@ interface IEmail
* *
* @return string * @return string
*/ */
function getToEmail(); function getToAddress();
/** /**
* Gets the subject of this email * Gets the subject of this email

View File

@ -7,12 +7,12 @@ use Friendica\App\BaseURL;
use Friendica\Content\Text\HTML; use Friendica\Content\Text\HTML;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Object\EMail; use Friendica\Object\Email;
/** /**
* Class for creating CC emails based on a received item * Class for creating CC emails based on a received item
*/ */
class ItemCCEMail extends EMail class ItemCCEMail extends Email
{ {
public function __construct(App $a, L10n $l10n, BaseURL $baseUrl, array $item, string $toEmail, string $authorThumb) public function __construct(App $a, L10n $l10n, BaseURL $baseUrl, array $item, string $toEmail, string $authorThumb)
{ {
@ -21,7 +21,7 @@ class ItemCCEMail extends EMail
$disclaimer .= $l10n->t('You may visit them online at %s', $baseUrl . '/profile/' . $a->user['nickname']) . EOL; $disclaimer .= $l10n->t('You may visit them online at %s', $baseUrl . '/profile/' . $a->user['nickname']) . EOL;
$disclaimer .= $l10n->t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL; $disclaimer .= $l10n->t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
if (!$item['title'] == '') { if (!$item['title'] == '') {
$subject = EMail::encodeHeader($item['title'], 'UTF-8'); $subject = Email::encodeHeader($item['title'], 'UTF-8');
} else { } else {
$subject = Email::encodeHeader('[Friendica]' . ' ' . $l10n->t('%s posted an update.', $a->user['username']), 'UTF-8'); $subject = Email::encodeHeader('[Friendica]' . ' ' . $l10n->t('%s posted an update.', $a->user['username']), 'UTF-8');
} }

View File

@ -7,19 +7,19 @@ use Friendica\Object\EMail\IEmail;
/** /**
* The default implementation of the IEmail interface * The default implementation of the IEmail interface
* *
* Provides the possibility to reuse the email instance with new recipients (@see EMail::withRecipient()) * Provides the possibility to reuse the email instance with new recipients (@see Email::withRecipient())
*/ */
class EMail implements IEmail class Email implements IEmail
{ {
/** @var string */ /** @var string */
private $fromName; private $fromName;
/** @var string */ /** @var string */
private $fromEmail; private $fromAddress;
/** @var string */ /** @var string */
private $replyTo; private $replyTo;
/** @var string */ /** @var string */
private $toEmail; private $toAddress;
/** @var string */ /** @var string */
private $subject; private $subject;
@ -38,9 +38,9 @@ class EMail implements IEmail
string $additionalMailHeader = '', int $toUid = null) string $additionalMailHeader = '', int $toUid = null)
{ {
$this->fromName = $fromName; $this->fromName = $fromName;
$this->fromEmail = $fromEmail; $this->fromAddress = $fromEmail;
$this->replyTo = $replyTo; $this->replyTo = $replyTo;
$this->toEmail = $toEmail; $this->toAddress = $toEmail;
$this->subject = $subject; $this->subject = $subject;
$this->msgHtml = $msgHtml; $this->msgHtml = $msgHtml;
$this->msgText = $msgText; $this->msgText = $msgText;
@ -59,9 +59,9 @@ class EMail implements IEmail
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getFromEmail() public function getFromAddress()
{ {
return $this->fromEmail; return $this->fromAddress;
} }
/** /**
@ -75,9 +75,9 @@ class EMail implements IEmail
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getToEmail() public function getToAddress()
{ {
return $this->toEmail; return $this->toAddress;
} }
/** /**
@ -126,9 +126,9 @@ class EMail implements IEmail
*/ */
public function withRecipient(string $email, int $uid = null) public function withRecipient(string $email, int $uid = null)
{ {
$newEmail = clone $this; $newEmail = clone $this;
$newEmail->toEmail = $email; $newEmail->toAddress = $email;
$newEmail->toUid = $uid; $newEmail->toUid = $uid;
return $newEmail; return $newEmail;
} }

View File

@ -59,7 +59,7 @@ class Emailer
} }
$fromName = Email::encodeHeader(html_entity_decode($email->getFromName(), ENT_QUOTES, 'UTF-8'), 'UTF-8'); $fromName = Email::encodeHeader(html_entity_decode($email->getFromName(), ENT_QUOTES, 'UTF-8'), 'UTF-8');
$fromEmail = $email->getFromEmail(); $fromEmail = $email->getFromAddress();
$replyTo = $email->getReplyTo(); $replyTo = $email->getReplyTo();
$messageSubject = Email::encodeHeader(html_entity_decode($email->getSubject(), ENT_QUOTES, 'UTF-8'), 'UTF-8'); $messageSubject = Email::encodeHeader(html_entity_decode($email->getSubject(), ENT_QUOTES, 'UTF-8'), 'UTF-8');
@ -102,7 +102,7 @@ class Emailer
// send the message // send the message
$hookdata = [ $hookdata = [
'to' => $email->getToEmail(), 'to' => $email->getToAddress(),
'subject' => $messageSubject, 'subject' => $messageSubject,
'body' => $multipartMessageBody, 'body' => $multipartMessageBody,
'headers' => $messageHeader, 'headers' => $messageHeader,
@ -123,7 +123,7 @@ class Emailer
$hookdata['headers'], $hookdata['headers'],
$hookdata['parameters'] $hookdata['parameters']
); );
$this->logger->debug('header ' . 'To: ' . $email->getToEmail() . '\n' . $messageHeader); $this->logger->debug('header ' . 'To: ' . $email->getToAddress() . '\n' . $messageHeader);
$this->logger->debug('return value ' . (($res) ? 'true' : 'false')); $this->logger->debug('return value ' . (($res) ? 'true' : 'false'));
return $res; return $res;
} }