Skip to content

Commit ec6d370

Browse files
committed
Core/Addons: Fix sending banned addons to only contain new entries
1 parent 8d407de commit ec6d370

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/server/game/Server/WorldSession.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,8 @@ void WorldSession::ReadAddonsInfo(ByteBuffer &data)
11341134
ByteBuffer addonInfo;
11351135
addonInfo.resize(size);
11361136

1137+
_addons.SecureAddons.clear();
1138+
11371139
if (uncompress(addonInfo.contents(), &uSize, data.contents() + pos, data.size() - pos) == Z_OK)
11381140
{
11391141
try
@@ -1182,9 +1184,8 @@ void WorldSession::ReadAddonsInfo(ByteBuffer &data)
11821184

11831185
addonInfo.rpos(addonInfo.size() - 4);
11841186

1185-
uint32 lastBannedAddOnTimestamp;
1186-
addonInfo >> lastBannedAddOnTimestamp;
1187-
TC_LOG_DEBUG("addon", "AddOn: Newest banned addon timestamp: {}", lastBannedAddOnTimestamp);
1187+
addonInfo >> _addons.LastBannedAddOnTimestamp;
1188+
TC_LOG_DEBUG("addon", "AddOn: Newest banned addon timestamp: {}", _addons.LastBannedAddOnTimestamp);
11881189
}
11891190
catch (ByteBufferException const& e)
11901191
{
@@ -1253,10 +1254,7 @@ void WorldSession::SendAddonsInfo()
12531254
std::size_t sizePos = data.wpos();
12541255
uint32 bannedAddonCount = 0;
12551256
data << uint32(0);
1256-
auto itr = std::lower_bound(bannedAddons->begin(), bannedAddons->end(), _addons.LastBannedAddOnTimestamp, [](BannedAddon const& bannedAddon, uint32 timestamp)
1257-
{
1258-
return bannedAddon.Timestamp < timestamp;
1259-
});
1257+
auto itr = std::ranges::lower_bound(*bannedAddons, lastBannedAddOnTimestamp, std::ranges::less(), &BannedAddon::Timestamp);
12601258
for (; itr != bannedAddons->end(); ++itr)
12611259
{
12621260
data << uint32(itr->Id);

0 commit comments

Comments
 (0)