diff options
Diffstat (limited to 'windows/mainwindow.cpp')
-rw-r--r-- | windows/mainwindow.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/windows/mainwindow.cpp b/windows/mainwindow.cpp index 30d52bb..d4453af 100644 --- a/windows/mainwindow.cpp +++ b/windows/mainwindow.cpp @@ -111,7 +111,17 @@ void MainWindow::UpdateChannelListing() { void MainWindow::UpdateChatWindowContents() { auto &discord = Abaddon::Get().GetDiscordClient(); - m_chat.SetMessages(discord.GetMessagesForChannel(m_chat.GetActiveChannel())); + auto allmsgs = discord.GetMessagesForChannel(m_chat.GetActiveChannel()); + if (allmsgs.size() > 50) { + std::vector<Snowflake> msgvec(allmsgs.begin(), allmsgs.end()); + std::vector<Snowflake> cutvec(msgvec.end() - 50, msgvec.end()); + std::set<Snowflake> msgs; + for (const auto s : cutvec) + msgs.insert(s); + m_chat.SetMessages(msgs); + } else { + m_chat.SetMessages(allmsgs); + } m_members.UpdateMemberList(); } @@ -151,6 +161,10 @@ void MainWindow::InsertChatInput(std::string text) { m_chat.InsertChatInput(text); } +Snowflake MainWindow::GetChatOldestListedMessage() { + return m_chat.GetOldestListedMessage(); +} + ChannelList *MainWindow::GetChannelList() { return &m_channel_list; } |