Added trashcan, replaced messageID var with this-message().id, removed pubsub stuff that didn't belong

This commit is contained in:
apa420 2019-04-28 02:25:05 +02:00
parent 4f79d6fc07
commit 3c1d264689
10 changed files with 13 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -24,6 +24,7 @@
<file>buttons/modModeEnabled.png</file>
<file>buttons/modModeEnabled2.png</file>
<file>buttons/timeout.png</file>
<file>buttons/trashCan.png</file>
<file>buttons/unban.png</file>
<file>buttons/unmod.png</file>
<file>buttons/update.png</file>

View file

@ -18,6 +18,7 @@ Resources2::Resources2()
this->buttons.modModeEnabled = QPixmap(":/buttons/modModeEnabled.png");
this->buttons.modModeEnabled2 = QPixmap(":/buttons/modModeEnabled2.png");
this->buttons.timeout = QPixmap(":/buttons/timeout.png");
this->buttons.trashCan = QPixmap(":/buttons/trashCan.png");
this->buttons.unban = QPixmap(":/buttons/unban.png");
this->buttons.unmod = QPixmap(":/buttons/unmod.png");
this->buttons.update = QPixmap(":/buttons/update.png");

View file

@ -24,6 +24,7 @@ public:
QPixmap modModeEnabled;
QPixmap modModeEnabled2;
QPixmap timeout;
QPixmap trashCan;
QPixmap unban;
QPixmap unmod;
QPixmap update;

View file

@ -217,18 +217,12 @@ void Channel::deleteMessage(QString messageID)
LimitedQueueSnapshot<MessagePtr> snapshot = this->getMessageSnapshot();
int snapshotLength = snapshot.size();
int end = std::max(0, snapshotLength - 20);
int end = std::max(0, snapshotLength - 200);
QTime minimumTime = QTime::currentTime().addSecs(-5);
for (int i = snapshotLength - 1; i >= end; --i)
{
auto &s = snapshot[i];
if (s->parseTime < minimumTime)
{
break;
}
if (s->id == messageID)
{
s->flags.set(MessageFlag::Disabled);

View file

@ -75,7 +75,7 @@ ModerationAction::ModerationAction(const QString &action)
}
else if (action.startsWith("/delete"))
{
this->image_ = Image::fromPixmap(getApp()->resources->pajaDank);
this->image_ = Image::fromPixmap(getApp()->resources->buttons.trashCan);
}
else
{

View file

@ -710,9 +710,6 @@ PubSub::PubSub()
// qDebug() << QString::fromStdString(rj::stringify(data));
};
this->moderationActionHandlers["delete"] =
[this](const auto &data, const auto &roomID) { qDebug() << "xd"; };
this->websocketClient.set_access_channels(websocketpp::log::alevel::all);
this->websocketClient.clear_access_channels(
websocketpp::log::alevel::frame_payload);

View file

@ -580,9 +580,8 @@ void TwitchMessageBuilder::parseMessageID()
if (iterator != this->tags.end())
{
this->messageID = iterator.value().toString();
this->message().id = iterator.value().toString();
}
this->message().id = this->messageID;
}
void TwitchMessageBuilder::parseRoomID()
@ -608,7 +607,7 @@ void TwitchMessageBuilder::parseRoomID()
void TwitchMessageBuilder::appendChannelName()
{
QString channelName("#" + this->channel->getName());
Link link(Link::Url, this->channel->getName() + "\n" + this->messageID);
Link link(Link::Url, this->channel->getName() + "\n" + this->message().id);
this->emplace<TextElement>(channelName, MessageElementFlag::ChannelName,
MessageColor::System) //

View file

@ -41,7 +41,6 @@ public:
MessageParseArgs args;
const QVariantMap tags;
QString messageID;
QString userName;
bool isIgnored() const;
@ -55,8 +54,10 @@ private:
void appendUsername();
void parseHighlights(bool isPastMsg);
void appendTwitchEmote(const QString &emote,
std::vector<std::tuple<int, EmotePtr, EmoteName>> &vec, std::vector<int> &correctPositions);
void appendTwitchEmote(
const QString &emote,
std::vector<std::tuple<int, EmotePtr, EmoteName>> &vec,
std::vector<int> &correctPositions);
Outcome tryAppendEmote(const EmoteName &name);
void addWords(

View file

@ -161,7 +161,8 @@ ModerationPage::ModerationPage()
// clang-format off
auto label = modMode.emplace<QLabel>(
"Moderation mode is enabled by clicking <img width='18' height='18' src=':/buttons/modModeDisabled.png'> in a channel that you moderate.<br><br>"
"Moderation buttons can be bound to chat commands such as \"/ban {user}\", \"/timeout {user} 1000\", \"/w someusername !report {user} was bad in channel {channel}\" or any other custom text commands.<br>");
"Moderation buttons can be bound to chat commands such as \"/ban {user}\", \"/timeout {user} 1000\", \"/w someusername !report {user} was bad in channel {channel}\" or any other custom text commands.<br>"
"For deleting messages use /delete {msg-id}.");
label->setWordWrap(true);
label->setStyleSheet("color: #bbb");
// clang-format on