summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-02 22:56:43 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-02 22:56:43 +0300
commitdc599c219c283a4f7517c8ffe1e781b9847ef045 (patch)
tree3f5e0506900450d39ebc741e7cecc48997dbf34f /src/being
parent0f226f2e42c1a351d52eecdfca89e99f0358ee42 (diff)
downloadmv-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')
-rw-r--r--src/being/localplayer.cpp26
-rw-r--r--src/being/localplayer.h2
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);