I am with nick amen and someone says hamen; I do not get highlighted but as is I get * and [] and urgency hint from another place of code I cannot find. what must be done: merge that code with needs_highlight method which should be renamed to needs_visual_notification

This commit is contained in:
Nikos Kouremenos 2005-12-03 23:52:39 +00:00
parent e03f3c4870
commit a1d3a26464
1 changed files with 12 additions and 10 deletions

View File

@ -1024,26 +1024,28 @@ current room topic.') % command, room_jid)
'enabled'): 'enabled'):
sound = 'highlight' sound = 'highlight'
# Is it a history message? Don't want ping-floods when we join. # Is it a history message? Don't want sound-floods when we join.
if not tim == time.localtime(): if tim != time.localtime():
sound = None sound = None
return (highlight, sound) return (highlight, sound)
def needs_highlight(self, text, nick): def needs_highlight(self, text, nick):
'''checks text to see whether any of the words in muc_highlight_words '''checks text to see whether any of the words in (muc_highlight_words
appear''' and nick) appear'''
words = gajim.config.get('muc_highlight_words').split(';') special_words = gajim.config.get('muc_highlight_words').split(';')
words.append(nick) special_words.append(nick)
# Strip empties: ''.split(';') == [''] and would highlight everything. # Strip empties: ''.split(';') == [''] and would highlight everything.
# Also lowercase everything for case insensitive compare. # Also lowercase everything for case insensitive compare.
words = [word.lower() for word in words if word] special_words = [word.lower() for word in special_words if word]
text = text.lower() text = text.lower()
for word in words: text_splitted = text.split()
if word in text: for word in text_splitted: # get each word of the text
return True for special_word in special_words:
if word.startswith(special_word):
return True
return False return False