mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Remove some duplicate code
This commit is contained in:
parent
3aabe24ec9
commit
bf1ea5f411
@ -163,6 +163,8 @@ public function send() {
|
|||||||
|
|
||||||
// add activity points
|
// add activity points
|
||||||
\wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.message', $returnValues['returnValues']->messageID, WCF::getUser()->userID);
|
\wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.message', $returnValues['returnValues']->messageID, WCF::getUser()->userID);
|
||||||
|
|
||||||
|
return $returnValues['returnValues'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -242,28 +244,18 @@ public function validateSendAttachment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function sendAttachment() {
|
public function sendAttachment() {
|
||||||
$this->objectAction = new MessageAction(array(), 'create', array(
|
$this->parameters['type'] = Message::TYPE_ATTACHMENT;
|
||||||
'data' => array(
|
$this->parameters['text'] = '[attach]'. $this->parameters['objectID'] .'[/attach]';
|
||||||
'roomID' => $this->parameters['room']->roomID,
|
$this->parameters['additionalData'] = null;
|
||||||
'sender' => WCF::getUser()->userID,
|
$this->parameters['receiver'] = null;
|
||||||
'username' => WCF::getUser()->username,
|
$this->parameters['enableSmilies'] = false;
|
||||||
'time' => TIME_NOW,
|
$this->parameters['enableHTML'] = false;
|
||||||
'type' => Message::TYPE_ATTACHMENT,
|
|
||||||
'message' => '[attach]'. $this->parameters['objectID'] .'[/attach]',
|
|
||||||
'color1' => $this->parameters['userData']['color1'],
|
|
||||||
'color2' => $this->parameters['userData']['color2'],
|
|
||||||
'attachmentID' => $this->parameters['objectID']
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->objectAction->executeAction();
|
$messageAction = new MessageAction(array(), 'send', $this->parameters);
|
||||||
$returnValues = $this->objectAction->getReturnValues();
|
$messageAction->executeAction();
|
||||||
|
$returnValues = $messageAction->getReturnValues();
|
||||||
|
|
||||||
$this->parameters['parentObjectID'] = 0;
|
$attachmentHandler = new \wcf\system\attachment\AttachmentHandler('be.bastelstu.chat.message', $this->parameters['objectID'], $this->parameters['tmpHash'], 0);
|
||||||
$attachmentHandler = new \wcf\system\attachment\AttachmentHandler('be.bastelstu.chat.message', $this->parameters['objectID'], $this->parameters['tmpHash'], $this->parameters['parentObjectID']);
|
|
||||||
$attachmentHandler->updateObjectID($returnValues['returnValues']->messageID);
|
$attachmentHandler->updateObjectID($returnValues['returnValues']->messageID);
|
||||||
|
|
||||||
// add activity points
|
|
||||||
\wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.message', $returnValues['returnValues']->messageID, WCF::getUser()->userID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user