Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added formatting for remaining timeout duration #2398

Merged
merged 11 commits into from Jan 31, 2021
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions src/providers/twitch/IrcMessageHandler.cpp
Expand Up @@ -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 <IrcMessage>
Expand Down Expand Up @@ -716,6 +717,19 @@ std::vector<MessagePtr> IrcMessageHandler::parseNoticeMessage(
{
return {generateBannedMessage(true)};
}
else if (message->tags()["msg-id"] == "msg_timedout")
{
std::vector<MessagePtr> 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<MessagePtr> builtMessages;
Expand Down