aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar jesopo2019-11-19 14:45:47 +0000
committerGravatar jesopo2019-11-19 14:45:47 +0000
commitbd176240d6f6d19b2518b9d371742819e0a39902 (patch)
treec89951e09abb32791a3357623848bfaba2ebfe31 /src/utils
parentHASH_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.py5
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