Skip to content

Commit

Permalink
Add /clear chat command
Browse files Browse the repository at this point in the history
  • Loading branch information
macabeus committed Jan 25, 2022
1 parent 338c3f7 commit 0f66a83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/chat_command_handler.cpp
Expand Up @@ -15,6 +15,7 @@
#include "chat_command_handler.hpp"

#include "chat_events.hpp"
#include "game_display.hpp"
#include "game_initialization/multiplayer.hpp"
#include "game_version.hpp"
#include "gui/dialogs/preferences_dialog.hpp"
Expand Down Expand Up @@ -135,4 +136,8 @@ void chat_command_handler::do_info() {
chat_handler_.send_to_server(data);
}

void chat_command_handler::do_clear() {
game_display::get_singleton()->get_chat_manager().clear_chat_messages();
}

}
3 changes: 3 additions & 0 deletions src/chat_command_handler.hpp
Expand Up @@ -40,6 +40,7 @@ class chat_command_handler : public map_command_handler<chat_command_handler>
void do_remove();
void do_display();
void do_version();
void do_clear();

/** Request information about a user from the server. */
void do_info();
Expand Down Expand Up @@ -113,6 +114,8 @@ class chat_command_handler : public map_command_handler<chat_command_handler>
_("Display version information."));
register_command("info", &chat_command_handler::do_info,
_("Request information about a nickname."), _("<nickname>"));
register_command("clear", &chat_command_handler::do_clear,
_("Clear chat history."));
}
private:
chat_handler& chat_handler_;
Expand Down

0 comments on commit 0f66a83

Please sign in to comment.