From 3c1d2646898116cceefb7d66fb44499a10ca570b Mon Sep 17 00:00:00 2001 From: apa420 Date: Sun, 28 Apr 2019 02:25:05 +0200 Subject: [PATCH] Added trashcan, replaced messageID var with this-message().id, removed pubsub stuff that didn't belong --- resources/buttons/trashCan.png | Bin 0 -> 3087 bytes resources/resources_autogenerated.qrc | 1 + src/autogenerated/ResourcesAutogen.cpp | 1 + src/autogenerated/ResourcesAutogen.hpp | 1 + src/common/Channel.cpp | 8 +------- .../moderationactions/ModerationAction.cpp | 2 +- src/providers/twitch/PubsubClient.cpp | 3 --- src/providers/twitch/TwitchMessageBuilder.cpp | 5 ++--- src/providers/twitch/TwitchMessageBuilder.hpp | 7 ++++--- src/widgets/settingspages/ModerationPage.cpp | 3 ++- 10 files changed, 13 insertions(+), 18 deletions(-) create mode 100644 resources/buttons/trashCan.png diff --git a/resources/buttons/trashCan.png b/resources/buttons/trashCan.png new file mode 100644 index 0000000000000000000000000000000000000000..b5e11bf4969ebe501019b7be6bb691bc5d967cd4 GIT binary patch literal 3087 zcmYjTc{CJk7k>uXw`56{Y$4m&Wgj#4HH>DYvKu9#)L5diuaRVLL}gzpG8#*bB}7KZ zI+pAq>a|2!=F|Iq@A=+)&V7FO{?6~-d!GB(O*n6D!p3}x834d$W@>16gf4%ak^bnN z&BmTP0w#Y`$6ElfxBYQQr(dZD0L(U55s35Wz5N3HZh8Cpihw0$m01v?(dL zWFA{N)p&a=cEfdaWW`7fZviA|kcAPDtnx^Tf^k%i6?o1i z2re2z3QRj^!HDAqu#gmZF@PCEaQJLVdr&|JTzcHy=D>M*;39QzaS-6}yE&l{;Pgn8 z2U3s*L{50d8v<`_P}z4O(FmXw0k@Y$yCxWw2a0AWFH`Wc9+1eKEH!|U6)4)q$D9Rp zp}?g}Ts#Ow=KyZw4V2DbveleRGDn-rsnH=yXc|R0G0F!ppim0J(quC}S#EV#8rNKy zLThjizjA~s$Cu5I02HM09Q}6lAc)LfO(v_S5ZImNSKiT6#oXNH4j1|={9yph1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8Bz1UoNO|wQPAeh2D$8$_J_5yvS&YMJn zjPH<5#TqKBI=opj#L6e)N=tWSOC7{#mBoR1Atr2fVr1>I4I1h=UFZ5c7B8U3laN@= zP2tPpxi>035wsu>=hyu%XX4T8vWj-1N1xY#*Ye_&e7+NVW_i|P7W)mhvGLbz(-&T^ zZT~c)K(l(KDUDGC1o7EBoi|OMB_GJW+WN@n$Sve=r26{6WS#5C?v4I+fzYO(s^5kv zPE9)pdLQ0W93T!>LtaCkduDsJJNnfL<;%O7d%l;etbGI4I%x-J4;aMR2_wYMLqY?( zNW0Ww*;Nzv&eLxX@!zrXZ0c+d_aAr6iu)S|&oA#VP45V^X^r1W4y~MF7(9JP2qOf& z2G8BdHO{lo-E(qtYOwjJ*FU^66|!$aInD7{RmU;dd=vTM>iBZxU^-@_FBzYK4+~fL zHQ_>eN(fzYCr@AF@cZ7t88|awL`_=KZqg=S+ISPVQA1fcfqH|=eWB&-yArsfbC^D8 z)7kjAF}Ip{$%nWe(p(qnwX-acuR)&NY7YL3mpVL@ucuj1^{pwWeJjD-($$9bRAjks?|t#g#~R-NVb$QSY%uKX!<{vOEd9nj@xK2)c0?u;28V@B%Y6!?kH=3=;)HmH~*(h zAke^GHOGFsknbpz~4u-5!A52ROycnp8uPr z!6-!W+i}^y8O3e*{(LAcDF^!FC@0B6YPx<{&=`v2{;StqrNM?Ah0=|wqdu`50Hz&% z!HJ)6`fwTahwWMb4-;QN17H9!!hXFy(ow0jAjII%zpm!XwLcxqjI0f-;VzN?0m{mR AivR!s literal 0 HcmV?d00001 diff --git a/resources/resources_autogenerated.qrc b/resources/resources_autogenerated.qrc index fcf0b5dac..4c15a6a82 100644 --- a/resources/resources_autogenerated.qrc +++ b/resources/resources_autogenerated.qrc @@ -24,6 +24,7 @@ buttons/modModeEnabled.png buttons/modModeEnabled2.png buttons/timeout.png + buttons/trashCan.png buttons/unban.png buttons/unmod.png buttons/update.png diff --git a/src/autogenerated/ResourcesAutogen.cpp b/src/autogenerated/ResourcesAutogen.cpp index 34cf039ef..59f5fce70 100644 --- a/src/autogenerated/ResourcesAutogen.cpp +++ b/src/autogenerated/ResourcesAutogen.cpp @@ -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"); diff --git a/src/autogenerated/ResourcesAutogen.hpp b/src/autogenerated/ResourcesAutogen.hpp index fbbb2fbf3..1c8a0bce4 100644 --- a/src/autogenerated/ResourcesAutogen.hpp +++ b/src/autogenerated/ResourcesAutogen.hpp @@ -24,6 +24,7 @@ public: QPixmap modModeEnabled; QPixmap modModeEnabled2; QPixmap timeout; + QPixmap trashCan; QPixmap unban; QPixmap unmod; QPixmap update; diff --git a/src/common/Channel.cpp b/src/common/Channel.cpp index 82432db44..caa432752 100644 --- a/src/common/Channel.cpp +++ b/src/common/Channel.cpp @@ -217,18 +217,12 @@ void Channel::deleteMessage(QString messageID) LimitedQueueSnapshot 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); diff --git a/src/controllers/moderationactions/ModerationAction.cpp b/src/controllers/moderationactions/ModerationAction.cpp index 8683f2c4e..199ea5521 100644 --- a/src/controllers/moderationactions/ModerationAction.cpp +++ b/src/controllers/moderationactions/ModerationAction.cpp @@ -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 { diff --git a/src/providers/twitch/PubsubClient.cpp b/src/providers/twitch/PubsubClient.cpp index 5108c5ad4..0a8976618 100644 --- a/src/providers/twitch/PubsubClient.cpp +++ b/src/providers/twitch/PubsubClient.cpp @@ -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); diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index 6073e6449..b935a2831 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -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(channelName, MessageElementFlag::ChannelName, MessageColor::System) // diff --git a/src/providers/twitch/TwitchMessageBuilder.hpp b/src/providers/twitch/TwitchMessageBuilder.hpp index 5aa72b204..da7b3865c 100644 --- a/src/providers/twitch/TwitchMessageBuilder.hpp +++ b/src/providers/twitch/TwitchMessageBuilder.hpp @@ -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> &vec, std::vector &correctPositions); + void appendTwitchEmote( + const QString &emote, + std::vector> &vec, + std::vector &correctPositions); Outcome tryAppendEmote(const EmoteName &name); void addWords( diff --git a/src/widgets/settingspages/ModerationPage.cpp b/src/widgets/settingspages/ModerationPage.cpp index 3349d2e93..b44e73274 100644 --- a/src/widgets/settingspages/ModerationPage.cpp +++ b/src/widgets/settingspages/ModerationPage.cpp @@ -161,7 +161,8 @@ ModerationPage::ModerationPage() // clang-format off auto label = modMode.emplace( "Moderation mode is enabled by clicking in a channel that you moderate.

" - "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.
"); + "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.
" + "For deleting messages use /delete {msg-id}."); label->setWordWrap(true); label->setStyleSheet("color: #bbb"); // clang-format on