From 56c75440451f2515169e475b3197827a4ba0b59b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 18 Apr 2012 21:01:38 +0200 Subject: [PATCH] Kill dead users. --- file/lib/page/ChatMessagePage.class.php | 25 +++++++++++++++++++++++++ package.xml | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/file/lib/page/ChatMessagePage.class.php b/file/lib/page/ChatMessagePage.class.php index 58b6ad4..8bf6805 100644 --- a/file/lib/page/ChatMessagePage.class.php +++ b/file/lib/page/ChatMessagePage.class.php @@ -30,6 +30,31 @@ public function readData() { $this->readRoom(); $this->readMessages(); $this->users = $this->room->getUsers(); + + $deadUsers = \wcf\util\ChatUtil::getDiedUsers(); + foreach ($deadUsers as $deadUser) { + if (!$deadUser) continue; + + $user = new \wcf\data\user\User($deadUser['userID']); + if (CHAT_DISPLAY_JOIN_LEAVE) { + $userData['color'] = \wcf\util\ChatUtil::readUserData('color', $user); + + $messageAction = new chat\message\ChatMessageAction(array(), 'create', array( + 'data' => array( + 'roomID' => $deadUser['roomID'], + 'sender' => $user->userID, + 'username' => $user->username, + 'time' => TIME_NOW, + 'type' => chat\message\ChatMessage::TYPE_LEAVE, + 'message' => '', + 'color1' => $userData['color'][1], + 'color2' => $userData['color'][2] + ) + )); + $messageAction->executeAction(); + } + \wcf\util\ChatUtil::writeUserData(array('roomID' => null), $user); + } } /** diff --git a/package.xml b/package.xml index 9f2edc4..3286ce7 100644 --- a/package.xml +++ b/package.xml @@ -5,7 +5,7 @@ 0 1 - 3.0.0 Alpha 11 + 3.0.0 Alpha 12 2011-11-26 com.woltlab.wcf.message