summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/being/localplayer.cpp26
-rw-r--r--src/being/localplayer.h2
-rw-r--r--src/defaults.cpp1
3 files changed, 25 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);
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 6e44aa36f..40b8fec66 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -98,6 +98,7 @@ DefaultsData* getConfigDefaults()
AddDEF("disableGameModifiers", false);
AddDEF("targetDeadPlayers", false);
AddDEF("afkMessage", "I am away from keyboard.");
+ AddDEF("afkFormat", 0);
AddDEF("particleMaxCount", 3000);
AddDEF("particleFastPhysics", 1);
AddDEF("particleEmitterSkip", 1);