New admin function to remove a complete game by any player name within that game (#115).
This commit is contained in:
@@ -84,6 +84,16 @@ ServerAdminBot::SignalIrcChatMsg(const std::string &nickName, const std::string
|
||||
else
|
||||
m_ircAdminThread->SendChatMessage(nickName + ": Player \"" + playerName + "\" was not found on the server.");
|
||||
}
|
||||
} else if (command == "removegame") {
|
||||
while (msgStream.peek() == ' ')
|
||||
msgStream.get();
|
||||
string playerName(msgStream.str().substr(msgStream.tellg()));
|
||||
if (!playerName.empty()) {
|
||||
if (GetLobbyThread().RemoveGameByPlayerName(playerName))
|
||||
m_ircAdminThread->SendChatMessage(nickName + ": Successfully removed game of player \"" + playerName + "\".");
|
||||
else
|
||||
m_ircAdminThread->SendChatMessage(nickName + ": Player \"" + playerName + "\" is currently not playing a game.");
|
||||
}
|
||||
} else if (command == "cleaner-reconnect") {
|
||||
GetLobbyThread().ReconnectChatBot();
|
||||
m_ircAdminThread->SendChatMessage(nickName + ": Cleaner bot reconnect initiated.");
|
||||
|
||||
@@ -509,6 +509,23 @@ ServerLobbyThread::KickPlayerByName(const std::string &playerName)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool
|
||||
ServerLobbyThread::RemoveGameByPlayerName(const std::string &playerName)
|
||||
{
|
||||
bool retVal = false;
|
||||
boost::shared_ptr<SessionData> session = m_gameSessionManager.GetSessionByPlayerName(playerName);
|
||||
|
||||
if (session) {
|
||||
boost::shared_ptr<ServerGame> game = session->GetGame();
|
||||
if (game) {
|
||||
m_ioService->post(boost::bind(&ServerLobbyThread::InternalRemoveGame, shared_from_this(), game));
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
string
|
||||
ServerLobbyThread::GetPlayerIPAddress(const std::string &playerName) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user