From a1d3a26464dd3d8a9c2a30463837a6694869c151 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Sat, 3 Dec 2005 23:52:39 +0000 Subject: [PATCH] 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 --- src/groupchat_window.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/groupchat_window.py b/src/groupchat_window.py index 2073fb399..49c1aee5b 100644 --- a/src/groupchat_window.py +++ b/src/groupchat_window.py @@ -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