# Colour nicknames found in quoted text # Author: David J. Oftedal __module_name__ = "Colournicks" __module_version__ = "1.0" __module_description__ = "Colour nicknames found in quoted text" import hexchat def colournicks(word, word_eol, userdata): # Prevent the message from going in an infinite loop if len(word) < 1 or (not "<" in word_eol[0]) or ("\00399" in word_eol[0]): return hexchat.EAT_NONE else: fields = word[1].replace('<', '\001<').replace('>', '>\001').split('\001') for i in range(len(fields)): if "<" in fields[i] and ">" in fields[i]: colour = (hash(fields[i])%28) colour += (4 if colour > 13 else 2) colour = ("00"+str(colour))[-2:] fields[i] = fields[i].replace("<", "<"+"\003"+colour).replace(">","\017"+">") hexchat.emit_print("Channel Message", word[0], "\00399"+"".join(fields), "") return hexchat.EAT_HEXCHAT hexchat.hook_print("Channel Message", colournicks, hexchat.PRI_LOWEST)