1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Adding ChatMessageAction

This commit is contained in:
Tim Düsterhus 2011-12-13 22:35:11 +01:00
parent 04a6570bb4
commit 510ee9645e
2 changed files with 30 additions and 11 deletions

View File

@ -0,0 +1,18 @@
<?php
namespace wcf\data\chat\message;
/**
* Executes message related actions.
*
* @author Tim Düsterhus
* @copyright 2010-2011 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat
* @subpackage data.chat.message
*/
class ChatMessageAction extends \wcf\data\AbstractDatabaseObjectAction {
/**
* @see wcf\data\AbstractDatabaseObjectAction::$className
*/
protected $className = '\wcf\data\chat\message\ChatMessageEditor';
}

View File

@ -19,7 +19,6 @@ class ChatPage extends AbstractPage {
public $chatVersion = '';
public $neededModules = array('CHAT_ACTIVE');
//public $neededPermissions = array('user.chat.canEnter');
public $joinMessage = null;
public $newestMessages = array();
public $room = null;
public $roomID = 0;
@ -35,7 +34,6 @@ public function assignVariables() {
WCF::getTPL()->assign(array(
'chatVersion' => $this->chatVersion,
'joinMessage' => $this->joinMessage,
'newestMessages' => $this->newestMessages,
'room' => $this->room,
'roomID' => $this->roomID,
@ -70,16 +68,19 @@ public function readData() {
$this->readRoom();
$this->readUserData();
if (CHAT_DISPLAY_JOIN_LEAVE) {
$this->joinMessage = chat\message\ChatMessageEditor::create(array(
'roomID' => $this->room->roomID,
'sender' => WCF::getUser()->userID,
'username' => WCF::getUser()->username,
'time' => TIME_NOW,
'type' => chat\message\ChatMessage::TYPE_JOIN,
'message' => '',
'color1' => $this->userData['color'][1],
'color2' => $this->userData['color'][2]
$messageAction = new chat\message\ChatMessageAction(array(), 'create', array(
'data' => array(
'roomID' => $this->room->roomID,
'sender' => WCF::getUser()->userID,
'username' => WCF::getUser()->username,
'time' => TIME_NOW,
'type' => chat\message\ChatMessage::TYPE_JOIN,
'message' => '',
'color1' => $this->userData['color'][1],
'color2' => $this->userData['color'][2]
)
));
$messageAction->executeAction();
}
$this->readDefaultSmileys();