Fix groupchat highlighting again, for real now.

This commit is contained in:
shteef 2005-11-02 11:00:16 +00:00
parent 5e6766a3a4
commit 3594e582a3
1 changed files with 6 additions and 6 deletions

View File

@ -23,7 +23,6 @@ import gtk.glade
import pango import pango
import gobject import gobject
import time import time
import sre
import os import os
import dialogs import dialogs
@ -1018,15 +1017,16 @@ current room topic.') % command, room_jid)
appear''' appear'''
words = gajim.config.get('muc_highlight_words').split(';') words = gajim.config.get('muc_highlight_words').split(';')
# Strip empties. ''.split(';') == [''] and would highlight everything.
words = [word for word in words if word]
words.append(nick) words.append(nick)
# Strip empties: ''.split(';') == [''] and would highlight everything.
# Also lowercase everything for case insensitive compare.
words = [word.lower() for word in words if word]
text = text.lower()
for word in words: for word in words:
pattern = r'\b(' + sre.escape(word) + r')+\b' if word in text:
if sre.search(pattern, text, sre.IGNORECASE | sre.UNICODE):
return True return True
return False return False
def kick(self, widget, room_jid, nick): def kick(self, widget, room_jid, nick):