diff --git a/CMakeLists.txt b/CMakeLists.txt index 00dd928e..ca15a7a1 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ set(EnableTextmodeStdin 0 CACHE BOOL "Textmode Stdin -> Console bridge (EXPERIME set(EnableWarnings 0 CACHE BOOL "Enable compile warnings") set(EnableNullGraphics 0 CACHE BOOL "Enable experimental textmode hooks (CRASHES)") set(EnableOnlineFeatures 0 CACHE BOOL "Enable online features (WIP)") +set(EnableIRC 1 CACHE BOOL "Enable IRC for messaging and ignore-cathook") if(NOT EnableVisuals) set(EnableGUI 0) diff --git a/include/config.h.in b/include/config.h.in index ae03b13e..6d4e82fd 100755 --- a/include/config.h.in +++ b/include/config.h.in @@ -17,3 +17,4 @@ #define TEXTMODE @Textmode@ #define ENABLE_PROFILER @EnableProfiler@ #define ENABLE_ONLINE @EnableOnlineFeatures@ +#define ENABLE_IRC @EnableIRC@ diff --git a/include/irc.hpp b/include/irc.hpp index 59dbc458..39aa2609 100644 --- a/include/irc.hpp +++ b/include/irc.hpp @@ -1,3 +1,5 @@ +#include "config.h" +#if ENABLE_IRC #include namespace IRC @@ -5,3 +7,4 @@ namespace IRC bool sendmsg(std::string &msg, bool loopback = false); void auth(bool reply = false); } // namespace IRC +#endif diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index 4d8b928c..1966c6d8 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -287,7 +287,9 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs // hacks::tf2::NavBot::Init(); // hacks::tf2::NavBot::initonce(); nav::status = nav::off; +#if ENABLE_IRC IRC::auth(); +#endif hacks::tf2::NavBot::init(true); firstcm = false; } diff --git a/src/hooks/SendNetMsg.cpp b/src/hooks/SendNetMsg.cpp index 3f894615..fb1ae534 100644 --- a/src/hooks/SendNetMsg.cpp +++ b/src/hooks/SendNetMsg.cpp @@ -48,7 +48,9 @@ DEFINE_HOOKED_METHOD(SendNetMsg, bool, INetChannel *this_, INetMessage &msg, boo if (msg.find("!!!") == 0) sub_val = 3; std::string substrmsg(msg.substr(sub_val)); +#if ENABLE_IRC IRC::sendmsg(substrmsg, true); +#endif // Do not send message over normal chat. return false; } diff --git a/src/irc.cpp b/src/irc.cpp index 25fc2e8b..ec28af26 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -1,3 +1,5 @@ +#include "config.h" +#if ENABLE_IRC #include "common.hpp" #include "irc.hpp" #include "CatBot.hpp" @@ -427,3 +429,4 @@ static CatCommand irc_send("irc_send", "Send message to IRC", [](const CCommand static CatCommand irc_auth("irc_auth", "Auth via IRC (Find users on same server)", []() { auth(); }); } // namespace IRC +#endif