forked from friendica/friendica-addons
some more robust mailstream stuff
This commit is contained in:
parent
2728f8a839
commit
a30d850ff1
|
@ -118,9 +118,28 @@ function mailstream_send_hook(array $data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($item['deleted']) {
|
||||||
|
Logger::debug('mailstream_send_hook skipping deleted item', ['guid' => $item['guid']]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$user = User::getById($item['uid']);
|
$user = User::getById($item['uid']);
|
||||||
if (empty($user)) {
|
if (empty($user)) {
|
||||||
Logger::error('mailstream_send_hook could not fund user', ['uid' => $item['uid']]);
|
Logger::error('mailstream_send_hook could not find user', ['uid' => $item['uid']]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$contact = DBA::selectFirst('contact', [], ['id' => $item['contact-id'], 'self' => false]);
|
||||||
|
if (!DBA::isResult($contact)) {
|
||||||
|
Logger::error('mailstream_send_hook could not find contact', ['guid' => $item['guid'], 'contact-id' => $item['contact-id']]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($contact['blocked']) {
|
||||||
|
Logger::error('mailstream_send_hook contact is blocked', ['guid' => $item['guid'], 'contact-id' => $item['contact-id']]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (array_key_exists('ignored', $contact) && $contact['ignored']) {
|
||||||
|
Logger::error('mailstream_send_hook contact is ignored', ['guid' => $item['guid'], 'contact-id' => $item['contact-id']]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +162,6 @@ function mailstream_send_hook(array $data)
|
||||||
function mailstream_post_hook(array &$item)
|
function mailstream_post_hook(array &$item)
|
||||||
{
|
{
|
||||||
mailstream_check_version();
|
mailstream_check_version();
|
||||||
Logger::debug('@@@ mailstream_post_hook', ['item-uid' => $item['uid']]);
|
|
||||||
|
|
||||||
if (!DI::pConfig()->get($item['uid'], 'mailstream', 'enabled')) {
|
if (!DI::pConfig()->get($item['uid'], 'mailstream', 'enabled')) {
|
||||||
Logger::debug('mailstream: not enabled for item ' . $item['id'] . ' uid ' . $item['uid']);
|
Logger::debug('mailstream: not enabled for item ' . $item['id'] . ' uid ' . $item['uid']);
|
||||||
|
|
Loading…
Reference in a new issue