From c2782666a66810ef6b973ce543626ad80d07e352 Mon Sep 17 00:00:00 2001 From: M4tthewDE Date: Sun, 31 Jan 2021 13:55:44 +0100 Subject: [PATCH] Added formatting for remaining timeout duration (#2398) --- CHANGELOG.md | 1 + src/providers/twitch/IrcMessageHandler.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e00de419..6bc0ff3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ - Minor: Made username autocompletion truecase (#1199, #1883) - Minor: Update the listing of top-level domains. (#2345) - Minor: Properly respect RECONNECT messages from Twitch (#2347) +- Minor: Added human-readable formatting to remaining timeout duration. (#2398) - Bugfix: Fix crash occurring when pressing Escape in the Color Picker Dialog (#1843) - Bugfix: Fix bug where the "check user follow state" event could trigger a network request requesting the user to follow or unfollow a user. By itself its quite harmless as it just repeats to Twitch the same follow state we had, so no follows should have been lost by this but it meant there was a rogue network request that was fired that could cause a crash (#1906) - Bugfix: /usercard command will now respect the "Automatically close user popup" setting (#1918) diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index e553d2ae..e2f39bda 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -13,6 +13,7 @@ #include "singletons/Resources.hpp" #include "singletons/Settings.hpp" #include "singletons/WindowManager.hpp" +#include "util/FormatTime.hpp" #include "util/IrcHelpers.hpp" #include @@ -716,6 +717,19 @@ std::vector IrcMessageHandler::parseNoticeMessage( { return {generateBannedMessage(true)}; } + else if (message->tags()["msg-id"] == "msg_timedout") + { + std::vector builtMessages; + + QString formattedMessage = "You are timed out for "; + formattedMessage.append( + formatTime(message->content().split(" ").value(5))); + + builtMessages.emplace_back(makeSystemMessage( + formattedMessage.append("."), calculateMessageTimestamp(message))); + + return builtMessages; + } else { std::vector builtMessages;