Also store type of avatar if an avatar is reported as inappropriate.
This commit is contained in:
@@ -81,7 +81,7 @@ ServerDBGeneric::EndGame(DB_id /*gameId*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerDBGeneric::AsyncReportAvatar(unsigned requestId, unsigned replyId, DB_id /*reportedPlayerId*/, const std::string &/*avatarHash*/, DB_id */*byPlayerId*/)
|
ServerDBGeneric::AsyncReportAvatar(unsigned requestId, unsigned replyId, DB_id /*reportedPlayerId*/, const std::string &/*avatarHash*/, const std::string &/*avatarType*/, DB_id */*byPlayerId*/)
|
||||||
{
|
{
|
||||||
m_ioService->post(boost::bind(&ServerDBCallback::ReportAvatarFailed, &m_callback, requestId, replyId));
|
m_ioService->post(boost::bind(&ServerDBCallback::ReportAvatarFailed, &m_callback, requestId, replyId));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
virtual void SetGamePlayerPlace(DB_id gameId, DB_id playerId, unsigned place);
|
virtual void SetGamePlayerPlace(DB_id gameId, DB_id playerId, unsigned place);
|
||||||
virtual void EndGame(DB_id gameId);
|
virtual void EndGame(DB_id gameId);
|
||||||
|
|
||||||
virtual void AsyncReportAvatar(unsigned requestId, unsigned replyId, DB_id reportedPlayerId, const std::string &avatarHash, DB_id *byPlayerId);
|
virtual void AsyncReportAvatar(unsigned requestId, unsigned replyId, DB_id reportedPlayerId, const std::string &avatarHash, const std::string &avatarType, DB_id *byPlayerId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<boost::asio::io_service> m_ioService;
|
boost::shared_ptr<boost::asio::io_service> m_ioService;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
virtual void SetGamePlayerPlace(DB_id gameId, DB_id playerId, unsigned place) = 0;
|
virtual void SetGamePlayerPlace(DB_id gameId, DB_id playerId, unsigned place) = 0;
|
||||||
virtual void EndGame(DB_id gameId) = 0;
|
virtual void EndGame(DB_id gameId) = 0;
|
||||||
|
|
||||||
virtual void AsyncReportAvatar(unsigned requestId, unsigned replyId, DB_id reportedPlayerId, const std::string &avatarHash, DB_id *byPlayerId) = 0;
|
virtual void AsyncReportAvatar(unsigned requestId, unsigned replyId, DB_id reportedPlayerId, const std::string &avatarHash, const std::string &avatarType, DB_id *byPlayerId) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
virtual void SetGamePlayerPlace(DB_id /*gameId*/, DB_id /*playerId*/, unsigned /*place*/) {}
|
virtual void SetGamePlayerPlace(DB_id /*gameId*/, DB_id /*playerId*/, unsigned /*place*/) {}
|
||||||
virtual void EndGame(DB_id /*gameId*/) {}
|
virtual void EndGame(DB_id /*gameId*/) {}
|
||||||
|
|
||||||
virtual void AsyncReportAvatar(unsigned /*requestId*/, unsigned /*replyId*/, DB_id /*reportedPlayerId*/, const std::string &/*avatarHash*/, DB_id */*byPlayerId*/) {}
|
virtual void AsyncReportAvatar(unsigned /*requestId*/, unsigned /*replyId*/, DB_id /*reportedPlayerId*/, const std::string &/*avatarHash*/, const std::string &/*avatarType*/, DB_id */*byPlayerId*/) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SERVERDBNOACTION_H_
|
#endif // _SERVERDBNOACTION_H_
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <net/net_helper.h>
|
#include <net/net_helper.h>
|
||||||
#include <db/serverdbinterface.h>
|
#include <db/serverdbinterface.h>
|
||||||
#include <core/loghelper.h>
|
#include <core/loghelper.h>
|
||||||
|
#include <core/avatarmanager.h>
|
||||||
#include <gamedata.h>
|
#include <gamedata.h>
|
||||||
#include <game.h>
|
#include <game.h>
|
||||||
#include <playerinterface.h>
|
#include <playerinterface.h>
|
||||||
@@ -310,7 +311,7 @@ AbstractServerGameStateReceiving::ProcessPacket(boost::shared_ptr<ServerGame> se
|
|||||||
boost::shared_ptr<PlayerData> tmpPlayer = server->GetPlayerDataByUniqueId(netReport->reportedPlayerId);
|
boost::shared_ptr<PlayerData> tmpPlayer = server->GetPlayerDataByUniqueId(netReport->reportedPlayerId);
|
||||||
MD5Buf tmpMD5;
|
MD5Buf tmpMD5;
|
||||||
memcpy(tmpMD5.GetData(), netReport->reportedAvatar.buf, MD5_DATA_SIZE);
|
memcpy(tmpMD5.GetData(), netReport->reportedAvatar.buf, MD5_DATA_SIZE);
|
||||||
if (tmpPlayer && tmpPlayer->GetDBId() && tmpPlayer->GetAvatarMD5() == tmpMD5)
|
if (tmpPlayer && tmpPlayer->GetDBId() && !tmpMD5.IsZero() && tmpPlayer->GetAvatarMD5() == tmpMD5)
|
||||||
{
|
{
|
||||||
if (!server->IsAvatarReported(tmpPlayer->GetUniqueId()))
|
if (!server->IsAvatarReported(tmpPlayer->GetUniqueId()))
|
||||||
{
|
{
|
||||||
@@ -321,11 +322,18 @@ AbstractServerGameStateReceiving::ProcessPacket(boost::shared_ptr<ServerGame> se
|
|||||||
// Do not use the "game" database object, but the global one.
|
// Do not use the "game" database object, but the global one.
|
||||||
// The entry should be created even if we are not running a
|
// The entry should be created even if we are not running a
|
||||||
// ranking game.
|
// ranking game.
|
||||||
|
|
||||||
|
string tmpAvatarType;
|
||||||
|
tmpAvatarType = AvatarManager::GetAvatarFileExtension(AvatarManager::GetAvatarFileType(tmpPlayer->GetAvatarFile()));
|
||||||
|
if (!tmpAvatarType.empty())
|
||||||
|
tmpAvatarType.erase(0, 1); // Only store extension without the "."
|
||||||
|
|
||||||
server->GetLobbyThread().GetDatabase()->AsyncReportAvatar(
|
server->GetLobbyThread().GetDatabase()->AsyncReportAvatar(
|
||||||
session.playerData->GetUniqueId(),
|
session.playerData->GetUniqueId(),
|
||||||
tmpPlayer->GetUniqueId(),
|
tmpPlayer->GetUniqueId(),
|
||||||
tmpPlayer->GetDBId(),
|
tmpPlayer->GetDBId(),
|
||||||
tmpPlayer->GetAvatarMD5().ToString(),
|
tmpPlayer->GetAvatarMD5().ToString(),
|
||||||
|
tmpAvatarType,
|
||||||
myDBid != 0 ? &myDBid : NULL
|
myDBid != 0 ? &myDBid : NULL
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user