From 03c7e8f0665c1036ece49155340697aa3b2d107d Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 13 Aug 2019 13:48:03 +0100 Subject: return matching string from buffer.find() as most uses were redundantly regexing --- modules/sed.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'modules/sed.py') diff --git a/modules/sed.py b/modules/sed.py index 0716d04d..c54c56fd 100644 --- a/modules/sed.py +++ b/modules/sed.py @@ -54,12 +54,13 @@ class Module(ModuleManager.BaseModule): for_user = event["user"].nickname if self._closest_setting(event, "sed-sender-only", False) else None - line = event["target"].buffer.find(pattern, from_self=False, + match = event["target"].buffer.find(pattern, from_self=False, for_user=for_user, not_pattern=REGEX_SED) - if line: - new_message = re.sub(pattern, replace, line.message, count) - if line.action: - prefix = "* %s" % line.sender + if match: + new_message = re.sub(pattern, replace, match.line.message, + count) + if match.line.action: + prefix = "* %s" % match.line.sender else: - prefix = "<%s>" % line.sender + prefix = "<%s>" % match.line.sender event["stdout"].write("%s %s" % (prefix, new_message)) -- cgit v1.3.1-10-gc9f91