Delete 'is live' messages from non-open channels (#3678)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -249,6 +249,26 @@ void NotificationController::removeFakeChannel(const QString channelName)
|
||||
if (i != fakeTwitchChannels.end())
|
||||
{
|
||||
fakeTwitchChannels.erase(i);
|
||||
// "delete" old 'CHANNEL is live' message
|
||||
LimitedQueueSnapshot<MessagePtr> snapshot =
|
||||
getApp()->twitch->liveChannel->getMessageSnapshot();
|
||||
int snapshotLength = snapshot.size();
|
||||
|
||||
// MSVC hates this code if the parens are not there
|
||||
int end = (std::max)(0, snapshotLength - 200);
|
||||
// this assumes that channelName is a login name therefore will only delete messages from fake channels
|
||||
auto liveMessageSearchText = QString("%1 is live!").arg(channelName);
|
||||
|
||||
for (int i = snapshotLength - 1; i >= end; --i)
|
||||
{
|
||||
auto &s = snapshot[i];
|
||||
|
||||
if (s->messageText == liveMessageSearchText)
|
||||
{
|
||||
s->flags.set(MessageFlag::Disabled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user