| 1 |
local test_map = rspamd_config:add_map ({ |
| 2 |
url = '${MAP_FILE}', |
| 3 |
type = 'set', |
| 4 |
}) |
| 5 |
|
| 6 |
rspamd_config:register_symbol({ |
| 7 |
name = 'MAP_SET_HIT_AND_MISS', |
| 8 |
score = 1.0, |
| 9 |
callback = function() |
| 10 |
local has_example = test_map:get_key('example.com') |
| 11 |
local has_rspamdtest = test_map:get_key('rspamd-test.com') |
| 12 |
if has_example and not has_rspamdtest then |
| 13 |
return true, 'example.com' |
| 14 |
elseif has_rspamdtest and not has_example then |
| 15 |
return true, 'rspamd.com' |
| 16 |
else |
| 17 |
return true, string.format('invalid: has_example=%s, has_rspamdtest=%s', has_example, has_rspamdtest) |
| 18 |
end |
| 19 |
end |
| 20 |
}) |