mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Refresh DDNet tab when a new serverlist was received
This commit is contained in:
parent
68db4a0709
commit
7035bf87fd
|
@ -1207,13 +1207,30 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket)
|
|||
// do decompression of serverlist
|
||||
if (uncompress((Bytef*)aBuf, &DstLen, (Bytef*)pComp, CompLength) == Z_OK && (int)DstLen == PlainLength)
|
||||
{
|
||||
bool ListChanged = true;
|
||||
|
||||
IOHANDLE File = m_pStorage->OpenFile("ddnet-servers.json", IOFLAG_READ, IStorage::TYPE_SAVE);
|
||||
if (File)
|
||||
{
|
||||
char aBuf2[16384];
|
||||
io_read(File, aBuf2, sizeof(aBuf2));
|
||||
io_close(File);
|
||||
if (str_comp(aBuf, aBuf2) == 0)
|
||||
ListChanged = false;
|
||||
}
|
||||
|
||||
// decompression successful, write plain file
|
||||
if (ListChanged)
|
||||
{
|
||||
IOHANDLE File = m_pStorage->OpenFile("ddnet-servers.json", IOFLAG_WRITE, IStorage::TYPE_SAVE);
|
||||
if (File)
|
||||
{
|
||||
io_write(File, aBuf, PlainLength);
|
||||
io_close(File);
|
||||
}
|
||||
if(g_Config.m_UiPage == CMenus::PAGE_DDNET)
|
||||
m_ServerBrowser.Refresh(IServerBrowser::TYPE_DDNET);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue