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/localplayer.cpp | |
parent | 0f226f2e42c1a351d52eecdfca89e99f0358ee42 (diff) | |
download | mv-dc599c219c283a4f7517c8ffe1e781b9847ef045.tar.gz mv-dc599c219c283a4f7517c8ffe1e781b9847ef045.tar.bz2 mv-dc599c219c283a4f7517c8ffe1e781b9847ef045.tar.xz mv-dc599c219c283a4f7517c8ffe1e781b9847ef045.zip |
add support for /me command inside /away comand.
Example:
/away /me sleeping
Diffstat (limited to 'src/being/localplayer.cpp')
-rw-r--r-- | src/being/localplayer.cpp | 26 |
1 files changed, 22 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); |