Enabling banning a player from the client (as admin).

This commit is contained in:
lotodore
2013-02-28 20:38:37 +01:00
parent 44b90f9433
commit 0052de02e1
5 changed files with 20 additions and 1 deletions
@@ -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);
}
}
}
+1
View File
@@ -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);
+10
View File
@@ -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()
{
+7
View File
@@ -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)
+1
View File
@@ -113,6 +113,7 @@ public:
void reportBadAvatar(unsigned reportedPlayerId, const std::string &avatarHash);
void reportBadGameName(unsigned gameId);
void adminActionBanPlayer(unsigned playerId);
void resetNetworkTimeout();