rebuilt log irc functionality

dev
Tom Early 5 years ago
parent 4e36a76997
commit 42b5bb6cc2

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2010 by Scott Lawson KI4LKF * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -54,7 +54,7 @@
#define CFG_DIR "/usr/local/etc" #define CFG_DIR "/usr/local/etc"
#endif #endif
const std::string GW_VERSION("QnetGateway-810"); const std::string GW_VERSION("QnetGateway-10203");
int CQnetGateway::FindIndex(const int i) const int CQnetGateway::FindIndex(const int i) const
{ {
@ -2672,7 +2672,7 @@ bool CQnetGateway::Init(char *cfgfile)
{ {
if (ircddb[j].ip.empty()) if (ircddb[j].ip.empty())
continue; 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(); bool ok = ii[j]->open();
if (!ok) if (!ok)
{ {

@ -4,12 +4,12 @@
#include "IRCDDBApp.h" #include "IRCDDBApp.h"
#include "IRCutils.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"); 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); client = new IRCClient(app, update_channel, hostName, port, callsign, password, versionInfo);
} }

@ -23,7 +23,7 @@ class IRCClient;
class CIRCDDB class CIRCDDB
{ {
public: 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(); ~CIRCDDB();
// returns the socket family type // returns the socket family type

@ -7,7 +7,7 @@
#include "IRCDDBApp.h" #include "IRCDDBApp.h"
#include "IRCutils.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; updateChannel = u_chan;
this->cache = cache; this->cache = cache;
@ -18,7 +18,7 @@ IRCDDBApp::IRCDDBApp(const std::string &u_chan, CCacheManager *cache) : numberOf
state = 0; state = 0;
timer = 0; timer = 0;
myNick = "none"; myNick = "none";
logIRC = log_irc;
terminateThread = false; terminateThread = false;
tablePattern = std::regex("^[0-9]$"); 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'); gate.push_back('G');
cache->updateName(name, nick); cache->updateName(name, nick);
cache->updateGate(gate, addr); 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) void IRCDDBApp::userLeave(const std::string &nick)
@ -498,6 +500,8 @@ void IRCDDBApp::doUpdate(std::string &msg)
ReplaceChar(gate, '_', ' '); ReplaceChar(gate, '_', ' ');
gate[7] = 'G'; gate[7] = 'G';
cache->updateRptr(rptr, gate, ""); cache->updateRptr(rptr, gate, "");
if (logIRC)
printf("Update RPTR %s --> %s\n", rptr.c_str(), gate.c_str());
if (rtime > maxTime) if (rtime > maxTime)
maxTime = rtime; maxTime = rtime;
} }
@ -511,7 +515,8 @@ void IRCDDBApp::doUpdate(std::string &msg)
ReplaceChar(rptr, '_', ' '); ReplaceChar(rptr, '_', ' ');
cache->updateUser(user, rptr, "", "", tstr); cache->updateUser(user, rptr, "", "", tstr);
if (logIRC)
printf("Update USER: %s --> %s at %s\n", user.c_str(), rptr.c_str(), tstr.c_str());
} }
} }
} }

@ -12,7 +12,7 @@
class IRCDDBApp class IRCDDBApp
{ {
public: public:
IRCDDBApp(const std::string &update_channel, CCacheManager *cache); IRCDDBApp(const std::string &update_channel, CCacheManager *cache, bool log_irc);
~IRCDDBApp(); ~IRCDDBApp();
void userJoin(const std::string &nick, const std::string &name, const std::string &host); void userJoin(const std::string &nick, const std::string &name, const std::string &host);
@ -95,4 +95,5 @@ private:
bool initReady; bool initReady;
bool terminateThread; bool terminateThread;
bool logIRC;
}; };

Loading…
Cancel
Save

Powered by TurnKey Linux.