Community-id: load main script in notice script, fix notice script

This change makes the community-id script that adds the community id to
notice.log automatically load the main script if this was not already
loaded.

In the past, the script just did not perform any action if the main
script was not loaded.

This change also makes the notice script respect the seed/base64
settings that were set in the main script.

Fixes GH-3242
This commit is contained in:
Johanna Amann 2023-08-22 14:51:14 +01:00
parent e8292be0ce
commit 4156c4764a
3 changed files with 6 additions and 9 deletions

View file

@ -1,11 +1,9 @@
# Source this script in addition to protocols/conn/community-id
# to add Community ID to notices.
# Source this script to add Community ID to notices.
# This script will automatically load the main community-id script.
# Only support loading this if the main script is also loaded.
@load base/protocols/conn
@load base/frameworks/notice
@ifdef ( CommunityID::seed )
@load policy/protocols/conn/community-id-logging
module CommunityID::Notice;
@ -23,6 +21,5 @@ export {
hook Notice::notice(n: Notice::Info)
{
if ( CommunityID::Notice::enabled && n?$conn )
n$community_id = community_id_v1(n$conn$id);
n$community_id = community_id_v1(n$conn$id, CommunityID::seed, CommunityID::do_base64);
}
@endif