Changeset 6353

Show
Ignore:
Timestamp:
05/24/06 18:15:49 (3 years ago)
Author:
jim++
Message:

Do not highlight in gc in case we are sure our nick is beginning of a real word (nick after = A->Z or a->z)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/groupchat_control.py

    r6351 r6353  
    662662                        for special_word in special_words: 
    663663                                if word.startswith(special_word): 
    664                                         return True 
     664                                        # get char after the word that highlight us 
     665                                        char_position = len(special_word) 
     666                                        refer_to_nick_char = \ 
     667                                                word[char_position:char_position+1] 
     668                                        if (refer_to_nick_char != ''): 
     669                                                refer_to_nick_char_code = ord(refer_to_nick_char) 
     670                                                if ((refer_to_nick_char_code < 65 or refer_to_nick_char_code > 123)\ 
     671                                                        or (refer_to_nick_char_code < 97 and refer_to_nick_char_code > 90)): 
     672                                                        return True 
     673                                                else:  
     674                                                        # This is A->Z or a->z, we can be sure our nick is the beginning 
     675                                                        # of a real word, do not highlight. Note that we can probably  
     676                                                        # do a better detection of non-punctuation characters 
     677                                                        return False 
     678                                        else: # Special word == word, no char after in word 
     679                                                return True  
    665680                return False 
    666681