summaryrefslogtreecommitdiff
path: root/bouncer/richtext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bouncer/richtext.cpp')
-rw-r--r--bouncer/richtext.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/bouncer/richtext.cpp b/bouncer/richtext.cpp
index 22c6330..2deebda 100644
--- a/bouncer/richtext.cpp
+++ b/bouncer/richtext.cpp
@@ -174,3 +174,20 @@ const char *RichTextBuilder::c_str() {
return data();
}
+
+
+
+void RichTextBuilder::appendNick(const char *nick) {
+ uint32_t hash = 0;
+ const char *c = nick;
+ while (*c)
+ hash = (hash * 17) + *(c++);
+
+ int r = ((hash & 0xFF0000) >> 16);
+ int g = ((hash & 0xFF00) >> 8);
+ int b = (hash & 0xFF);
+
+ foreground(COL_LEVEL_NICK, r, g, b);
+ append(nick);
+ endForeground(COL_LEVEL_NICK);
+}