aboutsummaryrefslogtreecommitdiff
path: root/modules/sed.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-08-13 13:48:03 +0100
committerGravatar jesopo2019-08-13 13:48:03 +0100
commit03c7e8f0665c1036ece49155340697aa3b2d107d (patch)
tree55cb3283e4c27389b2b0a75107feef5be66243c9 /modules/sed.py
parent"!yt" without args should get .message from BufferLine (diff)
signature
return matching string from buffer.find() as most uses were redundantly regexing
Diffstat (limited to 'modules/sed.py')
-rw-r--r--modules/sed.py13
1 files changed, 7 insertions, 6 deletions
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))