Core/PacketIO: Implemented possibility to ban client addons serverside

This commit is contained in:
Shauren
2013-04-05 15:06:35 +02:00
parent 140614b882
commit d24ef896df
9 changed files with 127 additions and 34 deletions

View File

@@ -960,12 +960,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
SavedAddon const* savedAddon = AddonMgr::GetAddonInfo(addonName);
if (savedAddon)
{
bool match = true;
if (addon.CRC != savedAddon->CRC)
match = false;
if (!match)
sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC);
else
sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC);
@@ -984,9 +979,6 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
uint32 currentTime;
addonInfo >> currentTime;
sLog->outDebug(LOG_FILTER_NETWORKIO, "ADDON: CurrentTime: %u", currentTime);
if (addonInfo.rpos() != addonInfo.size())
sLog->outDebug(LOG_FILTER_NETWORKIO, "packet under-read!");
}
else
sLog->outError(LOG_FILTER_GENERAL, "Addon packet uncompress error!");
@@ -1037,18 +1029,23 @@ void WorldSession::SendAddonsInfo()
data << uint32(0); /// @todo Find out the meaning of this.
}
uint8 unk3 = 0; // 0 is sent here
data << uint8(unk3);
if (unk3)
{
// String, length 256 (null terminated)
data << uint8(0);
}
data << uint8(0); // uses URL
//if (usesURL)
// data << uint8(0); // URL
}
m_addonsList.clear();
data << uint32(0); // count for an unknown for loop
AddonMgr::BannedAddonList const* bannedAddons = AddonMgr::GetBannedAddons();
data << uint32(bannedAddons->size());
for (AddonMgr::BannedAddonList::const_iterator itr = bannedAddons->begin(); itr != bannedAddons->end(); ++itr)
{
data << uint32(itr->Id);
data.append(itr->NameMD5, sizeof(itr->NameMD5));
data.append(itr->VersionMD5, sizeof(itr->VersionMD5));
data << uint32(itr->Timestamp);
data << uint32(1); // IsBanned
}
SendPacket(&data);
}