feat: implement global autoresponder plugin

This commit is contained in:
Marek Miklewicz
2026-06-02 19:19:00 +02:00
commit 6f989af278
62 changed files with 2018 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
require_once PLUGIN_ROOT . '/exec/lib/RepeatState.php';
test('repeat state allows first reply and blocks repeated reply until ttl', function (): void {
$state = new RepeatState(TEST_TMP . '/state', 1000);
assert_true($state->shouldSend('alice', 'rule', 'info@example.com', 'sender@example.com', 60));
$state->record('alice', 'rule', 'info@example.com', 'sender@example.com');
assert_false($state->shouldSend('alice', 'rule', 'info@example.com', 'sender@example.com', 60));
$later = new RepeatState(TEST_TMP . '/state', 5000);
assert_true($later->shouldSend('alice', 'rule', 'info@example.com', 'sender@example.com', 60));
});