Move most Command variables into the CommandController shared variables (#3824)

This commit is contained in:
pajlada
2022-06-25 14:06:16 +02:00
committed by GitHub
parent 6a58ce1273
commit 34ea303607
4 changed files with 223 additions and 105 deletions
+5 -24
View File
@@ -2125,20 +2125,12 @@ void ChannelView::addCommandExecutionContextMenuItems(
{
userText = split->getInput().getInputText();
}
// Execute command through right-clicking a message -> Execute command
QString value = getApp()->commands->execCustomCommand(
inputText.split(' '), cmd, true, channel,
inputText.split(' '), cmd, true, channel, layout->getMessage(),
{
{"user.name", layout->getMessage()->loginName},
{"msg.id", layout->getMessage()->id},
{"msg.text", layout->getMessage()->messageText},
{"input.text", userText},
// old placeholders
{"user", layout->getMessage()->loginName},
{"msg-id", layout->getMessage()->id},
{"message", layout->getMessage()->messageText},
{"channel", this->channel()->getName()},
});
value = getApp()->commands->execCommand(value, channel, false);
@@ -2283,21 +2275,10 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
}
}
// Execute command clicking a moderator button
value = getApp()->commands->execCustomCommand(
QStringList(), Command{"(modaction)", value}, true, channel,
{
{"user.name", layout->getMessage()->loginName},
{"msg.id", layout->getMessage()->id},
{"msg.text", layout->getMessage()->messageText},
// old placeholders
{"user", layout->getMessage()->loginName},
{"msg-id", layout->getMessage()->id},
{"message", layout->getMessage()->messageText},
// new version of this is inside execCustomCommand
{"channel", this->channel()->getName()},
});
layout->getMessage());
value = getApp()->commands->execCommand(value, channel, false);