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
|
else
|
||||||
m_ircAdminThread->SendChatMessage(nickName + ": Player \"" + playerName + "\" was not found on the server.");
|
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") {
|
} else if (command == "cleaner-reconnect") {
|
||||||
GetLobbyThread().ReconnectChatBot();
|
GetLobbyThread().ReconnectChatBot();
|
||||||
m_ircAdminThread->SendChatMessage(nickName + ": Cleaner bot reconnect initiated.");
|
m_ircAdminThread->SendChatMessage(nickName + ": Cleaner bot reconnect initiated.");
|
||||||
|
|||||||
@@ -509,6 +509,23 @@ ServerLobbyThread::KickPlayerByName(const std::string &playerName)
|
|||||||
return retVal;
|
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
|
string
|
||||||
ServerLobbyThread::GetPlayerIPAddress(const std::string &playerName) const
|
ServerLobbyThread::GetPlayerIPAddress(const std::string &playerName) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ public:
|
|||||||
void HandleChatRequest(boost::shared_ptr<SessionData> session, const ChatRequestMessage_t &chatRequest);
|
void HandleChatRequest(boost::shared_ptr<SessionData> session, const ChatRequestMessage_t &chatRequest);
|
||||||
|
|
||||||
bool KickPlayerByName(const std::string &playerName);
|
bool KickPlayerByName(const std::string &playerName);
|
||||||
|
bool RemoveGameByPlayerName(const std::string &playerName);
|
||||||
std::string GetPlayerIPAddress(const std::string &playerName) const;
|
std::string GetPlayerIPAddress(const std::string &playerName) const;
|
||||||
std::string GetPlayerNameFromId(unsigned playerId) const;
|
std::string GetPlayerNameFromId(unsigned playerId) const;
|
||||||
void RemovePlayer(unsigned playerId, unsigned errorCode);
|
void RemovePlayer(unsigned playerId, unsigned errorCode);
|
||||||
|
|||||||
Reference in New Issue
Block a user