diff options
-rw-r--r-- | src/commandhandler.cpp | 20 | ||||
-rw-r--r-- | src/gui/chat.cpp | 1 | ||||
-rw-r--r-- | src/localplayer.cpp | 65 | ||||
-rw-r--r-- | src/localplayer.h | 20 |
4 files changed, 1 insertions, 105 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index a39e13bd..878180e6 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -120,10 +120,6 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab) { handlePresent(args, tab); } - else if (type == "away") - { - handleAway(args, tab); - } else { tab->chatLog(_("Unknown command.")); @@ -171,9 +167,6 @@ void CommandHandler::handleHelp(const std::string &args, ChatTab *tab) "with another user")); tab->chatLog(_("/q > Alias of query")); - tab->chatLog(_("/away > Tell the other whispering players " - "you're away from keyboard.")); - tab->chatLog(_("/ignore > ignore a player")); tab->chatLog(_("/unignore > stop ignoring a player")); @@ -258,14 +251,6 @@ void CommandHandler::handleHelp(const std::string &args, ChatTab *tab) tab->chatLog(_("This command tries to make a tab for whispers between" "you and <nick>.")); } - else if (args == "away") - { - tab->chatLog(_("Command: /away <afk reason>")); - tab->chatLog(_("This command tells " - "you're away from keyboard with the given reason.")); - tab->chatLog(_("Command: /away")); - tab->chatLog(_("This command clears the away status and message.")); - } else if (args == "createparty") { tab->chatLog(_("Command: /createparty <name>")); @@ -525,8 +510,3 @@ void CommandHandler::handleUnignore(const std::string &args, ChatTab *tab) else tab->chatLog(_("Player could not be unignored!"), BY_SERVER); } - -void CommandHandler::handleAway(const std::string &args, ChatTab *tab) -{ - player_node->setAway(args); -} diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 8e0f5941..36125e60 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -482,7 +482,6 @@ void ChatWindow::whisper(const std::string &nick, else { tab->chatLog(nick, mes); - player_node->afkRespond(tab, nick); } } else diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 5861ca93..15f7e11d 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -84,15 +84,10 @@ LocalPlayer::LocalPlayer(int id, int subtype): mWalkingDir(0), mPathSetByMouse(false), mLocalWalkTime(-1), - mMessageTime(0), - mAwayDialog(0), - mAfkTime(0), - mAwayMode(false) + mMessageTime(0) { listen("Attributes"); - mAwayListener = new AwayListener(); - mUpdateName = true; config.addListener("showownname", this); @@ -104,9 +99,6 @@ LocalPlayer::LocalPlayer(int id, int subtype): LocalPlayer::~LocalPlayer() { config.removeListener("showownname", this); - - delete mAwayDialog; - delete mAwayListener; } void LocalPlayer::logic() @@ -1118,58 +1110,3 @@ void LocalPlayer::event(const std::string &channel, const Mana::Event &event) Being::event(channel, event); } - -void LocalPlayer::changeAwayMode() -{ - mAwayMode = !mAwayMode; - mAfkTime = 0; - if (mAwayMode) - { - mAwayDialog = new OkDialog(_("Away"), - config.getValue("afkMessage", "I am away from keyboard")); - mAwayDialog->addActionListener(mAwayListener); - } - - mAwayDialog = 0; -} - -void LocalPlayer::setAway(const std::string &message) -{ - if (!message.empty()) - config.setValue("afkMessage", message); - changeAwayMode(); -} - -void LocalPlayer::afkRespond(ChatTab *tab, const std::string &nick) -{ - if (mAwayMode) - { - if (mAfkTime == 0 - || cur_time < mAfkTime - || cur_time - mAfkTime > AWAY_LIMIT_TIMER) - { - std::string msg = "*AFK*: " - + config.getValue("afkMessage", "I am away from keyboard"); - - Net::getChatHandler()->privateMessage(nick, msg); - if (!tab) - { - localChatTab->chatLog(getName() + " : " + msg, - ACT_WHISPER, false); - } - else - { - tab->chatLog(getName(), msg); - } - mAfkTime = cur_time; - } - } -} - -void AwayListener::action(const gcn::ActionEvent &event) -{ - if (event.getId() == "ok" && player_node->getAwayMode()) - { - player_node->changeAwayMode(); - } -} diff --git a/src/localplayer.h b/src/localplayer.h index b008a739..41fc84a8 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -38,12 +38,6 @@ class Item; class Map; class OkDialog; -class AwayListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent &event); -}; - /** * The local player character. */ @@ -178,15 +172,6 @@ class LocalPlayer : public Being bool isPathSetByMouse() const { return mPathSetByMouse; } - void changeAwayMode(); - - bool getAwayMode() - { return mAwayMode; } - - void setAway(const std::string &message); - - void afkRespond(ChatTab *tab, const std::string &nick); - void addMessageToQueue(const std::string &message, int color = UserPalette::EXP_INFO); @@ -239,11 +224,6 @@ class LocalPlayer : public Being /** Queued messages*/ std::list<MessagePair> mMessages; int mMessageTime; - AwayListener *mAwayListener; - OkDialog *mAwayDialog; - - int mAfkTime; - bool mAwayMode; }; extern LocalPlayer *player_node; |