refactor: ChannelView (#4926)

Co-authored-by: nerix <nerixdev@outlook.de>
This commit is contained in:
pajlada
2023-10-31 14:54:14 +01:00
committed by GitHub
parent 25c776cfff
commit 7efe58cca9
6 changed files with 386 additions and 346 deletions
+16
View File
@@ -1257,6 +1257,22 @@ const std::unordered_map<QString, std::weak_ptr<MessageThread>>
return this->threads_;
}
std::shared_ptr<MessageThread> TwitchChannel::getOrCreateThread(
const MessagePtr &message)
{
assert(message != nullptr);
auto threadIt = this->threads_.find(message->id);
if (threadIt != this->threads_.end() && !threadIt->second.expired())
{
return threadIt->second.lock();
}
auto thread = std::make_shared<MessageThread>(message);
this->addReplyThread(thread);
return thread;
}
void TwitchChannel::cleanUpReplyThreads()
{
for (auto it = this->threads_.begin(), last = this->threads_.end();