diff options
| author | 2019-11-19 14:45:47 +0000 | |
|---|---|---|
| committer | 2019-11-19 14:45:47 +0000 | |
| commit | bd176240d6f6d19b2518b9d371742819e0a39902 (patch) | |
| tree | c89951e09abb32791a3357623848bfaba2ebfe31 /src/utils | |
| parent | HASH_STOP should still be respected if last character (diff) | |
| signature | ||
consecutive HASH_STOP chars at start shouldn't count as a stop
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/irc.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/utils/irc.py b/src/utils/irc.py index 55a12df6..cdaa61eb 100644 --- a/src/utils/irc.py +++ b/src/utils/irc.py @@ -46,8 +46,11 @@ HASH_COLORS = [consts.CYAN, consts.PURPLE, consts.GREEN, consts.ORANGE, consts.LIGHTGREEN, consts.BLUE] def hash_colorize(s: str): hash = 5381 + non_stop = False for i, char in enumerate(s): - if char in HASH_STOP and i > 0: + if not char in HASH_STOP: + non_stop = True + elif non_stop: break hash ^= ((hash<<5)+(hash>>2)+ord(char))&0xFFFFFFFFFFFFFFFF |
