mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-08 01:34:31 +02:00
Create Events for protocol support hooks
This commit is contained in:
parent
f98aee686f
commit
f3a8bcff11
5 changed files with 40 additions and 3 deletions
|
@ -9,6 +9,7 @@ namespace Friendica\Core;
|
|||
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Event\ArrayFilterEvent;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
@ -76,7 +77,12 @@ class Protocol
|
|||
'protocol' => $protocol,
|
||||
'result' => null
|
||||
];
|
||||
Hook::callAll('support_follow', $hook_data);
|
||||
|
||||
$eventDispatcher = DI::eventDispatcher();
|
||||
|
||||
$hook_data = $eventDispatcher->dispatch(
|
||||
new ArrayFilterEvent(ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW, $hook_data),
|
||||
)->getArray();
|
||||
|
||||
return $hook_data['result'] === true;
|
||||
}
|
||||
|
@ -98,7 +104,12 @@ class Protocol
|
|||
'protocol' => $protocol,
|
||||
'result' => null
|
||||
];
|
||||
Hook::callAll('support_revoke_follow', $hook_data);
|
||||
|
||||
$eventDispatcher = DI::eventDispatcher();
|
||||
|
||||
$hook_data = $eventDispatcher->dispatch(
|
||||
new ArrayFilterEvent(ArrayFilterEvent::PROTOCOL_SUPPORTS_REVOKE_FOLLOW, $hook_data),
|
||||
)->getArray();
|
||||
|
||||
return $hook_data['result'] === true;
|
||||
}
|
||||
|
@ -311,7 +322,12 @@ class Protocol
|
|||
'protocol' => $protocol,
|
||||
'result' => null
|
||||
];
|
||||
Hook::callAll('support_probe', $hook_data);
|
||||
|
||||
$eventDispatcher = DI::eventDispatcher();
|
||||
|
||||
$hook_data = $eventDispatcher->dispatch(
|
||||
new ArrayFilterEvent(ArrayFilterEvent::PROTOCOL_SUPPORTS_PROBE, $hook_data),
|
||||
)->getArray();
|
||||
|
||||
return $hook_data['result'] === true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue