summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-27 13:18:28 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-27 13:18:28 +0300
commitd53578d459fcc7fc9c5ab84a196c7f5a8238fc8e (patch)
tree8f83fc62a0bc58fef5a62bdb53e7bcf07f005a13 /src/actions
parent2981363fef524501a4a24a5f4c60661ebdee80fa (diff)
downloadplus-d53578d459fcc7fc9c5ab84a196c7f5a8238fc8e.tar.gz
plus-d53578d459fcc7fc9c5ab84a196c7f5a8238fc8e.tar.bz2
plus-d53578d459fcc7fc9c5ab84a196c7f5a8238fc8e.tar.xz
plus-d53578d459fcc7fc9c5ab84a196c7f5a8238fc8e.zip
Move chat command /url into actions.
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/commands.cpp16
-rw-r--r--src/actions/commands.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 018cca54a..ab116d805 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -75,6 +75,7 @@
#include "net/pethandler.h"
#include "net/net.h"
+#include "utils/chatutils.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -530,4 +531,19 @@ impHandler(setDrop)
return true;
}
+impHandler(url)
+{
+ if (event.tab)
+ {
+ std::string url = event.args;
+ if (!strStartWith(url, "http") && !strStartWith(url, "?"))
+ url = "http://" + url;
+ std::string str(strprintf("[@@%s |%s@@]",
+ url.c_str(), event.args.c_str()));
+ outStringNormal(event.tab, str, str);
+ return true;
+ }
+ return false;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index b171e49e2..d57f3d469 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -56,6 +56,7 @@ namespace Actions
decHandler(removeAttack);
decHandler(addIgnoreAttack);
decHandler(setDrop);
+ decHandler(url);
} // namespace Actions
#undef decHandler