mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Merge branch 'master' of github.com:wbbaddons/Tims-Chat
This commit is contained in:
commit
66af0da84c
@ -210,6 +210,20 @@ public function leave() {
|
|||||||
\wcf\system\nodePush\NodePushHandler::getInstance()->sendMessage('be.bastelstu.chat.join');
|
\wcf\system\nodePush\NodePushHandler::getInstance()->sendMessage('be.bastelstu.chat.join');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forces dead users to leave the chat.
|
||||||
|
*/
|
||||||
|
public function removeDeadUsers() {
|
||||||
|
$deadUsers = Room::getDeadUsers();
|
||||||
|
|
||||||
|
foreach ($deadUsers as $deadUser) {
|
||||||
|
$roomAction = new self(array(), 'leave', array(
|
||||||
|
'user' => $deadUser
|
||||||
|
));
|
||||||
|
$roomAction->executeAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates permissions.
|
* Validates permissions.
|
||||||
*/
|
*/
|
||||||
|
@ -65,14 +65,9 @@ public function readData() {
|
|||||||
$this->readMessages();
|
$this->readMessages();
|
||||||
$this->users = $this->room->getUsers();
|
$this->users = $this->room->getUsers();
|
||||||
|
|
||||||
$deadUsers = data\room\Room::getDeadUsers();
|
$roomAction = new data\room\RoomAction(array(), 'removeDeadUsers');
|
||||||
foreach ($deadUsers as $deadUser) {
|
|
||||||
$roomAction = new data\room\RoomAction(array(), 'leave', array(
|
|
||||||
'user' => $deadUser
|
|
||||||
));
|
|
||||||
$roomAction->executeAction();
|
$roomAction->executeAction();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the new messages
|
* Fetches the new messages
|
||||||
|
@ -24,29 +24,7 @@ public function execute(\wcf\data\cronjob\Cronjob $cronjob) {
|
|||||||
$suspensionAction->executeAction();
|
$suspensionAction->executeAction();
|
||||||
|
|
||||||
// kill dead users
|
// kill dead users
|
||||||
$deadUsers = \chat\util\ChatUtil::getDiedUsers();
|
$roomAction = new data\room\RoomAction(array(), 'removeDeadUsers');
|
||||||
foreach ($deadUsers as $deadUser) {
|
$roomAction->executeAction();
|
||||||
if (!$deadUser) continue;
|
|
||||||
|
|
||||||
$user = new \wcf\data\user\User($deadUser['userID']);
|
|
||||||
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
|
||||||
$userData['color'] = \chat\util\ChatUtil::readUserData('color', $user);
|
|
||||||
|
|
||||||
$messageAction = new data\message\MessageAction(array(), 'create', array(
|
|
||||||
'data' => array(
|
|
||||||
'roomID' => $deadUser['roomID'],
|
|
||||||
'sender' => $user->userID,
|
|
||||||
'username' => $user->username,
|
|
||||||
'time' => TIME_NOW,
|
|
||||||
'type' => data\message\Message::TYPE_LEAVE,
|
|
||||||
'message' => '',
|
|
||||||
'color1' => $userData['color'][1],
|
|
||||||
'color2' => $userData['color'][2]
|
|
||||||
)
|
|
||||||
));
|
|
||||||
$messageAction->executeAction();
|
|
||||||
}
|
|
||||||
\chat\util\ChatUtil::writeUserData(array('roomID' => null), $user);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user