Added {message} parameter for moderation buttons

This commit is contained in:
TranRed 2019-05-01 16:08:45 +02:00 committed by GitHub
parent 34f820be18
commit bbf649bf70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1667,9 +1667,21 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
case Link::UserAction: case Link::UserAction:
{ {
QString value = link.value; QString value = link.value;
value.replace("{user}", layout->getMessage()->loginName) value.replace("{user}", layout->getMessage()->loginName)
.replace("{channel}", this->channel_->getName()) .replace("{channel}", this->channel_->getName())
.replace("{msg-id}", layout->getMessage()->id); .replace("{msg-id}", layout->getMessage()->id);
QString messageText;
if (value.contains("{message}"))
{
messageText = layout->getMessage()->searchText;
// remove name + : + space to only get the actual message text
messageText = messageText.remove(
0, (layout->getMessage()->loginName.length() + 2));
value.replace("{message}", messageText);
}
this->channel_->sendMessage(value); this->channel_->sendMessage(value);
} }
break; break;