fix regression of message filters not matching without formatting
This commit is contained in:
parent
5df8df83ad
commit
7fdb9a1e55
2 changed files with 11 additions and 9 deletions
|
@ -31,14 +31,16 @@ class Module(ModuleManager.BaseModule):
|
|||
filters = self._get_filters(event["server"], target)
|
||||
for filter in filters:
|
||||
sed = utils.parse.sed.parse(filter)
|
||||
type, out = utils.parse.sed.sed(sed, message)
|
||||
|
||||
if type == "m" and out:
|
||||
if sed.type == "m":
|
||||
out = utils.parse.sed.sed(sed, message_plain)
|
||||
if out:
|
||||
self.log.info("Message matched filter, dropping: %s"
|
||||
% event["line"].format())
|
||||
event["line"].invalidate()
|
||||
return
|
||||
elif type == "s":
|
||||
elif sed.type == "s":
|
||||
out = utils.parse.sed.sed(sed, message)
|
||||
message = out
|
||||
|
||||
if not message == original_message:
|
||||
|
|
|
@ -76,6 +76,6 @@ def parse(sed_s: str) -> typing.Optional[Sed]:
|
|||
return SedMatch(type, re.compile(pattern, flags))
|
||||
return None
|
||||
|
||||
def sed(sed_obj: Sed, s: str) -> typing.Tuple[str, typing.Optional[str]]:
|
||||
def sed(sed_obj: Sed, s: str) -> typing.Optional[str]:
|
||||
out = sed_obj.match(s)
|
||||
return sed_obj.type, out
|
||||
return out
|
||||
|
|
Loading…
Reference in a new issue