From 54502bc8b58030c38657571e50882e41ae9f41e8 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Fri, 12 Jan 2018 19:15:21 +0100 Subject: [PATCH] F5 adds a fake message to the IRCManager current messages have valid cheermotes in them --- src/singletons/ircmanager.cpp | 8 ++++++++ src/singletons/ircmanager.hpp | 3 +++ src/widgets/window.cpp | 20 ++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/singletons/ircmanager.cpp b/src/singletons/ircmanager.cpp index 627b72864..1ef61f266 100644 --- a/src/singletons/ircmanager.cpp +++ b/src/singletons/ircmanager.cpp @@ -404,5 +404,13 @@ Communi::IrcConnection *IrcManager::getReadConnection() return this->readConnection.get(); } +void +IrcManager::addFakeMessage(const QString &data) +{ + auto fakeMessage = Communi::IrcMessage::fromData(data.toUtf8(), this->readConnection.get()); + + this->privateMessageReceived(qobject_cast(fakeMessage)); +} + } // namespace singletons } // namespace chatterino diff --git a/src/singletons/ircmanager.hpp b/src/singletons/ircmanager.hpp index 4974e595c..7b9e23261 100644 --- a/src/singletons/ircmanager.hpp +++ b/src/singletons/ircmanager.hpp @@ -53,6 +53,9 @@ public: Communi::IrcConnection *getReadConnection(); + /// Debug function + void addFakeMessage(const QString &data); + private: ChannelManager &channelManager; ResourceManager &resources; diff --git a/src/widgets/window.cpp b/src/widgets/window.cpp index d547e38f7..7b55b9122 100644 --- a/src/widgets/window.cpp +++ b/src/widgets/window.cpp @@ -1,6 +1,7 @@ #include "widgets/window.hpp" #include "singletons/accountmanager.hpp" #include "singletons/channelmanager.hpp" +#include "singletons/ircmanager.hpp" #include "singletons/settingsmanager.hpp" #include "singletons/thememanager.hpp" #include "widgets/helper/shortcut.hpp" @@ -78,6 +79,25 @@ Window::Window(const QString &windowName, singletons::ThemeManager &_themeManage // CTRL+SHIFT+W: Close current tab CreateWindowShortcut(this, "CTRL+SHIFT+W", [this] { this->notebook.removeCurrentPage(); }); + + std::vector cheerMessages; + // clang-format off + cheerMessages.emplace_back(R"(@badges=subscriber/12,premium/1;bits=2000;color=#B22222;display-name=arzenhuz;emotes=185989:33-37;id=1ae336ac-8e1a-4d6b-8b00-9fcee26e8337;mod=0;room-id=11148817;subscriber=1;tmi-sent-ts=1515783470139;turbo=0;user-id=111553331;user-type= :arzenhuz!arzenhuz@arzenhuz.tmi.twitch.tv PRIVMSG #pajlada :pajacheer2000 Buy pizza for both pajaH)"); + cheerMessages.emplace_back(R"(@badges=subscriber/12,premium/1;bits=37;color=#3FBF72;display-name=VADIKUS007;emotes=;id=eedd95fd-2a17-4da1-879c-a1e76ffce582;mod=0;room-id=11148817;subscriber=1;tmi-sent-ts=1515783184352;turbo=0;user-id=72256775;user-type= :vadikus007!vadikus007@vadikus007.tmi.twitch.tv PRIVMSG #pajlada :cheer37)"); + cheerMessages.emplace_back(R"(@badges=moderator/1,subscriber/24,bits/100;bits=1;color=#DCD3E6;display-name=swiftapples;emotes=80803:7-13;id=1c4647f6-f1a8-4acc-a9b2-b5d23d91258d;mod=1;room-id=11148817;subscriber=1;tmi-sent-ts=1515538318854;turbo=0;user-id=80526177;user-type=mod :swiftapples!swiftapples@swiftapples.tmi.twitch.tv PRIVMSG #pajlada :cheer1 pajaHey)"); + cheerMessages.emplace_back(R"(@badges=subscriber/12,turbo/1;bits=1;color=#0A2927;display-name=Binkelderk;emotes=;id=a1d9bdc6-6f6a-4c03-8554-d5b34721a878;mod=0;room-id=11148817;subscriber=1;tmi-sent-ts=1515538899479;turbo=1;user-id=89081828;user-type= :binkelderk!binkelderk@binkelderk.tmi.twitch.tv PRIVMSG #pajlada :pajacheer1)"); + cheerMessages.emplace_back(R"(@badges=moderator/1,subscriber/24,bits/100;bits=1;color=#DCD3E6;display-name=swiftapples;emotes=80803:6-12;id=e9e21793-0b58-4ac6-8a1e-c19e165dbc9f;mod=1;room-id=11148817;subscriber=1;tmi-sent-ts=1515539073209;turbo=0;user-id=80526177;user-type=mod :swiftapples!swiftapples@swiftapples.tmi.twitch.tv PRIVMSG #pajlada :bday1 pajaHey)"); + cheerMessages.emplace_back(R"(@badges=partner/1;bits=1;color=#CC44FF;display-name=pajlada;emotes=;id=ca89214e-4fb5-48ec-853e-d2e6b41355ea;mod=0;room-id=39705480;subscriber=0;tmi-sent-ts=1515546977622;turbo=0;user-id=11148817;user-type= :pajlada!pajlada@pajlada.tmi.twitch.tv PRIVMSG #leesherwhy :test123 owocheer1 456test)"); + cheerMessages.emplace_back(R"(@badges=subscriber/12,premium/1;bits=1;color=#3FBF72;display-name=VADIKUS007;emotes=;id=c4c5061b-f5c6-464b-8bff-7f1ac816caa7;mod=0;room-id=11148817;subscriber=1;tmi-sent-ts=1515782817171;turbo=0;user-id=72256775;user-type= :vadikus007!vadikus007@vadikus007.tmi.twitch.tv PRIVMSG #pajlada :trihard1)"); + cheerMessages.emplace_back(R"(@badges=;bits=1;color=#FF0000;display-name=?????;emotes=;id=979b6b4f-be9a-42fb-a54c-88fcb0aca18d;mod=0;room-id=11148817;subscriber=0;tmi-sent-ts=1515782819084;turbo=0;user-id=70656218;user-type= :stels_tv!stels_tv@stels_tv.tmi.twitch.tv PRIVMSG #pajlada :trihard1)"); + cheerMessages.emplace_back(R"(@badges=subscriber/3,premium/1;bits=1;color=#FF0000;display-name=kalvarenga;emotes=;id=4744d6f0-de1d-475d-a3ff-38647113265a;mod=0;room-id=11148817;subscriber=1;tmi-sent-ts=1515782860740;turbo=0;user-id=108393131;user-type= :kalvarenga!kalvarenga@kalvarenga.tmi.twitch.tv PRIVMSG #pajlada :trihard1)"); + // clang-format on + + CreateWindowShortcut(this, "F5", [cheerMessages] { + auto &ircManager = singletons::IrcManager::getInstance(); + static int index = 0; + ircManager.addFakeMessage(cheerMessages[index++ % cheerMessages.size()]); + }); } void Window::repaintVisibleChatWidgets(Channel *channel)