summaryrefslogtreecommitdiff
path: root/src/actions/commands.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-26 00:53:29 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-26 00:53:29 +0300
commite2dddbdd9599b9b1f6a9825ee06d4d3616d9d1dd (patch)
treeee5204871bd3fe6bdc5638d7ee95a75ceb8efe95 /src/actions/commands.cpp
parent6e99f459bf4895e41118dbcf00ed3ba027b5b952 (diff)
downloadplus-e2dddbdd9599b9b1f6a9825ee06d4d3616d9d1dd.tar.gz
plus-e2dddbdd9599b9b1f6a9825ee06d4d3616d9d1dd.tar.bz2
plus-e2dddbdd9599b9b1f6a9825ee06d4d3616d9d1dd.tar.xz
plus-e2dddbdd9599b9b1f6a9825ee06d4d3616d9d1dd.zip
Move chat command /follow into actions.
Diffstat (limited to 'src/actions/commands.cpp')
-rw-r--r--src/actions/commands.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index e32aee7a3..5038d9f57 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -21,6 +21,7 @@
#include "actions/commands.h"
#include "actormanager.h"
+#include "configuration.h"
#include "dropshortcut.h"
#include "emoteshortcut.h"
#include "game.h"
@@ -368,4 +369,29 @@ impHandler(pseudoAway)
return false;
}
+impHandler(follow)
+{
+ if (!localPlayer)
+ return false;
+
+ if (!features.getBoolValue("allowFollow"))
+ return false;
+
+ if (!event.args.empty())
+ {
+ localPlayer->setFollow(event.args);
+ }
+ else if (event.tab && event.tab->getType() == ChatTabType::WHISPER)
+ {
+ localPlayer->setFollow(static_cast<WhisperTab*>(event.tab)->getNick());
+ }
+ else
+ {
+ const Being *const being = localPlayer->getTarget();
+ if (being != nullptr)
+ localPlayer->setFollow(being->getName());
+ }
+ return true;
+}
+
} // namespace Actions