mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
SedRegex: when looking up config vars, strip statusmsg prefix from channel, and use network name for lookup.
This commit is contained in:
parent
0b0da9716d
commit
37a7029618
@ -111,7 +111,7 @@ class SedRegex(callbacks.PluginRegexp):
|
|||||||
return (pattern, replacement, count, raw_flags)
|
return (pattern, replacement, count, raw_flags)
|
||||||
|
|
||||||
def replacer(self, irc, msg, regex):
|
def replacer(self, irc, msg, regex):
|
||||||
if not self.registryValue('enable', msg.args[0]):
|
if not self.registryValue('enable', msg.channel, irc.network):
|
||||||
return
|
return
|
||||||
iterable = reversed(irc.state.history)
|
iterable = reversed(irc.state.history)
|
||||||
msg.tag('Replacer')
|
msg.tag('Replacer')
|
||||||
@ -120,7 +120,7 @@ class SedRegex(callbacks.PluginRegexp):
|
|||||||
(pattern, replacement, count, flags) = self._unpack_sed(msg.args[1])
|
(pattern, replacement, count, flags) = self._unpack_sed(msg.args[1])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.warning(_("SedRegex error: %s"), e, exc_info=True)
|
self.log.warning(_("SedRegex error: %s"), e, exc_info=True)
|
||||||
if self.registryValue('displayErrors', msg.args[0]):
|
if self.registryValue('displayErrors', msg.channel, irc.network):
|
||||||
irc.error('%s.%s: %s' % (e.__class__.__module__, e.__class__.__name__, e))
|
irc.error('%s.%s: %s' % (e.__class__.__module__, e.__class__.__name__, e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ class SedRegex(callbacks.PluginRegexp):
|
|||||||
irc.error(_("Search not found in the last %i messages.") %
|
irc.error(_("Search not found in the last %i messages.") %
|
||||||
len(irc.state.history))
|
len(irc.state.history))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if self.registryValue('displayErrors', msg.args[0]):
|
if self.registryValue('displayErrors', msg.channel, irc.network):
|
||||||
irc.error('%s.%s: %s' % (e.__class__.__module__,
|
irc.error('%s.%s: %s' % (e.__class__.__module__,
|
||||||
e.__class__.__name__, e))
|
e.__class__.__name__, e))
|
||||||
else:
|
else:
|
||||||
@ -167,7 +167,7 @@ class SedRegex(callbacks.PluginRegexp):
|
|||||||
else:
|
else:
|
||||||
text = m.args[1]
|
text = m.args[1]
|
||||||
|
|
||||||
if self.registryValue('ignoreRegex', msg.args[0]) and \
|
if self.registryValue('ignoreRegex', msg.channel, irc.network) and \
|
||||||
m.tagged('Replacer'):
|
m.tagged('Replacer'):
|
||||||
continue
|
continue
|
||||||
if m.nick == msg.nick:
|
if m.nick == msg.nick:
|
||||||
@ -178,7 +178,8 @@ class SedRegex(callbacks.PluginRegexp):
|
|||||||
try:
|
try:
|
||||||
replace_result = pattern.search(text)
|
replace_result = pattern.search(text)
|
||||||
if replace_result:
|
if replace_result:
|
||||||
if self.registryValue('boldReplacementText', msg.args[0]):
|
if self.registryValue('boldReplacementText',
|
||||||
|
msg.channel, irc.network):
|
||||||
replacement = ircutils.bold(replacement)
|
replacement = ircutils.bold(replacement)
|
||||||
subst = pattern.sub(replacement, text, count)
|
subst = pattern.sub(replacement, text, count)
|
||||||
if action: # If the message was an ACTION, prepend the nick back.
|
if action: # If the message was an ACTION, prepend the nick back.
|
||||||
|
Loading…
Reference in New Issue
Block a user