From 4357ccf3422d2cb52d051db8c4a51904e4397d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 16 Feb 2012 18:21:33 +0100 Subject: [PATCH] Default color ist generated randomly now --- file/lib/util/ChatUtil.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/file/lib/util/ChatUtil.class.php b/file/lib/util/ChatUtil.class.php index 2cfde2c..c04fdd1 100644 --- a/file/lib/util/ChatUtil.class.php +++ b/file/lib/util/ChatUtil.class.php @@ -67,7 +67,7 @@ public static function readUserData($field) { if ($data[WCF::getUser()->userID] === null) { switch ($field) { case 'color': - $data[WCF::getUser()->userID] = array(1 => 0xFF0000, 2 => 0x00FF00); + $data[WCF::getUser()->userID] = array(1 => self::getRandomNumber(), 2 => self::getRandomNumber() * 0xFFFF); break; } static::writeUserData(array($field => $data[WCF::getUser()->userID])); @@ -79,6 +79,16 @@ public static function readUserData($field) { else return $data[WCF::getUser()->userID]; } + /** + * Returns a random number. + * + * @return integer + */ + public static /* int */ getRandomNumber() { + return 4; // chosen by a fair dice roll + // guaranteed to be random + } + /** * Writes user data *