21
21
#
22
22
#
23
23
# History:
24
+ # 2022-07-11: ncfavier
25
+ # version 29: check nick for exclusion *after* stripping
26
+ # decrease minimum min_nick_length to 1
24
27
# 2020-11-29: jess
25
28
# version 28: fix ignore_tags having been broken by weechat 2.9 changes
26
29
# 2020-05-09: Sébastien Helleu <[email protected] >
90
93
91
94
SCRIPT_NAME = "colorize_nicks"
92
95
SCRIPT_AUTHOR = "xt <[email protected] >"
93
- SCRIPT_VERSION = "28 "
96
+ SCRIPT_VERSION = "29 "
94
97
SCRIPT_LICENSE = "GPL"
95
98
SCRIPT_DESC = "Use the weechat nick colors in the chat area"
96
99
@@ -138,7 +141,7 @@ def colorize_config_init():
138
141
colorize_config_option ["min_nick_length" ] = weechat .config_new_option (
139
142
colorize_config_file , section_look , "min_nick_length" ,
140
143
"integer" , "Minimum length nick to colorize" , "" ,
141
- 2 , 20 , "" , "" , 0 , "" , "" , "" , "" , "" , "" )
144
+ 1 , 20 , "2 " , "2 " , 0 , "" , "" , "" , "" , "" , "" )
142
145
colorize_config_option ["colorize_input" ] = weechat .config_new_option (
143
146
colorize_config_file , section_look , "colorize_input" ,
144
147
"boolean" , "Whether to colorize input" , "" , 0 ,
@@ -170,7 +173,7 @@ def colorize_nick_color(nick, my_nick):
170
173
if nick == my_nick :
171
174
return w .color (w .config_string (w .config_get ('weechat.color.chat_nick_self' )))
172
175
else :
173
- return w .info_get ('irc_nick_color ' , nick )
176
+ return w .info_get ('nick_color ' , nick )
174
177
175
178
def colorize_cb (data , modifier , modifier_data , line ):
176
179
''' Callback that does the colorizing, and returns new line if changed '''
@@ -206,9 +209,6 @@ def colorize_cb(data, modifier, modifier_data, line):
206
209
207
210
for words in valid_nick_re .findall (line ):
208
211
nick = words [1 ]
209
- # Check that nick is not ignored and longer than minimum length
210
- if len (nick ) < min_length or nick in ignore_nicks :
211
- continue
212
212
213
213
# If the matched word is not a known nick, we try to match the
214
214
# word without its first or last character (if not a letter).
@@ -225,6 +225,10 @@ def colorize_cb(data, modifier, modifier_data, line):
225
225
if nick [:- 1 ] in colored_nicks [buffer ]:
226
226
nick = nick [:- 1 ]
227
227
228
+ # Check that nick is not ignored and longer than minimum length
229
+ if len (nick ) < min_length or nick in ignore_nicks :
230
+ continue
231
+
228
232
# Check that nick is in the dictionary colored_nicks
229
233
if nick in colored_nicks [buffer ]:
230
234
nick_color = colored_nicks [buffer ][nick ]
0 commit comments