ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW => 'support_follow',
ArrayFilterEvent::PROTOCOL_SUPPORTS_REVOKE_FOLLOW => 'support_revoke_follow',
ArrayFilterEvent::PROTOCOL_SUPPORTS_PROBE => 'support_probe',
- ArrayFilterEvent::UNFOLLOW => 'unfollow',
+ ArrayFilterEvent::FOLLOW_CONTACT => 'follow',
+ ArrayFilterEvent::UNFOLLOW_CONTACT => 'unfollow',
+ ArrayFilterEvent::REVOKE_FOLLOW_CONTACT => 'revoke_follow',
+ ArrayFilterEvent::BLOCK_CONTACT => 'block',
+ ArrayFilterEvent::UNBLOCK_CONTACT => 'unblock',
HtmlFilterEvent::HEAD => 'head',
HtmlFilterEvent::FOOTER => 'footer',
HtmlFilterEvent::PAGE_HEADER => 'page_header',
ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW => 'onArrayFilterEvent',
ArrayFilterEvent::PROTOCOL_SUPPORTS_REVOKE_FOLLOW => 'onArrayFilterEvent',
ArrayFilterEvent::PROTOCOL_SUPPORTS_PROBE => 'onArrayFilterEvent',
- ArrayFilterEvent::UNFOLLOW => 'onArrayFilterEvent',
+ ArrayFilterEvent::FOLLOW_CONTACT => 'onArrayFilterEvent',
+ ArrayFilterEvent::UNFOLLOW_CONTACT => 'onArrayFilterEvent',
+ ArrayFilterEvent::REVOKE_FOLLOW_CONTACT => 'onArrayFilterEvent',
+ ArrayFilterEvent::BLOCK_CONTACT => 'onArrayFilterEvent',
+ ArrayFilterEvent::UNBLOCK_CONTACT => 'onArrayFilterEvent',
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
HtmlFilterEvent::PAGE_HEADER => 'onHtmlFilterEvent',
$eventDispatcher = DI::eventDispatcher();
$hook_data = $eventDispatcher->dispatch(
- new ArrayFilterEvent(ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW, $hook_data),
+ new ArrayFilterEvent(ArrayFilterEvent::UNFOLLOW_CONTACT, $hook_data),
)->getArray();
return $hook_data['result'];
'uid' => $owner['uid'],
'result' => null,
];
- Hook::callAll('revoke_follow', $hook_data);
+
+ $eventDispatcher = DI::eventDispatcher();
+
+ $hook_data = $eventDispatcher->dispatch(
+ new ArrayFilterEvent(ArrayFilterEvent::REVOKE_FOLLOW_CONTACT, $hook_data),
+ )->getArray();
return $hook_data['result'];
}
'uid' => $uid,
'result' => null,
];
- Hook::callAll('block', $hook_data);
+
+ $eventDispatcher = DI::eventDispatcher();
+
+ $hook_data = $eventDispatcher->dispatch(
+ new ArrayFilterEvent(ArrayFilterEvent::BLOCK_CONTACT, $hook_data),
+ )->getArray();
return $hook_data['result'];
}
'uid' => $uid,
'result' => null,
];
- Hook::callAll('unblock', $hook_data);
+
+ $eventDispatcher = DI::eventDispatcher();
+
+ $hook_data = $eventDispatcher->dispatch(
+ new ArrayFilterEvent(ArrayFilterEvent::UNBLOCK_CONTACT, $hook_data),
+ )->getArray();
return $hook_data['result'];
}
public const PROTOCOL_SUPPORTS_PROBE = 'friendica.data.protocol_supports_probe';
- public const UNFOLLOW = 'friendica.data.unfollow';
+ public const FOLLOW_CONTACT = 'friendica.data.follow_contact';
+
+ public const UNFOLLOW_CONTACT = 'friendica.data.unfollow_contact';
+
+ public const REVOKE_FOLLOW_CONTACT = 'friendica.data.revoke_follow_contact';
+
+ public const BLOCK_CONTACT = 'friendica.data.block_contact';
+
+ public const UNBLOCK_CONTACT = 'friendica.data.unblock_contact';
private array $array;
use Friendica\Database\Database;
use Friendica\Database\DBA;
use Friendica\DI;
+use Friendica\Event\ArrayFilterEvent;
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
use Friendica\Network\HTTPException\NotFoundException;
$arr = ['url' => $url, 'uid' => $uid, 'contact' => []];
- Hook::callAll('follow', $arr);
+ $eventDispatcher = DI::eventDispatcher();
+
+ $arr = $eventDispatcher->dispatch(
+ new ArrayFilterEvent(ArrayFilterEvent::FOLLOW_CONTACT, $arr),
+ )->getArray();
if (empty($arr)) {
$result['message'] = DI::l10n()->t('The contact could not be added. Please check the relevant network credentials in your Settings -> Social Networks page.');
ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW => 'onArrayFilterEvent',
ArrayFilterEvent::PROTOCOL_SUPPORTS_REVOKE_FOLLOW => 'onArrayFilterEvent',
ArrayFilterEvent::PROTOCOL_SUPPORTS_PROBE => 'onArrayFilterEvent',
- ArrayFilterEvent::UNFOLLOW => 'onArrayFilterEvent',
+ ArrayFilterEvent::FOLLOW_CONTACT => 'onArrayFilterEvent',
+ ArrayFilterEvent::UNFOLLOW_CONTACT => 'onArrayFilterEvent',
+ ArrayFilterEvent::REVOKE_FOLLOW_CONTACT => 'onArrayFilterEvent',
+ ArrayFilterEvent::BLOCK_CONTACT => 'onArrayFilterEvent',
+ ArrayFilterEvent::UNBLOCK_CONTACT => 'onArrayFilterEvent',
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
HtmlFilterEvent::PAGE_HEADER => 'onHtmlFilterEvent',
[ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW, 'support_follow'],
[ArrayFilterEvent::PROTOCOL_SUPPORTS_REVOKE_FOLLOW, 'support_revoke_follow'],
[ArrayFilterEvent::PROTOCOL_SUPPORTS_PROBE, 'support_probe'],
- [ArrayFilterEvent::UNFOLLOW, 'unfollow'],
+ [ArrayFilterEvent::FOLLOW_CONTACT, 'follow'],
+ [ArrayFilterEvent::UNFOLLOW_CONTACT, 'unfollow'],
+ [ArrayFilterEvent::REVOKE_FOLLOW_CONTACT, 'revoke_follow'],
+ [ArrayFilterEvent::BLOCK_CONTACT, 'block'],
+ [ArrayFilterEvent::UNBLOCK_CONTACT, 'unblock'],
];
}
[ArrayFilterEvent::PROTOCOL_SUPPORTS_FOLLOW, 'friendica.data.protocol_supports_follow'],
[ArrayFilterEvent::PROTOCOL_SUPPORTS_REVOKE_FOLLOW, 'friendica.data.protocol_supports_revoke_follow'],
[ArrayFilterEvent::PROTOCOL_SUPPORTS_PROBE, 'friendica.data.protocol_supports_probe'],
+ [ArrayFilterEvent::FOLLOW_CONTACT, 'friendica.data.follow_contact'],
+ [ArrayFilterEvent::UNFOLLOW_CONTACT, 'friendica.data.unfollow_contact'],
+ [ArrayFilterEvent::REVOKE_FOLLOW_CONTACT, 'friendica.data.revoke_follow_contact'],
+ [ArrayFilterEvent::BLOCK_CONTACT, 'friendica.data.block_contact'],
+ [ArrayFilterEvent::UNBLOCK_CONTACT, 'friendica.data.unblock_contact'],
];
}