diff --git a/doc/Addons.md b/doc/Addons.md index 69b591a820..fb9956089d 100644 --- a/doc/Addons.md +++ b/doc/Addons.md @@ -777,6 +777,11 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep- Hook::callAll('atom_feed_end', $atom); Hook::callAll('atom_feed_end', $atom); +### src/Protocol/Email.php + + Hook::callAll('email_getmessage', $message); + Hook::callAll('email_getmessage_end', $ret); + ### view/js/main.js document.dispatchEvent(new Event('postprocess_liveupdate')); diff --git a/doc/de/Addons.md b/doc/de/Addons.md index 755db95d01..b5dd07cca2 100644 --- a/doc/de/Addons.md +++ b/doc/de/Addons.md @@ -495,3 +495,8 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap Hook::callAll('atom_feed_end', $atom); Hook::callAll('atom_feed_end', $atom); + +### src/Protocol/Email.php + + Hook::callAll('email_getmessage', $message); + Hook::callAll('email_getmessage_end', $ret); diff --git a/src/Protocol/Email.php b/src/Protocol/Email.php index 06cf861250..3df39af007 100644 --- a/src/Protocol/Email.php +++ b/src/Protocol/Email.php @@ -4,6 +4,7 @@ */ namespace Friendica\Protocol; +use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Content\Text\HTML; use Friendica\Model\Item; @@ -126,6 +127,10 @@ class Email if (trim($ret['body']) == '') { $ret['body'] = self::messageGetPart($mbox, $uid, $struc, 0, 'plain'); } else { + $message = ['text' => '', 'html' => $ret['body']]; + Hook::callAll('email_getmessage', $message); + $ret['body'] = $message['html']; + $ret['body'] = HTML::toBBCode($ret['body']); } } else { @@ -142,7 +147,13 @@ class Email $html .= $x; } } - if (trim($html) != '') { + + $message = ['text' => trim($text), 'html' => trim($html)]; + Hook::callAll('email_getmessage', $message); + $html = $message['html']; + $text = $message['text']; + + if (!empty($html)) { $ret['body'] = HTML::toBBCode($html); } else { $ret['body'] = $text; @@ -160,12 +171,14 @@ class Email $ret['body'] = self::unifyAttributionLine($ret['body']); + Hook::callAll('email_getmessage_end', $ret); + return $ret; } - // At the moment - only return plain/text. - // Later we'll repackage inline images as data url's and make the HTML safe /** + * fetch the specified message part number with the specified subtype + * * @param resource $mbox mailbox * @param integer $uid user id * @param object $p parts