Enabling banning a player from the client (as admin).
This commit is contained in:
@@ -2226,7 +2226,7 @@ void gameLobbyDialogImpl::adminActionTotalKickBan()
|
||||
tr("Are you sure you want to total kickban the player: \"%1\"?").arg(QString::fromUtf8(info.playerName.c_str())), QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if(ret == QMessageBox::Yes) {
|
||||
// TODO mySession->adminActionTotalKickBan(playerId);
|
||||
mySession->adminActionBanPlayer(playerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ public:
|
||||
void SendReportAvatar(unsigned reportedPlayerId, const std::string &avatarHash);
|
||||
void SendReportGameName(unsigned reportedGameId);
|
||||
void SendAdminRemoveGame(unsigned removeGameId);
|
||||
void SendAdminBanPlayer(unsigned playerId);
|
||||
|
||||
void StartAsyncRead();
|
||||
virtual void CloseSession(boost::shared_ptr<SessionData> session);
|
||||
|
||||
@@ -386,6 +386,16 @@ ClientThread::SendAdminRemoveGame(unsigned removeGameId)
|
||||
m_ioService->post(boost::bind(&ClientThread::SendSessionPacket, shared_from_this(), packet));
|
||||
}
|
||||
|
||||
void
|
||||
ClientThread::SendAdminBanPlayer(unsigned playerId)
|
||||
{
|
||||
boost::shared_ptr<NetPacket> packet(new NetPacket);
|
||||
packet->GetMsg()->set_messagetype(PokerTHMessage::Type_AdminBanPlayerMessage);
|
||||
AdminBanPlayerMessage *netBan = packet->GetMsg()->mutable_adminbanplayermessage();
|
||||
netBan->set_banplayerid(playerId);
|
||||
m_ioService->post(boost::bind(&ClientThread::SendSessionPacket, shared_from_this(), packet));
|
||||
}
|
||||
|
||||
void
|
||||
ClientThread::StartAsyncRead()
|
||||
{
|
||||
|
||||
@@ -427,6 +427,13 @@ void Session::adminActionCloseGame(unsigned gameId)
|
||||
myNetClient->SendAdminRemoveGame(gameId);
|
||||
}
|
||||
|
||||
void Session::adminActionBanPlayer(unsigned playerId)
|
||||
{
|
||||
if (!myNetClient)
|
||||
return; // only act if client is running.
|
||||
myNetClient->SendAdminBanPlayer(playerId);
|
||||
}
|
||||
|
||||
void Session::kickPlayer(const string &playerName)
|
||||
{
|
||||
if (!myNetClient)
|
||||
|
||||
@@ -113,6 +113,7 @@ public:
|
||||
|
||||
void reportBadAvatar(unsigned reportedPlayerId, const std::string &avatarHash);
|
||||
void reportBadGameName(unsigned gameId);
|
||||
void adminActionBanPlayer(unsigned playerId);
|
||||
|
||||
void resetNetworkTimeout();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user