use irc_lower for preventing highlights, only lower() when needed
This commit is contained in:
parent
0625102fa7
commit
9aeee86165
1 changed files with 5 additions and 3 deletions
|
@ -421,14 +421,16 @@ class Module(ModuleManager.BaseModule):
|
||||||
|
|
||||||
def _prevent_highlight(self, channel, s):
|
def _prevent_highlight(self, channel, s):
|
||||||
for user in channel.users:
|
for user in channel.users:
|
||||||
while user.nickname.lower() in s.lower():
|
s_lower = event["server"].irc_lower(s)
|
||||||
index = s.lower().index(user.nickname.lower())
|
while user.nickname_lower in s_lower:
|
||||||
length = len(user.nickname.lower())
|
index = s_lower.index(user.nickname_lower)
|
||||||
|
length = len(user.nickname_lower)
|
||||||
|
|
||||||
original = s[index:index+length]
|
original = s[index:index+length]
|
||||||
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)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def _short_url(self, url):
|
def _short_url(self, url):
|
||||||
|
|
Loading…
Reference in a new issue