only load 50 messages on channel switch (also fix member menu)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user