diff --git a/QnetGateway.cpp b/QnetGateway.cpp index 6485cc3..f02efe9 100644 --- a/QnetGateway.cpp +++ b/QnetGateway.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2010 by Scott Lawson KI4LKF - * Copyright (C) 2017-2020 by Thomas Early N7TAE + * Copyright (C) 2017-2021 by Thomas Early N7TAE * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ #define CFG_DIR "/usr/local/etc" #endif -const std::string GW_VERSION("QnetGateway-810"); +const std::string GW_VERSION("QnetGateway-10203"); int CQnetGateway::FindIndex(const int i) const { @@ -2672,7 +2672,7 @@ bool CQnetGateway::Init(char *cfgfile) { if (ircddb[j].ip.empty()) continue; - ii[j] = new CIRCDDB(ircddb[j].ip, ircddb[j].port, owner, IRCDDB_PASSWORD[j], GW_VERSION.c_str()); + ii[j] = new CIRCDDB(ircddb[j].ip, ircddb[j].port, owner, IRCDDB_PASSWORD[j], GW_VERSION.c_str(), LOG_IRC); bool ok = ii[j]->open(); if (!ok) { diff --git a/ircddb/IRCDDB.cpp b/ircddb/IRCDDB.cpp index ed24939..2505960 100644 --- a/ircddb/IRCDDB.cpp +++ b/ircddb/IRCDDB.cpp @@ -4,12 +4,12 @@ #include "IRCDDBApp.h" #include "IRCutils.h" -CIRCDDB::CIRCDDB(const std::string &hostName, unsigned int port, const std::string &callsign, const std::string &password, const std::string &versionInfo) +CIRCDDB::CIRCDDB(const std::string &hostName, unsigned int port, const std::string &callsign, const std::string &password, const std::string &versionInfo, bool log_irc) { const std::string update_channel("#dstar"); - app = new IRCDDBApp(update_channel, &cache); + app = new IRCDDBApp(update_channel, &cache, log_irc); client = new IRCClient(app, update_channel, hostName, port, callsign, password, versionInfo); } diff --git a/ircddb/IRCDDB.h b/ircddb/IRCDDB.h index 0565eb9..863cb5c 100644 --- a/ircddb/IRCDDB.h +++ b/ircddb/IRCDDB.h @@ -23,7 +23,7 @@ class IRCClient; class CIRCDDB { public: - CIRCDDB(const std::string &hostName, unsigned int port, const std::string &callsign, const std::string &password, const std::string &versionInfo); + CIRCDDB(const std::string &hostName, unsigned int port, const std::string &callsign, const std::string &password, const std::string &versionInfo, bool log_irc); ~CIRCDDB(); // returns the socket family type diff --git a/ircddb/IRCDDBApp.cpp b/ircddb/IRCDDBApp.cpp index dfef825..2aa2633 100644 --- a/ircddb/IRCDDBApp.cpp +++ b/ircddb/IRCDDBApp.cpp @@ -7,7 +7,7 @@ #include "IRCDDBApp.h" #include "IRCutils.h" -IRCDDBApp::IRCDDBApp(const std::string &u_chan, CCacheManager *cache) : numberOfTables(2) +IRCDDBApp::IRCDDBApp(const std::string &u_chan, CCacheManager *cache, bool log_irc) : numberOfTables(2) { updateChannel = u_chan; this->cache = cache; @@ -18,7 +18,7 @@ IRCDDBApp::IRCDDBApp(const std::string &u_chan, CCacheManager *cache) : numberOf state = 0; timer = 0; myNick = "none"; - + logIRC = log_irc; terminateThread = false; tablePattern = std::regex("^[0-9]$"); @@ -196,6 +196,8 @@ void IRCDDBApp::userJoin(const std::string &nick, const std::string &name, const gate.push_back('G'); cache->updateName(name, nick); cache->updateGate(gate, addr); + if (logIRC) + printf("Update GATE: %s --> %s\n", gate.c_str(), addr.c_str()); } void IRCDDBApp::userLeave(const std::string &nick) @@ -498,6 +500,8 @@ void IRCDDBApp::doUpdate(std::string &msg) ReplaceChar(gate, '_', ' '); gate[7] = 'G'; cache->updateRptr(rptr, gate, ""); + if (logIRC) + printf("Update RPTR %s --> %s\n", rptr.c_str(), gate.c_str()); if (rtime > maxTime) maxTime = rtime; } @@ -511,7 +515,8 @@ void IRCDDBApp::doUpdate(std::string &msg) ReplaceChar(rptr, '_', ' '); cache->updateUser(user, rptr, "", "", tstr); - + if (logIRC) + printf("Update USER: %s --> %s at %s\n", user.c_str(), rptr.c_str(), tstr.c_str()); } } } diff --git a/ircddb/IRCDDBApp.h b/ircddb/IRCDDBApp.h index 3534e7e..5a77367 100644 --- a/ircddb/IRCDDBApp.h +++ b/ircddb/IRCDDBApp.h @@ -12,7 +12,7 @@ class IRCDDBApp { public: - IRCDDBApp(const std::string &update_channel, CCacheManager *cache); + IRCDDBApp(const std::string &update_channel, CCacheManager *cache, bool log_irc); ~IRCDDBApp(); void userJoin(const std::string &nick, const std::string &name, const std::string &host); @@ -95,4 +95,5 @@ private: bool initReady; bool terminateThread; + bool logIRC; };