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'):
sound = 'highlight'
# Is it a history message? Don't want ping-floods when we join.
if not tim == time.localtime():
# Is it a history message? Don't want sound-floods when we join.
if tim != time.localtime():
sound = None
return (highlight, sound)
def needs_highlight(self, text, nick):
'''checks text to see whether any of the words in muc_highlight_words
appear'''
'''checks text to see whether any of the words in (muc_highlight_words
and nick) appear'''
words = gajim.config.get('muc_highlight_words').split(';')
words.append(nick)
special_words = gajim.config.get('muc_highlight_words').split(';')
special_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]
special_words = [word.lower() for word in special_words if word]
text = text.lower()
for word in words:
if word in text:
return True
text_splitted = text.split()
for word in text_splitted: # get each word of the text
for special_word in special_words:
if word.startswith(special_word):
return True
return False