Add cmake option to disable IRC

This commit is contained in:
TotallyNotElite 2018-12-05 13:15:54 +01:00
parent 4a8ac7a489
commit 1c27a0fda7
6 changed files with 12 additions and 0 deletions

View File

@ -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)

View File

@ -17,3 +17,4 @@
#define TEXTMODE @Textmode@
#define ENABLE_PROFILER @EnableProfiler@
#define ENABLE_ONLINE @EnableOnlineFeatures@
#define ENABLE_IRC @EnableIRC@

View File

@ -1,3 +1,5 @@
#include "config.h"
#if ENABLE_IRC
#include <string>
namespace IRC
@ -5,3 +7,4 @@ namespace IRC
bool sendmsg(std::string &msg, bool loopback = false);
void auth(bool reply = false);
} // namespace IRC
#endif

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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