mirror of
https://github.com/friendica/friendica
synced 2025-04-27 21:50:11 +00:00
E-Mail import: The item is now provided to the hook
This commit is contained in:
parent
17c934aa07
commit
e220698ea1
2 changed files with 27 additions and 17 deletions
|
@ -6,8 +6,10 @@ namespace Friendica\Protocol;
|
|||
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
/**
|
||||
* @brief Email class
|
||||
|
@ -110,9 +112,9 @@ class Email
|
|||
* @return array
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function getMessage($mbox, $uid, $reply)
|
||||
public static function getMessage($mbox, $uid, $reply, $item)
|
||||
{
|
||||
$ret = [];
|
||||
$ret = $item;
|
||||
|
||||
$struc = (($mbox && $uid) ? @imap_fetchstructure($mbox, $uid, FT_UID) : null);
|
||||
|
||||
|
@ -126,9 +128,13 @@ class Email
|
|||
|
||||
if (trim($ret['body']) == '') {
|
||||
$ret['body'] = self::messageGetPart($mbox, $uid, $struc, 0, 'plain');
|
||||
|
||||
$message = ['text' => $ret['body'], 'html' => ''];
|
||||
Hook::callAll('email_getmessage', $message, $ret);
|
||||
$ret['body'] = $message['text'];
|
||||
} else {
|
||||
$message = ['text' => '', 'html' => $ret['body']];
|
||||
Hook::callAll('email_getmessage', $message);
|
||||
Hook::callAll('email_getmessage', $message, $ret);
|
||||
$ret['body'] = $message['html'];
|
||||
|
||||
$ret['body'] = HTML::toBBCode($ret['body']);
|
||||
|
@ -149,7 +155,7 @@ class Email
|
|||
}
|
||||
|
||||
$message = ['text' => trim($text), 'html' => trim($html)];
|
||||
Hook::callAll('email_getmessage', $message);
|
||||
Hook::callAll('email_getmessage', $message, $ret);
|
||||
$html = $message['html'];
|
||||
$text = $message['text'];
|
||||
|
||||
|
@ -171,6 +177,9 @@ class Email
|
|||
|
||||
$ret['body'] = self::unifyAttributionLine($ret['body']);
|
||||
|
||||
$ret['body'] = Strings::escapeHtml($ret['body']);
|
||||
$ret['body'] = BBCode::limitBodySize($ret['body']);
|
||||
|
||||
Hook::callAll('email_getmessage_end', $ret);
|
||||
|
||||
return $ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue