Skip to content

Commit

Permalink
Made ;friend <empty> and ;ignore <empty> open prefs to friends list (…
Browse files Browse the repository at this point in the history
…bug #24244)

This also removed ;list and its alias ;display
  • Loading branch information
Vultraz committed Mar 3, 2016
1 parent 3d0f136 commit c07d0d2
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions src/menu_events.cpp
Expand Up @@ -34,6 +34,7 @@
#include "formatter.hpp"
#include "formula_string_utils.hpp"
#include "game_board.hpp"
#include "game_config_manager.hpp"
#include "game_end_exceptions.hpp"
#include "game_events/manager.hpp"
#include "game_events/pump.hpp"
Expand Down Expand Up @@ -1770,9 +1771,6 @@ class chat_command_handler : public map_command_handler<chat_command_handler>
_("Add a nickname to your friends list."), _("<nickname>"));
register_command("remove", &chat_command_handler::do_remove,
_("Remove a nickname from your ignores or friends list."), _("<nickname>"));
register_command("list", &chat_command_handler::do_display,
_("Show your ignores and friends list."));
register_alias("list", "display");
register_command("version", &chat_command_handler::do_version,
_("Display version information."));
register_command("register", &chat_command_handler::do_register,
Expand Down Expand Up @@ -1934,7 +1932,6 @@ class console_handler : public map_command_handler<console_handler>, private cha
chmap::get_command("version")->flags = ""; //clear network-only flag
chmap::get_command("ignore")->flags = ""; //clear network-only flag
chmap::get_command("friend")->flags = ""; //clear network-only flag
chmap::get_command("list")->flags = ""; //clear network-only flag
chmap::get_command("remove")->flags = ""; //clear network-only flag
chmap::set_cmd_prefix(":");
register_command("refresh", &console_handler::do_refresh,
Expand Down Expand Up @@ -2271,8 +2268,7 @@ void chat_command_handler::do_log()
void chat_command_handler::do_ignore()
{
if (get_arg(1).empty()) {
const std::map<std::string, std::string>& tmp = preferences::get_acquaintances_nice("ignore");
print(_("ignores list"), tmp.empty() ? _("(empty)") : utils::join_map(tmp, ")\n", " (") + ")");
do_display();
} else {
utils::string_map symbols;
symbols["nick"] = get_arg(1);
Expand All @@ -2289,8 +2285,7 @@ void chat_command_handler::do_ignore()
void chat_command_handler::do_friend()
{
if (get_arg(1).empty()) {
const std::map<std::string, std::string>& tmp = preferences::get_acquaintances_nice("friend");
print(_("friends list"), tmp.empty() ? _("(empty)") : utils::join_map(tmp, ")\n", " (") + ")");
do_display();
} else {
utils::string_map symbols;
symbols["nick"] = get_arg(1);
Expand All @@ -2317,20 +2312,9 @@ void chat_command_handler::do_remove()

void chat_command_handler::do_display()
{
const std::map<std::string, std::string>& friends = preferences::get_acquaintances_nice("friend");
const std::map<std::string, std::string>& ignores = preferences::get_acquaintances_nice("ignore");

if (!friends.empty()) {
print(_("friends list"), utils::join_map(friends, ")\n", " (") + ")");
}

if (!ignores.empty()) {
print(_("ignores list"), utils::join_map(ignores, ")\n", " (") + ")");
}

if (friends.empty() && ignores.empty()) {
print(_("friends and ignores list"), _("There are no players on your friends or ignore list."));
}
// TODO: add video and game config argument to chat_command_handler?
preferences::show_preferences_dialog(CVideo::get_singleton(),
game_config_manager::get()->game_config(), preferences::VIEW_FRIENDS);
}

void chat_command_handler::do_version() {
Expand Down

0 comments on commit c07d0d2

Please sign in to comment.