diff --git a/cockatrice/src/tab_game.cpp b/cockatrice/src/tab_game.cpp index 92c50c1b..85fa44a3 100644 --- a/cockatrice/src/tab_game.cpp +++ b/cockatrice/src/tab_game.cpp @@ -837,6 +837,8 @@ void TabGame::sendGameCommand(PendingCommand *pend, int playerId) AbstractClient *client = getClientForPlayer(playerId); if (!client) return; + + connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(commandFinished(const Response &))); client->sendCommand(pend); } @@ -845,7 +847,16 @@ void TabGame::sendGameCommand(const google::protobuf::Message &command, int play AbstractClient *client = getClientForPlayer(playerId); if (!client) return; - client->sendCommand(prepareGameCommand(command)); + + PendingCommand *pend = prepareGameCommand(command); + connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(commandFinished(const Response &))); + client->sendCommand(pend); +} + +void TabGame::commandFinished(const Response &response) +{ + if (response.response_code() == Response::RespChatFlood) + messageLog->appendMessage(tr("You are flooding the game. Please wait a couple of seconds.")); } PendingCommand *TabGame::prepareGameCommand(const ::google::protobuf::Message &cmd) diff --git a/cockatrice/src/tab_game.h b/cockatrice/src/tab_game.h index 1b9bff5f..cd2fcb0f 100644 --- a/cockatrice/src/tab_game.h +++ b/cockatrice/src/tab_game.h @@ -198,6 +198,7 @@ private slots: void actNextTurn(); void addMentionTag(QString value); + void commandFinished(const Response &response); public: TabGame(TabSupervisor *_tabSupervisor, QList &_clients, const Event_GameJoined &event, const QMap &_roomGameTypes); TabGame(TabSupervisor *_tabSupervisor, GameReplay *replay);