|
|
|
@ -177,7 +177,7 @@ void IRCDDBApp::rptrQTH(const std::string& callsign, double latitude, double lon
|
|
|
|
CUtils::ReplaceChar(d2, ' ', '_');
|
|
|
|
CUtils::ReplaceChar(d2, ' ', '_');
|
|
|
|
CUtils::ReplaceChar(cs, ' ', '_');
|
|
|
|
CUtils::ReplaceChar(cs, ' ', '_');
|
|
|
|
|
|
|
|
|
|
|
|
d->moduleQTHURLMutex.lock();
|
|
|
|
std::lock_guard lochQTHURL(d->moduleQTHURLMutex);
|
|
|
|
|
|
|
|
|
|
|
|
d->moduleQTH[cs] = cs + std::string(" ") + pos + std::string(" ") + d1 + std::string(" ") + d2;
|
|
|
|
d->moduleQTH[cs] = cs + std::string(" ") + pos + std::string(" ") + d1 + std::string(" ") + d2;
|
|
|
|
|
|
|
|
|
|
|
|
@ -194,7 +194,6 @@ void IRCDDBApp::rptrQTH(const std::string& callsign, double latitude, double lon
|
|
|
|
CLog::logInfo("URL: %s\n", d->moduleURL[cs].c_str());
|
|
|
|
CLog::logInfo("URL: %s\n", d->moduleURL[cs].c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
d->moduleQTHURLMutex.unlock();
|
|
|
|
|
|
|
|
d->infoTimer = 5; // send info in 5 seconds
|
|
|
|
d->infoTimer = 5; // send info in 5 seconds
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -208,10 +207,9 @@ void IRCDDBApp::rptrQRG(const std::string& callsign, double txFrequency, double
|
|
|
|
std::string f(fstr);
|
|
|
|
std::string f(fstr);
|
|
|
|
CUtils::ReplaceChar(f, ',', '.');
|
|
|
|
CUtils::ReplaceChar(f, ',', '.');
|
|
|
|
|
|
|
|
|
|
|
|
d->moduleQRGMutex.lock();
|
|
|
|
std::lock_guard lockModuleQRG(d->moduleQRGMutex);
|
|
|
|
d->moduleQRG[cs] = cs + std::string(" ") + f;
|
|
|
|
d->moduleQRG[cs] = cs + std::string(" ") + f;
|
|
|
|
CLog::logInfo("QRG: %s\n", d->moduleQRG[cs].c_str());
|
|
|
|
CLog::logInfo("QRG: %s\n", d->moduleQRG[cs].c_str());
|
|
|
|
d->moduleQRGMutex.unlock();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
d->infoTimer = 5; // send info in 5 seconds
|
|
|
|
d->infoTimer = 5; // send info in 5 seconds
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -229,9 +227,8 @@ void IRCDDBApp::kickWatchdog(const std::string& callsign, const std::string& s)
|
|
|
|
std::string cs = callsign;
|
|
|
|
std::string cs = callsign;
|
|
|
|
CUtils::ReplaceChar(cs, ' ', '_');
|
|
|
|
CUtils::ReplaceChar(cs, ' ', '_');
|
|
|
|
|
|
|
|
|
|
|
|
d->moduleWDMutex.lock();
|
|
|
|
std::lock_guard lockModuleWD(d->moduleWDMutex);
|
|
|
|
d->moduleWD[cs] = cs + std::string(" ") + text;
|
|
|
|
d->moduleWD[cs] = cs + std::string(" ") + text;
|
|
|
|
d->moduleWDMutex.unlock();
|
|
|
|
|
|
|
|
d->wdTimer = 60;
|
|
|
|
d->wdTimer = 60;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -300,7 +297,7 @@ unsigned int IRCDDBApp::calculateUsn(const std::string& nick)
|
|
|
|
|
|
|
|
|
|
|
|
void IRCDDBApp::userJoin(const std::string& nick, const std::string& name, const std::string& host)
|
|
|
|
void IRCDDBApp::userJoin(const std::string& nick, const std::string& name, const std::string& host)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->userMapMutex.lock();
|
|
|
|
std::lock_guard lockUserMap(d->userMapMutex);
|
|
|
|
|
|
|
|
|
|
|
|
std::string lnick = nick;
|
|
|
|
std::string lnick = nick;
|
|
|
|
CUtils::ToLower(lnick);
|
|
|
|
CUtils::ToLower(lnick);
|
|
|
|
@ -325,7 +322,6 @@ void IRCDDBApp::userJoin(const std::string& nick, const std::string& name, const
|
|
|
|
d->replyQ.putMessage(m2);
|
|
|
|
d->replyQ.putMessage(m2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d->userMapMutex.unlock();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IRCDDBApp::userLeave(const std::string& nick)
|
|
|
|
void IRCDDBApp::userLeave(const std::string& nick)
|
|
|
|
@ -333,13 +329,12 @@ void IRCDDBApp::userLeave(const std::string& nick)
|
|
|
|
std::string lnick = nick;
|
|
|
|
std::string lnick = nick;
|
|
|
|
CUtils::ToLower(lnick);
|
|
|
|
CUtils::ToLower(lnick);
|
|
|
|
|
|
|
|
|
|
|
|
d->userMapMutex.lock();
|
|
|
|
std::lock_guard lockUserMap(d->userMapMutex);
|
|
|
|
d->user.erase(lnick);
|
|
|
|
d->user.erase(lnick);
|
|
|
|
|
|
|
|
|
|
|
|
if (d->currentServer.size()) {
|
|
|
|
if (d->currentServer.size()) {
|
|
|
|
if (d->user.count(d->myNick) != 1) {
|
|
|
|
if (d->user.count(d->myNick) != 1) {
|
|
|
|
CLog::logInfo("IRCDDBApp::userLeave: could not find own nick\n");
|
|
|
|
CLog::logInfo("IRCDDBApp::userLeave: could not find own nick\n");
|
|
|
|
d->userMapMutex.unlock();
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -356,14 +351,12 @@ void IRCDDBApp::userLeave(const std::string& nick)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d->userMapMutex.unlock();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IRCDDBApp::userListReset()
|
|
|
|
void IRCDDBApp::userListReset()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->userMapMutex.lock();
|
|
|
|
std::lock_guard lockUserMap(d->userMapMutex);
|
|
|
|
d->user.clear();
|
|
|
|
d->user.clear();
|
|
|
|
d->userMapMutex.unlock();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IRCDDBApp::setCurrentNick(const std::string& nick)
|
|
|
|
void IRCDDBApp::setCurrentNick(const std::string& nick)
|
|
|
|
@ -386,7 +379,7 @@ void IRCDDBApp::setTopic(const std::string& topic)
|
|
|
|
bool IRCDDBApp::findServerUser()
|
|
|
|
bool IRCDDBApp::findServerUser()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool found = false;
|
|
|
|
bool found = false;
|
|
|
|
d->userMapMutex.lock();
|
|
|
|
std::lock_guard lockUserMap(d->userMapMutex);
|
|
|
|
|
|
|
|
|
|
|
|
std::map<std::string, IRCDDBAppUserObject>::iterator it;
|
|
|
|
std::map<std::string, IRCDDBAppUserObject>::iterator it;
|
|
|
|
|
|
|
|
|
|
|
|
@ -401,7 +394,6 @@ bool IRCDDBApp::findServerUser()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (found) {
|
|
|
|
if (found) {
|
|
|
|
d->userMapMutex.unlock();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -418,7 +410,6 @@ bool IRCDDBApp::findServerUser()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (found) {
|
|
|
|
if (found) {
|
|
|
|
d->userMapMutex.unlock();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -430,20 +421,18 @@ bool IRCDDBApp::findServerUser()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d->userMapMutex.unlock();
|
|
|
|
|
|
|
|
return found;
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IRCDDBApp::userChanOp(const std::string& nick, bool op)
|
|
|
|
void IRCDDBApp::userChanOp(const std::string& nick, bool op)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->userMapMutex.lock();
|
|
|
|
std::lock_guard lockUserMap(d->userMapMutex);
|
|
|
|
|
|
|
|
|
|
|
|
std::string lnick = nick;
|
|
|
|
std::string lnick = nick;
|
|
|
|
CUtils::ToLower(lnick);
|
|
|
|
CUtils::ToLower(lnick);
|
|
|
|
|
|
|
|
|
|
|
|
if (d->user.count(lnick) == 1)
|
|
|
|
if (d->user.count(lnick) == 1)
|
|
|
|
d->user[lnick].op = op;
|
|
|
|
d->user[lnick].op = op;
|
|
|
|
d->userMapMutex.unlock();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const int numberOfTables = 2;
|
|
|
|
static const int numberOfTables = 2;
|
|
|
|
@ -457,7 +446,7 @@ std::string IRCDDBApp::getIPAddress(std::string& zonerp_cs)
|
|
|
|
CUtils::ToLower(gw);
|
|
|
|
CUtils::ToLower(gw);
|
|
|
|
CUtils::Trim(gw);
|
|
|
|
CUtils::Trim(gw);
|
|
|
|
|
|
|
|
|
|
|
|
d->userMapMutex.lock();
|
|
|
|
std::lock_guard lockUserMap(d->userMapMutex);
|
|
|
|
for (int j=1; j <= 4; j++) {
|
|
|
|
for (int j=1; j <= 4; j++) {
|
|
|
|
std::string ircUser = gw + std::string("-") + std::to_string(j);
|
|
|
|
std::string ircUser = gw + std::string("-") + std::to_string(j);
|
|
|
|
|
|
|
|
|
|
|
|
@ -470,7 +459,6 @@ std::string IRCDDBApp::getIPAddress(std::string& zonerp_cs)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d->userMapMutex.unlock();
|
|
|
|
|
|
|
|
return ipAddr;
|
|
|
|
return ipAddr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -531,8 +519,7 @@ bool IRCDDBApp::findRepeater(const std::string& rptrCall)
|
|
|
|
|
|
|
|
|
|
|
|
std::string s("NONE");
|
|
|
|
std::string s("NONE");
|
|
|
|
std::string zonerp_cs;
|
|
|
|
std::string zonerp_cs;
|
|
|
|
d->rptrMapMutex.lock();
|
|
|
|
std::lock_guard lockRptrMap(d->rptrMapMutex);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (1 == d->rptrMap.count(arearp_cs)) {
|
|
|
|
if (1 == d->rptrMap.count(arearp_cs)) {
|
|
|
|
IRCDDBAppRptrObject o = d->rptrMap[arearp_cs];
|
|
|
|
IRCDDBAppRptrObject o = d->rptrMap[arearp_cs];
|
|
|
|
@ -741,7 +728,7 @@ void IRCDDBApp::doUpdate(std::string& msg)
|
|
|
|
return; // no valid key
|
|
|
|
return; // no valid key
|
|
|
|
|
|
|
|
|
|
|
|
if (tableID == 1) {
|
|
|
|
if (tableID == 1) {
|
|
|
|
d->rptrMapMutex.lock();
|
|
|
|
std::lock_guard lockRptrMap(d->rptrMapMutex);
|
|
|
|
IRCDDBAppRptrObject newRptr(dt, key, value, m_maxTime);
|
|
|
|
IRCDDBAppRptrObject newRptr(dt, key, value, m_maxTime);
|
|
|
|
d->rptrMap[key] = newRptr;
|
|
|
|
d->rptrMap[key] = newRptr;
|
|
|
|
|
|
|
|
|
|
|
|
@ -759,9 +746,8 @@ void IRCDDBApp::doUpdate(std::string& msg)
|
|
|
|
m2->addParam(getIPAddress(value));
|
|
|
|
m2->addParam(getIPAddress(value));
|
|
|
|
d->replyQ.putMessage(m2);
|
|
|
|
d->replyQ.putMessage(m2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d->rptrMapMutex.unlock();
|
|
|
|
|
|
|
|
} else if (0==tableID && d->initReady) {
|
|
|
|
} else if (0==tableID && d->initReady) {
|
|
|
|
d->rptrMapMutex.lock();
|
|
|
|
std::lock_guard lockRptrMap(d->rptrMapMutex);
|
|
|
|
std::string userCallsign(key);
|
|
|
|
std::string userCallsign(key);
|
|
|
|
std::string arearp_cs(value);
|
|
|
|
std::string arearp_cs(value);
|
|
|
|
std::string zonerp_cs;
|
|
|
|
std::string zonerp_cs;
|
|
|
|
@ -785,7 +771,6 @@ void IRCDDBApp::doUpdate(std::string& msg)
|
|
|
|
m2->addParam(ip_addr);
|
|
|
|
m2->addParam(ip_addr);
|
|
|
|
m2->addParam(tk + std::string(" ") + timeToken);
|
|
|
|
m2->addParam(tk + std::string(" ") + timeToken);
|
|
|
|
d->replyQ.putMessage(m2);
|
|
|
|
d->replyQ.putMessage(m2);
|
|
|
|
d->rptrMapMutex.unlock();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -980,27 +965,28 @@ void IRCDDBApp::Entry()
|
|
|
|
d->infoTimer--;
|
|
|
|
d->infoTimer--;
|
|
|
|
|
|
|
|
|
|
|
|
if (0 == d->infoTimer) {
|
|
|
|
if (0 == d->infoTimer) {
|
|
|
|
d->moduleQTHURLMutex.lock();
|
|
|
|
{ // Scope for mutext locking
|
|
|
|
for (auto it = d->moduleQTH.begin(); it != d->moduleQTH.end(); ++it) {
|
|
|
|
std::lock_guard lochQTHURL(d->moduleQTHURLMutex);
|
|
|
|
std::string value = it->second;
|
|
|
|
for (auto it = d->moduleQTH.begin(); it != d->moduleQTH.end(); ++it) {
|
|
|
|
IRCMessage *m = new IRCMessage(d->currentServer, std::string("IRCDDB RPTRQTH: ") + value);
|
|
|
|
std::string value = it->second;
|
|
|
|
IRCMessageQueue *q = getSendQ();
|
|
|
|
IRCMessage *m = new IRCMessage(d->currentServer, std::string("IRCDDB RPTRQTH: ") + value);
|
|
|
|
if (q != NULL)
|
|
|
|
IRCMessageQueue *q = getSendQ();
|
|
|
|
q->putMessage(m);
|
|
|
|
if (q != NULL)
|
|
|
|
}
|
|
|
|
q->putMessage(m);
|
|
|
|
d->moduleQTH.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
d->moduleQTH.clear();
|
|
|
|
for (auto it = d->moduleURL.begin(); it != d->moduleURL.end(); ++it) {
|
|
|
|
|
|
|
|
std::string value = it->second;
|
|
|
|
for (auto it = d->moduleURL.begin(); it != d->moduleURL.end(); ++it) {
|
|
|
|
IRCMessage *m = new IRCMessage(d->currentServer, std::string("IRCDDB RPTRURL: ") + value);
|
|
|
|
std::string value = it->second;
|
|
|
|
IRCMessageQueue *q = getSendQ();
|
|
|
|
IRCMessage *m = new IRCMessage(d->currentServer, std::string("IRCDDB RPTRURL: ") + value);
|
|
|
|
if (q != NULL)
|
|
|
|
IRCMessageQueue *q = getSendQ();
|
|
|
|
q->putMessage(m);
|
|
|
|
if (q != NULL)
|
|
|
|
|
|
|
|
q->putMessage(m);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
d->moduleURL.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d->moduleURL.clear();
|
|
|
|
|
|
|
|
d->moduleQTHURLMutex.unlock();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
d->moduleQRGMutex.lock();
|
|
|
|
std::lock_guard lockModuleQRG(d->moduleQRGMutex);
|
|
|
|
for (auto it = d->moduleQRG.begin(); it != d->moduleQRG.end(); ++it) {
|
|
|
|
for (auto it = d->moduleQRG.begin(); it != d->moduleQRG.end(); ++it) {
|
|
|
|
std::string value = it->second;
|
|
|
|
std::string value = it->second;
|
|
|
|
IRCMessage* m = new IRCMessage(d->currentServer, std::string("IRCDDB RPTRQRG: ") + value);
|
|
|
|
IRCMessage* m = new IRCMessage(d->currentServer, std::string("IRCDDB RPTRQRG: ") + value);
|
|
|
|
@ -1009,7 +995,6 @@ void IRCDDBApp::Entry()
|
|
|
|
q->putMessage(m);
|
|
|
|
q->putMessage(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d->moduleQRG.clear();
|
|
|
|
d->moduleQRG.clear();
|
|
|
|
d->moduleQRGMutex.unlock();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1017,7 +1002,7 @@ void IRCDDBApp::Entry()
|
|
|
|
d->wdTimer--;
|
|
|
|
d->wdTimer--;
|
|
|
|
|
|
|
|
|
|
|
|
if (0 == d->wdTimer) {
|
|
|
|
if (0 == d->wdTimer) {
|
|
|
|
d->moduleWDMutex.lock();
|
|
|
|
std::lock_guard lockModuleWD(d->moduleWDMutex);
|
|
|
|
|
|
|
|
|
|
|
|
for (auto it = d->moduleWD.begin(); it != d->moduleWD.end(); ++it) {
|
|
|
|
for (auto it = d->moduleWD.begin(); it != d->moduleWD.end(); ++it) {
|
|
|
|
std::string value = it->second;
|
|
|
|
std::string value = it->second;
|
|
|
|
@ -1027,7 +1012,6 @@ void IRCDDBApp::Entry()
|
|
|
|
q->putMessage(m);
|
|
|
|
q->putMessage(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d->moduleWD.clear();
|
|
|
|
d->moduleWD.clear();
|
|
|
|
d->moduleWDMutex.unlock();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|