From 677017a8bdeaa609ad61b297a3ed20c2ad02f4b2 Mon Sep 17 00:00:00 2001 From: apa420 Date: Tue, 27 Aug 2019 19:48:08 +0000 Subject: [PATCH 01/57] Now shows connect and reconnect messages --- src/providers/twitch/TwitchServer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/providers/twitch/TwitchServer.cpp b/src/providers/twitch/TwitchServer.cpp index 9087f45b..394a8504 100644 --- a/src/providers/twitch/TwitchServer.cpp +++ b/src/providers/twitch/TwitchServer.cpp @@ -201,6 +201,7 @@ void TwitchServer::writeConnectionMessageReceived(Communi::IrcMessage *message) void TwitchServer::onConnected(IrcConnection *connection) { + AbstractIrcServer::onConnected(connection); // connection in thise case is the read connection connection->sendRaw( "CAP REQ :twitch.tv/tags twitch.tv/commands twitch.tv/membership"); From 450f3bc492bf6ac36fcc1313a8cf795d66b583e4 Mon Sep 17 00:00:00 2001 From: fourtf Date: Tue, 27 Aug 2019 19:53:29 +0200 Subject: [PATCH 02/57] removed useless const --- src/common/SignalVector.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/SignalVector.hpp b/src/common/SignalVector.hpp index c0b0af0e..7d03a283 100644 --- a/src/common/SignalVector.hpp +++ b/src/common/SignalVector.hpp @@ -121,7 +121,7 @@ public: return this->vector_; } - const std::vector cloneVector() const + std::vector cloneVector() const { std::shared_lock lock(this->mutex_); From a624d14a4fbb6cd60afe4d4bedfe635b7371e39b Mon Sep 17 00:00:00 2001 From: apa420 Date: Tue, 27 Aug 2019 18:45:55 +0000 Subject: [PATCH 03/57] Fetch FFZ channel emotes with channel id instead of name --- src/providers/ffz/FfzEmotes.cpp | 18 +++++++++--------- src/providers/ffz/FfzEmotes.hpp | 2 +- src/providers/twitch/ChatroomChannel.cpp | 17 +++++++++++------ src/providers/twitch/ChatroomChannel.hpp | 3 ++- src/providers/twitch/TwitchChannel.cpp | 11 ++++++++--- src/providers/twitch/TwitchChannel.hpp | 3 ++- src/widgets/splits/Split.cpp | 5 ++++- src/widgets/splits/SplitHeader.cpp | 5 ++++- 8 files changed, 41 insertions(+), 23 deletions(-) diff --git a/src/providers/ffz/FfzEmotes.cpp b/src/providers/ffz/FfzEmotes.cpp index e25f2600..ca71f7a5 100644 --- a/src/providers/ffz/FfzEmotes.cpp +++ b/src/providers/ffz/FfzEmotes.cpp @@ -138,7 +138,7 @@ void FfzEmotes::loadEmotes() QString url("https://api.frankerfacez.com/v1/set/global"); NetworkRequest(url) - + .timeout(30000) .onSuccess([this](auto result) -> Outcome { auto emotes = this->emotes(); @@ -151,13 +151,13 @@ void FfzEmotes::loadEmotes() .execute(); } -void FfzEmotes::loadChannel(const QString &channelName, +void FfzEmotes::loadChannel(const QString &channelId, std::function callback) { - log("[FFZEmotes] Reload FFZ Channel Emotes for channel {}\n", channelName); + log("[FFZEmotes] Reload FFZ Channel Emotes for channel {}\n", channelId); + + NetworkRequest("https://api.frankerfacez.com/v1/room/id/" + channelId) - NetworkRequest("https://api.frankerfacez.com/v1/room/" + channelName) - .timeout(20000) .onSuccess([callback = std::move(callback)](auto result) -> Outcome { auto pair = parseChannelEmotes(result.parseJson()); @@ -165,7 +165,7 @@ void FfzEmotes::loadChannel(const QString &channelName, callback(std::move(pair.second)); return pair.first; }) - .onError([channelName](int result) { + .onError([channelId](int result) { if (result == 203) { // User does not have any FFZ emotes @@ -176,12 +176,12 @@ void FfzEmotes::loadChannel(const QString &channelName, { // TODO: Auto retry in case of a timeout, with a delay log("Fetching FFZ emotes for channel {} failed due to timeout", - channelName); + channelId); return true; } - log("Error fetching FFZ emotes for channel {}, error {}", - channelName, result); + log("Error fetching FFZ emotes for channel {}, error {}", channelId, + result); return true; }) diff --git a/src/providers/ffz/FfzEmotes.hpp b/src/providers/ffz/FfzEmotes.hpp index 8214cbf8..94bdfcb1 100644 --- a/src/providers/ffz/FfzEmotes.hpp +++ b/src/providers/ffz/FfzEmotes.hpp @@ -22,7 +22,7 @@ public: std::shared_ptr emotes() const; boost::optional emote(const EmoteName &name) const; void loadEmotes(); - static void loadChannel(const QString &channelName, + static void loadChannel(const QString &channelId, std::function callback); private: diff --git a/src/providers/twitch/ChatroomChannel.cpp b/src/providers/twitch/ChatroomChannel.cpp index fdccdb19..e87abbae 100644 --- a/src/providers/twitch/ChatroomChannel.cpp +++ b/src/providers/twitch/ChatroomChannel.cpp @@ -22,7 +22,7 @@ ChatroomChannel::ChatroomChannel(const QString &channelName, } } -void ChatroomChannel::refreshChannelEmotes() +void ChatroomChannel::refreshBTTVChannelEmotes() { if (this->chatroomOwnerId.isEmpty()) { @@ -36,17 +36,22 @@ void ChatroomChannel::refreshChannelEmotes() this->bttvEmotes_.set( std::make_shared(std::move(emoteMap))); }); - FfzEmotes::loadChannel(username, [this, weak](auto &&emoteMap) { - if (auto shared = weak.lock()) - this->ffzEmotes_.set( - std::make_shared(std::move(emoteMap))); - }); if (auto shared = weak.lock()) { this->chatroomOwnerName = username; } }); } +void ChatroomChannel::refreshFFZChannelEmotes() +{ + if (this->chatroomOwnerId.isEmpty()) + { + return; + } + FfzEmotes::loadChannel(this->chatroomOwnerId, [this](auto &&emoteMap) { + this->ffzEmotes_.set(std::make_shared(std::move(emoteMap))); + }); +} const QString &ChatroomChannel::getDisplayName() const { diff --git a/src/providers/twitch/ChatroomChannel.hpp b/src/providers/twitch/ChatroomChannel.hpp index 55606e91..7131dd9d 100644 --- a/src/providers/twitch/ChatroomChannel.hpp +++ b/src/providers/twitch/ChatroomChannel.hpp @@ -13,7 +13,8 @@ protected: explicit ChatroomChannel(const QString &channelName, TwitchBadges &globalTwitchBadges, BttvEmotes &globalBttv, FfzEmotes &globalFfz); - virtual void refreshChannelEmotes() override; + virtual void refreshBTTVChannelEmotes() override; + virtual void refreshFFZChannelEmotes() override; virtual const QString &getDisplayName() const override; QString chatroomOwnerId; diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index d6fb6a6b..1c6b5eda 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -113,6 +113,7 @@ TwitchChannel::TwitchChannel(const QString &name, this->refreshLiveStatus(); this->refreshBadges(); this->refreshCheerEmotes(); + this->refreshFFZChannelEmotes(); }); // timers @@ -135,7 +136,7 @@ TwitchChannel::TwitchChannel(const QString &name, void TwitchChannel::initialize() { this->refreshChatters(); - this->refreshChannelEmotes(); + this->refreshBTTVChannelEmotes(); this->refreshBadges(); this->ffzCustomModBadge_.loadCustomModBadge(); } @@ -150,7 +151,7 @@ bool TwitchChannel::canSendMessage() const return !this->isEmpty(); } -void TwitchChannel::refreshChannelEmotes() +void TwitchChannel::refreshBTTVChannelEmotes() { BttvEmotes::loadChannel( this->getName(), [this, weak = weakOf(this)](auto &&emoteMap) { @@ -158,8 +159,12 @@ void TwitchChannel::refreshChannelEmotes() this->bttvEmotes_.set( std::make_shared(std::move(emoteMap))); }); +} + +void TwitchChannel::refreshFFZChannelEmotes() +{ FfzEmotes::loadChannel( - this->getName(), [this, weak = weakOf(this)](auto &&emoteMap) { + this->roomId(), [this, weak = weakOf(this)](auto &&emoteMap) { if (auto shared = weak.lock()) this->ffzEmotes_.set( std::make_shared(std::move(emoteMap))); diff --git a/src/providers/twitch/TwitchChannel.hpp b/src/providers/twitch/TwitchChannel.hpp index e8ea9c29..e59c265a 100644 --- a/src/providers/twitch/TwitchChannel.hpp +++ b/src/providers/twitch/TwitchChannel.hpp @@ -85,7 +85,8 @@ public: std::shared_ptr bttvEmotes() const; std::shared_ptr ffzEmotes() const; - virtual void refreshChannelEmotes(); + virtual void refreshBTTVChannelEmotes(); + virtual void refreshFFZChannelEmotes(); // Badges boost::optional ffzCustomModBadge() const; diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 1d4e123a..6c79d1d2 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -663,7 +663,10 @@ void Split::reloadChannelAndSubscriberEmotes() auto channel = this->getChannel(); if (auto twitchChannel = dynamic_cast(channel.get())) - twitchChannel->refreshChannelEmotes(); + { + twitchChannel->refreshBTTVChannelEmotes(); + twitchChannel->refreshFFZChannelEmotes(); + } } template diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index 040d47e1..07f83e1c 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -713,7 +713,10 @@ void SplitHeader::reloadChannelEmotes() auto channel = this->split_->getChannel(); if (auto twitchChannel = dynamic_cast(channel.get())) - twitchChannel->refreshChannelEmotes(); + { + twitchChannel->refreshFFZChannelEmotes(); + twitchChannel->refreshBTTVChannelEmotes(); + } } void SplitHeader::reloadSubscriberEmotes() From f2f5ae9c93f837041cbb1b21be2564518fbadf74 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Thu, 22 Aug 2019 20:23:49 +0200 Subject: [PATCH 04/57] Add a copy button near the username in usercards --- src/widgets/dialogs/UserInfoPopup.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 899a4aaf..34008b43 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -58,11 +58,26 @@ UserInfoPopup::UserInfoPopup() // items on the right auto vbox = head.emplace(); { - auto name = vbox.emplace