Pass server object in to _prevent_highlight
This commit is contained in:
parent
9aeee86165
commit
e09529260a
1 changed files with 5 additions and 4 deletions
|
@ -410,7 +410,8 @@ class Module(ModuleManager.BaseModule):
|
||||||
utils.irc.color(source, COLOR_REPO), output)
|
utils.irc.color(source, COLOR_REPO), output)
|
||||||
|
|
||||||
if channel.get_setting("github-prevent-highlight", False):
|
if channel.get_setting("github-prevent-highlight", False):
|
||||||
output = self._prevent_highlight(channel, output)
|
output = self._prevent_highlight(server, channel,
|
||||||
|
output)
|
||||||
|
|
||||||
self.events.on("send.stdout").call(target=channel,
|
self.events.on("send.stdout").call(target=channel,
|
||||||
module_name="Github", server=server, message=output,
|
module_name="Github", server=server, message=output,
|
||||||
|
@ -419,9 +420,9 @@ class Module(ModuleManager.BaseModule):
|
||||||
|
|
||||||
return {"state": "success", "deliveries": len(targets)}
|
return {"state": "success", "deliveries": len(targets)}
|
||||||
|
|
||||||
def _prevent_highlight(self, channel, s):
|
def _prevent_highlight(self, server, channel, s):
|
||||||
for user in channel.users:
|
for user in channel.users:
|
||||||
s_lower = event["server"].irc_lower(s)
|
s_lower = server.irc_lower(s)
|
||||||
while user.nickname_lower in s_lower:
|
while user.nickname_lower in s_lower:
|
||||||
index = s_lower.index(user.nickname_lower)
|
index = s_lower.index(user.nickname_lower)
|
||||||
length = len(user.nickname_lower)
|
length = len(user.nickname_lower)
|
||||||
|
@ -430,7 +431,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
original = utils.prevent_highlight(original)
|
original = utils.prevent_highlight(original)
|
||||||
|
|
||||||
s = s[:index] + original + s[index+length:]
|
s = s[:index] + original + s[index+length:]
|
||||||
s_lower = event["server"].irc_lower(s)
|
s_lower = server.irc_lower(s)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def _short_url(self, url):
|
def _short_url(self, url):
|
||||||
|
|
Loading…
Reference in a new issue