From d53578d459fcc7fc9c5ab84a196c7f5a8238fc8e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 27 Aug 2014 13:18:28 +0300 Subject: Move chat command /url into actions. --- src/actions/commands.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/actions/commands.cpp') 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 -- cgit v1.2.3-60-g2f50