mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Simplify the logic a big by making Notice$email_dest have a default rather than be optional
This commit is contained in:
parent
bfb26b9227
commit
9d0bd96e1f
21 changed files with 40 additions and 56 deletions
|
@ -35,11 +35,6 @@ hook notice(n: Notice::Info)
|
|||
}
|
||||
|
||||
if ( email != "" )
|
||||
{
|
||||
if ( ! n?$email_dest )
|
||||
n$email_dest = set();
|
||||
|
||||
add n$email_dest[email];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,5 @@ export {
|
|||
hook notice(n: Notice::Info)
|
||||
{
|
||||
if ( ACTION_PAGE in n$actions )
|
||||
{
|
||||
if ( ! n?$email_dest )
|
||||
n$email_dest = set();
|
||||
|
||||
add n$email_dest[mail_page_dest];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ export {
|
|||
actions: ActionSet &log &default=ActionSet();
|
||||
|
||||
## The email address(es) where to send this notice
|
||||
email_dest: set[string] &log &optional;
|
||||
email_dest: set[string] &log &default=set();
|
||||
|
||||
## By adding chunks of text into this element, other scripts
|
||||
## can expand on notices that are being emailed. The normal
|
||||
|
@ -516,19 +516,13 @@ hook Notice::policy(n: Notice::Info) &priority=10
|
|||
hook Notice::notice(n: Notice::Info)
|
||||
{
|
||||
if ( ACTION_EMAIL in n$actions )
|
||||
{
|
||||
if ( ! n?$email_dest )
|
||||
n$email_dest = set();
|
||||
|
||||
add n$email_dest[mail_dest];
|
||||
}
|
||||
}
|
||||
|
||||
hook Notice::notice(n: Notice::Info) &priority=-5
|
||||
{
|
||||
if ( n?$email_dest )
|
||||
for ( dest in n$email_dest )
|
||||
email_notice_to(n, dest, T);
|
||||
for ( dest in n$email_dest )
|
||||
email_notice_to(n, dest, T);
|
||||
|
||||
if ( ACTION_LOG in n$actions )
|
||||
Log::write(Notice::LOG, n);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue