Added hooks for the email fetch process
This commit is contained in:
parent
ae862c7b55
commit
a6ae6a83b8
3 changed files with 26 additions and 3 deletions
|
@ -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'));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue