diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-02 22:56:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-02 22:56:43 +0300 |
commit | dc599c219c283a4f7517c8ffe1e781b9847ef045 (patch) | |
tree | 3f5e0506900450d39ebc741e7cecc48997dbf34f /src/being | |
parent | 0f226f2e42c1a351d52eecdfca89e99f0358ee42 (diff) | |
download | manaverse-dc599c219c283a4f7517c8ffe1e781b9847ef045.tar.gz manaverse-dc599c219c283a4f7517c8ffe1e781b9847ef045.tar.bz2 manaverse-dc599c219c283a4f7517c8ffe1e781b9847ef045.tar.xz manaverse-dc599c219c283a4f7517c8ffe1e781b9847ef045.zip |
add support for /me command inside /away comand.
Example:
/away /me sleeping
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/localplayer.cpp | 26 | ||||
-rw-r--r-- | src/being/localplayer.h | 2 |
2 files changed, 24 insertions, 4 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 3da2f7ed9..de2f3f30c 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -3507,16 +3507,31 @@ void LocalPlayer::tryPingRequest() void LocalPlayer::setAway(const std::string &message) { - if (!message.empty()) - config.setValue("afkMessage", message); + setAfkMessage(message); changeAwayMode(); updateStatus(); } -void LocalPlayer::setPseudoAway(const std::string &message) +void LocalPlayer::setAfkMessage(std::string message) { if (!message.empty()) + { + if (message.size() > 4 && message.substr(0, 4) == "/me ") + { + message = message.substr(4); + config.setValue("afkFormat", 1); + } + else + { + config.setValue("afkFormat", 0); + } config.setValue("afkMessage", message); + } +} + +void LocalPlayer::setPseudoAway(const std::string &message) +{ + setAfkMessage(message); mPseudoAwayMode = !mPseudoAwayMode; } @@ -3528,9 +3543,12 @@ void LocalPlayer::afkRespond(ChatTab *const tab, const std::string &nick) if (mAfkTime == 0 || time < mAfkTime || time - mAfkTime > awayLimitTimer) { - const std::string msg("*AFK*: " + std::string msg("*AFK*: " + config.getStringValue("afkMessage")); + if (config.getIntValue("afkFormat") == 1) + msg = "*" + msg + "*"; + if (!tab) { Net::getChatHandler()->privateMessage(nick, msg); diff --git a/src/being/localplayer.h b/src/being/localplayer.h index adf712187..735c4b58c 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -330,6 +330,8 @@ class LocalPlayer final : public Being, void afkRespond(ChatTab *const tab, const std::string &nick); + void setAfkMessage(std::string message); + bool navigateTo(const int x, const int y); void navigateTo(const Being *const being); |