|
|
|
@ -52,13 +52,11 @@ class IRCDDBAppUserObject
|
|
|
|
bool op;
|
|
|
|
bool op;
|
|
|
|
unsigned int usn;
|
|
|
|
unsigned int usn;
|
|
|
|
|
|
|
|
|
|
|
|
IRCDDBAppUserObject ()
|
|
|
|
IRCDDBAppUserObject () {
|
|
|
|
{
|
|
|
|
|
|
|
|
IRCDDBAppUserObject (wxT(""), wxT(""), wxT(""));
|
|
|
|
IRCDDBAppUserObject (wxT(""), wxT(""), wxT(""));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IRCDDBAppUserObject ( const wxString& n, const wxString& nm, const wxString& h )
|
|
|
|
IRCDDBAppUserObject ( const wxString& n, const wxString& nm, const wxString& h ) {
|
|
|
|
{
|
|
|
|
|
|
|
|
nick = n;
|
|
|
|
nick = n;
|
|
|
|
name = nm;
|
|
|
|
name = nm;
|
|
|
|
host = h;
|
|
|
|
host = h;
|
|
|
|
@ -84,18 +82,15 @@ class IRCDDBAppRptrObject
|
|
|
|
wxDateTime lastChanged;
|
|
|
|
wxDateTime lastChanged;
|
|
|
|
wxString zonerp_cs;
|
|
|
|
wxString zonerp_cs;
|
|
|
|
|
|
|
|
|
|
|
|
IRCDDBAppRptrObject ()
|
|
|
|
IRCDDBAppRptrObject () {
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IRCDDBAppRptrObject (wxDateTime& dt, wxString& repeaterCallsign, wxString& gatewayCallsign)
|
|
|
|
IRCDDBAppRptrObject (wxDateTime& dt, wxString& repeaterCallsign, wxString& gatewayCallsign) {
|
|
|
|
{
|
|
|
|
|
|
|
|
arearp_cs = repeaterCallsign;
|
|
|
|
arearp_cs = repeaterCallsign;
|
|
|
|
lastChanged = dt;
|
|
|
|
lastChanged = dt;
|
|
|
|
zonerp_cs = gatewayCallsign;
|
|
|
|
zonerp_cs = gatewayCallsign;
|
|
|
|
|
|
|
|
|
|
|
|
if (dt.IsLaterThan(maxTime))
|
|
|
|
if (dt.IsLaterThan(maxTime)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
maxTime = dt;
|
|
|
|
maxTime = dt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -119,8 +114,7 @@ class IRCDDBAppPrivate
|
|
|
|
datePattern(wxT("^20[0-9][0-9]-((1[0-2])|(0[1-9]))-((3[01])|([12][0-9])|(0[1-9]))$")),
|
|
|
|
datePattern(wxT("^20[0-9][0-9]-((1[0-2])|(0[1-9]))-((3[01])|([12][0-9])|(0[1-9]))$")),
|
|
|
|
timePattern(wxT("^((2[0-3])|([01][0-9])):[0-5][0-9]:[0-5][0-9]$")),
|
|
|
|
timePattern(wxT("^((2[0-3])|([01][0-9])):[0-5][0-9]:[0-5][0-9]$")),
|
|
|
|
dbPattern(wxT("^[0-9A-Z_]{8}$")),
|
|
|
|
dbPattern(wxT("^[0-9A-Z_]{8}$")),
|
|
|
|
modulePattern(wxT("^[ABCD]D?$"))
|
|
|
|
modulePattern(wxT("^[ABCD]D?$")) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wdTimer = 0;
|
|
|
|
wdTimer = 0;
|
|
|
|
wdCounter = 0;
|
|
|
|
wdCounter = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -190,8 +184,7 @@ IRCDDBApp::IRCDDBApp( const wxString& u_chan )
|
|
|
|
|
|
|
|
|
|
|
|
IRCDDBApp::~IRCDDBApp()
|
|
|
|
IRCDDBApp::~IRCDDBApp()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (d->sendQ != NULL)
|
|
|
|
if (d->sendQ != NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
delete d->sendQ;
|
|
|
|
delete d->sendQ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete d;
|
|
|
|
delete d;
|
|
|
|
@ -239,8 +232,7 @@ void IRCDDBApp::rptrQRG( const wxString& module, double txFrequency, double dupl
|
|
|
|
double range, double agl )
|
|
|
|
double range, double agl )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (d->modulePattern.Matches(module))
|
|
|
|
if (d->modulePattern.Matches(module)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxString f = module + wxT(" ") + wxString::Format(wxT("%011.5f %+010.5f %06.2f %06.1f"),
|
|
|
|
wxString f = module + wxT(" ") + wxString::Format(wxT("%011.5f %+010.5f %06.2f %06.1f"),
|
|
|
|
txFrequency, duplexShift, range / 1609.344, agl );
|
|
|
|
txFrequency, duplexShift, range / 1609.344, agl );
|
|
|
|
|
|
|
|
|
|
|
|
@ -257,16 +249,13 @@ void IRCDDBApp::rptrQRG( const wxString& module, double txFrequency, double dupl
|
|
|
|
|
|
|
|
|
|
|
|
void IRCDDBApp::kickWatchdog( const wxString& s )
|
|
|
|
void IRCDDBApp::kickWatchdog( const wxString& s )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (s.Len() > 0)
|
|
|
|
if (s.Len() > 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxRegEx nonValid(wxT("[^[:graph:]]"));
|
|
|
|
wxRegEx nonValid(wxT("[^[:graph:]]"));
|
|
|
|
d->wdInfo = s;
|
|
|
|
d->wdInfo = s;
|
|
|
|
nonValid.Replace(& d->wdInfo, wxEmptyString);
|
|
|
|
nonValid.Replace(& d->wdInfo, wxEmptyString);
|
|
|
|
|
|
|
|
|
|
|
|
if (d->wdInfo.Len() > 0)
|
|
|
|
if (d->wdInfo.Len() > 0) {
|
|
|
|
{
|
|
|
|
if (d->wdTimer == 0) {
|
|
|
|
if (d->wdTimer == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
d->wdTimer ++;
|
|
|
|
d->wdTimer ++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -284,23 +273,17 @@ int IRCDDBApp::getConnectionState()
|
|
|
|
IRCDDB_RESPONSE_TYPE IRCDDBApp::getReplyMessageType()
|
|
|
|
IRCDDB_RESPONSE_TYPE IRCDDBApp::getReplyMessageType()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IRCMessage * m = d->replyQ.peekFirst();
|
|
|
|
IRCMessage * m = d->replyQ.peekFirst();
|
|
|
|
if (m == NULL)
|
|
|
|
if (m == NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return IDRT_NONE;
|
|
|
|
return IDRT_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString msgType = m->getCommand();
|
|
|
|
wxString msgType = m->getCommand();
|
|
|
|
|
|
|
|
|
|
|
|
if (msgType.IsSameAs(wxT("IDRT_USER")))
|
|
|
|
if (msgType.IsSameAs(wxT("IDRT_USER"))) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return IDRT_USER;
|
|
|
|
return IDRT_USER;
|
|
|
|
}
|
|
|
|
} else if (msgType.IsSameAs(wxT("IDRT_REPEATER"))) {
|
|
|
|
else if (msgType.IsSameAs(wxT("IDRT_REPEATER")))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return IDRT_REPEATER;
|
|
|
|
return IDRT_REPEATER;
|
|
|
|
}
|
|
|
|
} else if (msgType.IsSameAs(wxT("IDRT_GATEWAY"))) {
|
|
|
|
else if (msgType.IsSameAs(wxT("IDRT_GATEWAY")))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return IDRT_GATEWAY;
|
|
|
|
return IDRT_GATEWAY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -320,16 +303,14 @@ IRCMessage * IRCDDBApp::getReplyMessage()
|
|
|
|
bool IRCDDBApp::startWork()
|
|
|
|
bool IRCDDBApp::startWork()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (Create() != wxTHREAD_NO_ERROR)
|
|
|
|
if (Create() != wxTHREAD_NO_ERROR) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxLogError(wxT("IRCClient::startWork: Could not create the worker thread!"));
|
|
|
|
wxLogError(wxT("IRCClient::startWork: Could not create the worker thread!"));
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
d->terminateThread = false;
|
|
|
|
d->terminateThread = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (Run() != wxTHREAD_NO_ERROR)
|
|
|
|
if (Run() != wxTHREAD_NO_ERROR) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxLogError(wxT("IRCClient::startWork: Could not run the worker thread!"));
|
|
|
|
wxLogError(wxT("IRCClient::startWork: Could not run the worker thread!"));
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -358,16 +339,13 @@ void IRCDDBApp::userJoin (const wxString& nick, const wxString& name, const wxSt
|
|
|
|
|
|
|
|
|
|
|
|
// wxLogVerbose(wxT("add %d: (") + u.nick + wxT(") (") + u.host + wxT(")"), d->user.size());
|
|
|
|
// wxLogVerbose(wxT("add %d: (") + u.nick + wxT(") (") + u.host + wxT(")"), d->user.size());
|
|
|
|
|
|
|
|
|
|
|
|
if (d->initReady)
|
|
|
|
if (d->initReady) {
|
|
|
|
{
|
|
|
|
|
|
|
|
int hyphenPos = nick.Find(wxT('-'));
|
|
|
|
int hyphenPos = nick.Find(wxT('-'));
|
|
|
|
|
|
|
|
|
|
|
|
if ((hyphenPos >= 4) && (hyphenPos <= 6))
|
|
|
|
if ((hyphenPos >= 4) && (hyphenPos <= 6)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxString gatewayCallsign = nick.Mid(0, hyphenPos).Upper();
|
|
|
|
wxString gatewayCallsign = nick.Mid(0, hyphenPos).Upper();
|
|
|
|
|
|
|
|
|
|
|
|
while (gatewayCallsign.Length() < 7)
|
|
|
|
while (gatewayCallsign.Length() < 7) {
|
|
|
|
{
|
|
|
|
|
|
|
|
gatewayCallsign.Append(wxT(' '));
|
|
|
|
gatewayCallsign.Append(wxT(' '));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -397,22 +375,18 @@ void IRCDDBApp::userLeave (const wxString& nick)
|
|
|
|
|
|
|
|
|
|
|
|
// wxLogVerbose(wxT("rm %d: ") + nick, d->user.size());
|
|
|
|
// wxLogVerbose(wxT("rm %d: ") + nick, d->user.size());
|
|
|
|
|
|
|
|
|
|
|
|
if (d->currentServer.Len() > 0)
|
|
|
|
if (d->currentServer.Len() > 0) {
|
|
|
|
{
|
|
|
|
if (d->user.count(d->myNick) != 1) {
|
|
|
|
if (d->user.count(d->myNick) != 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
wxLogVerbose(wxT("IRCDDBApp::userLeave: could not find own nick"));
|
|
|
|
wxLogVerbose(wxT("IRCDDBApp::userLeave: could not find own nick"));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IRCDDBAppUserObject me = d->user[d->myNick];
|
|
|
|
IRCDDBAppUserObject me = d->user[d->myNick];
|
|
|
|
|
|
|
|
|
|
|
|
if (me.op == false)
|
|
|
|
if (me.op == false) {
|
|
|
|
{
|
|
|
|
|
|
|
|
// if I am not op, then look for new server
|
|
|
|
// if I am not op, then look for new server
|
|
|
|
|
|
|
|
|
|
|
|
if (d->currentServer.IsSameAs(lnick))
|
|
|
|
if (d->currentServer.IsSameAs(lnick)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
// currentServer = null;
|
|
|
|
// currentServer = null;
|
|
|
|
d->state = 2; // choose new server
|
|
|
|
d->state = 2; // choose new server
|
|
|
|
d->timer = 200;
|
|
|
|
d->timer = 200;
|
|
|
|
@ -454,13 +428,11 @@ bool IRCDDBApp::findServerUser()
|
|
|
|
|
|
|
|
|
|
|
|
IRCDDBAppUserMap::iterator it;
|
|
|
|
IRCDDBAppUserMap::iterator it;
|
|
|
|
|
|
|
|
|
|
|
|
for( it = d->user.begin(); it != d->user.end(); ++it )
|
|
|
|
for( it = d->user.begin(); it != d->user.end(); ++it ) {
|
|
|
|
{
|
|
|
|
|
|
|
|
IRCDDBAppUserObject u = it->second;
|
|
|
|
IRCDDBAppUserObject u = it->second;
|
|
|
|
|
|
|
|
|
|
|
|
if (u.nick.StartsWith(wxT("s-")) && u.op && !d->myNick.IsSameAs(u.nick)
|
|
|
|
if (u.nick.StartsWith(wxT("s-")) && u.op && !d->myNick.IsSameAs(u.nick)
|
|
|
|
&& u.nick.IsSameAs(d->bestServer))
|
|
|
|
&& u.nick.IsSameAs(d->bestServer)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->currentServer = u.nick;
|
|
|
|
d->currentServer = u.nick;
|
|
|
|
found = true;
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
@ -470,15 +442,12 @@ bool IRCDDBApp::findServerUser()
|
|
|
|
if (found)
|
|
|
|
if (found)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
if (d->bestServer.Len() == 8)
|
|
|
|
if (d->bestServer.Len() == 8) {
|
|
|
|
{
|
|
|
|
for( it = d->user.begin(); it != d->user.end(); ++it ) {
|
|
|
|
for( it = d->user.begin(); it != d->user.end(); ++it )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IRCDDBAppUserObject u = it->second;
|
|
|
|
IRCDDBAppUserObject u = it->second;
|
|
|
|
|
|
|
|
|
|
|
|
if (u.nick.StartsWith(d->bestServer.Mid(0,7)) && u.op &&
|
|
|
|
if (u.nick.StartsWith(d->bestServer.Mid(0,7)) && u.op &&
|
|
|
|
!d->myNick.IsSameAs(u.nick) )
|
|
|
|
!d->myNick.IsSameAs(u.nick) ) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->currentServer = u.nick;
|
|
|
|
d->currentServer = u.nick;
|
|
|
|
found = true;
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
@ -489,12 +458,10 @@ bool IRCDDBApp::findServerUser()
|
|
|
|
if (found)
|
|
|
|
if (found)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
for( it = d->user.begin(); it != d->user.end(); ++it )
|
|
|
|
for( it = d->user.begin(); it != d->user.end(); ++it ) {
|
|
|
|
{
|
|
|
|
|
|
|
|
IRCDDBAppUserObject u = it->second;
|
|
|
|
IRCDDBAppUserObject u = it->second;
|
|
|
|
|
|
|
|
|
|
|
|
if (u.nick.StartsWith(wxT("s-")) && u.op && !d->myNick.IsSameAs(u.nick))
|
|
|
|
if (u.nick.StartsWith(wxT("s-")) && u.op && !d->myNick.IsSameAs(u.nick)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->currentServer = u.nick;
|
|
|
|
d->currentServer = u.nick;
|
|
|
|
found = true;
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
@ -511,8 +478,7 @@ void IRCDDBApp::userChanOp (const wxString& nick, bool op)
|
|
|
|
wxString lnick = nick;
|
|
|
|
wxString lnick = nick;
|
|
|
|
lnick.MakeLower();
|
|
|
|
lnick.MakeLower();
|
|
|
|
|
|
|
|
|
|
|
|
if (d->user.count(lnick) == 1)
|
|
|
|
if (d->user.count(lnick) == 1) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->user[lnick].op = op;
|
|
|
|
d->user[lnick].op = op;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -538,17 +504,14 @@ wxString IRCDDBApp::getIPAddress(wxString& zonerp_cs)
|
|
|
|
|
|
|
|
|
|
|
|
int j;
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
|
|
for (j=1; j <= 4; j++)
|
|
|
|
for (j=1; j <= 4; j++) {
|
|
|
|
{
|
|
|
|
|
|
|
|
// int i = 0;
|
|
|
|
// int i = 0;
|
|
|
|
wxString ircUser = gw.Strip() + wxString::Format(wxT("-%d"), j);
|
|
|
|
wxString ircUser = gw.Strip() + wxString::Format(wxT("-%d"), j);
|
|
|
|
|
|
|
|
|
|
|
|
if (d->user.count(ircUser) == 1)
|
|
|
|
if (d->user.count(ircUser) == 1) {
|
|
|
|
{
|
|
|
|
|
|
|
|
IRCDDBAppUserObject o = d->user[ ircUser ];
|
|
|
|
IRCDDBAppUserObject o = d->user[ ircUser ];
|
|
|
|
|
|
|
|
|
|
|
|
if (o.usn >= max_usn)
|
|
|
|
if (o.usn >= max_usn) {
|
|
|
|
{
|
|
|
|
|
|
|
|
max_usn = o.usn;
|
|
|
|
max_usn = o.usn;
|
|
|
|
ipAddr = o.host;
|
|
|
|
ipAddr = o.host;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -589,10 +552,8 @@ static void findReflector( const wxString& rptrCall, IRCDDBAppPrivate * d )
|
|
|
|
|
|
|
|
|
|
|
|
safeStringCopy(host_name, host.mb_str(wxConvUTF8), sizeof host_name);
|
|
|
|
safeStringCopy(host_name, host.mb_str(wxConvUTF8), sizeof host_name);
|
|
|
|
|
|
|
|
|
|
|
|
if (getAllIPV4Addresses(host_name, 0, &numAddr, addr, MAXIPV4ADDR) == 0)
|
|
|
|
if (getAllIPV4Addresses(host_name, 0, &numAddr, addr, MAXIPV4ADDR) == 0) {
|
|
|
|
{
|
|
|
|
if (numAddr > 0) {
|
|
|
|
if (numAddr > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
unsigned char * a = (unsigned char *) &addr[0].sin_addr;
|
|
|
|
unsigned char * a = (unsigned char *) &addr[0].sin_addr;
|
|
|
|
|
|
|
|
|
|
|
|
ipAddr = wxString::Format(wxT("%d.%d.%d.%d"), a[0], a[1], a[2], a[3]);
|
|
|
|
ipAddr = wxString::Format(wxT("%d.%d.%d.%d"), a[0], a[1], a[2], a[3]);
|
|
|
|
@ -612,8 +573,7 @@ static void findReflector( const wxString& rptrCall, IRCDDBAppPrivate * d )
|
|
|
|
bool IRCDDBApp::findRepeater(const wxString& rptrCall)
|
|
|
|
bool IRCDDBApp::findRepeater(const wxString& rptrCall)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (rptrCall.StartsWith(wxT("XRF")) || rptrCall.StartsWith(wxT("REF")))
|
|
|
|
if (rptrCall.StartsWith(wxT("XRF")) || rptrCall.StartsWith(wxT("REF"))) {
|
|
|
|
{
|
|
|
|
|
|
|
|
findReflector(rptrCall, d);
|
|
|
|
findReflector(rptrCall, d);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -627,8 +587,7 @@ bool IRCDDBApp::findRepeater(const wxString& rptrCall)
|
|
|
|
|
|
|
|
|
|
|
|
wxString s = wxT("NONE");
|
|
|
|
wxString s = wxT("NONE");
|
|
|
|
|
|
|
|
|
|
|
|
if (d->rptrMap.count(arearp_cs) == 1)
|
|
|
|
if (d->rptrMap.count(arearp_cs) == 1) {
|
|
|
|
{
|
|
|
|
|
|
|
|
IRCDDBAppRptrObject o = d->rptrMap[arearp_cs];
|
|
|
|
IRCDDBAppRptrObject o = d->rptrMap[arearp_cs];
|
|
|
|
zonerp_cs = o.zonerp_cs;
|
|
|
|
zonerp_cs = o.zonerp_cs;
|
|
|
|
zonerp_cs.Replace(wxT("_"), wxT(" "));
|
|
|
|
zonerp_cs.Replace(wxT("_"), wxT(" "));
|
|
|
|
@ -676,8 +635,7 @@ bool IRCDDBApp::sendHeard(const wxString& myCall, const wxString& myCallExt,
|
|
|
|
wxString srv = d->currentServer;
|
|
|
|
wxString srv = d->currentServer;
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
|
|
|
|
|
|
|
|
if ((srv.Len() > 0) && (d->state >= 6) && (q != NULL))
|
|
|
|
if ((srv.Len() > 0) && (d->state >= 6) && (q != NULL)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxString cmd = wxT("UPDATE ");
|
|
|
|
wxString cmd = wxT("UPDATE ");
|
|
|
|
|
|
|
|
|
|
|
|
cmd.Append( getCurrentTime() );
|
|
|
|
cmd.Append( getCurrentTime() );
|
|
|
|
@ -688,8 +646,7 @@ bool IRCDDBApp::sendHeard(const wxString& myCall, const wxString& myCallExt,
|
|
|
|
cmd.Append(wxT(" "));
|
|
|
|
cmd.Append(wxT(" "));
|
|
|
|
cmd.Append(r1);
|
|
|
|
cmd.Append(r1);
|
|
|
|
cmd.Append(wxT(" "));
|
|
|
|
cmd.Append(wxT(" "));
|
|
|
|
if (!statsMsg)
|
|
|
|
if (!statsMsg) {
|
|
|
|
{
|
|
|
|
|
|
|
|
cmd.Append(wxT("0 "));
|
|
|
|
cmd.Append(wxT("0 "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cmd.Append(r2);
|
|
|
|
cmd.Append(r2);
|
|
|
|
@ -703,18 +660,14 @@ bool IRCDDBApp::sendHeard(const wxString& myCall, const wxString& myCallExt,
|
|
|
|
cmd.Append(wxT(" "));
|
|
|
|
cmd.Append(wxT(" "));
|
|
|
|
cmd.Append(myext);
|
|
|
|
cmd.Append(myext);
|
|
|
|
|
|
|
|
|
|
|
|
if (statsMsg)
|
|
|
|
if (statsMsg) {
|
|
|
|
{
|
|
|
|
|
|
|
|
cmd.Append(wxT(" # "));
|
|
|
|
cmd.Append(wxT(" # "));
|
|
|
|
cmd.Append(tx_stats);
|
|
|
|
cmd.Append(tx_stats);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cmd.Append(wxT(" 00 "));
|
|
|
|
cmd.Append(wxT(" 00 "));
|
|
|
|
cmd.Append(dest);
|
|
|
|
cmd.Append(dest);
|
|
|
|
|
|
|
|
|
|
|
|
if (tx_msg.Len() == 20)
|
|
|
|
if (tx_msg.Len() == 20) {
|
|
|
|
{
|
|
|
|
|
|
|
|
cmd.Append(wxT(" "));
|
|
|
|
cmd.Append(wxT(" "));
|
|
|
|
cmd.Append(tx_msg);
|
|
|
|
cmd.Append(tx_msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -725,9 +678,7 @@ bool IRCDDBApp::sendHeard(const wxString& myCall, const wxString& myCallExt,
|
|
|
|
|
|
|
|
|
|
|
|
q->putMessage(m);
|
|
|
|
q->putMessage(m);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -737,8 +688,7 @@ bool IRCDDBApp::findUser(const wxString& usrCall)
|
|
|
|
wxString srv = d->currentServer;
|
|
|
|
wxString srv = d->currentServer;
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
|
|
|
|
|
|
|
|
if ((srv.Len() > 0) && (d->state >= 6) && (q != NULL))
|
|
|
|
if ((srv.Len() > 0) && (d->state >= 6) && (q != NULL)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxString usr = usrCall;
|
|
|
|
wxString usr = usrCall;
|
|
|
|
|
|
|
|
|
|
|
|
usr.Replace(wxT(" "), wxT("_"));
|
|
|
|
usr.Replace(wxT(" "), wxT("_"));
|
|
|
|
@ -747,9 +697,7 @@ bool IRCDDBApp::findUser(const wxString& usrCall)
|
|
|
|
wxT("FIND ") + usr );
|
|
|
|
wxT("FIND ") + usr );
|
|
|
|
|
|
|
|
|
|
|
|
q->putMessage(m);
|
|
|
|
q->putMessage(m);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IRCMessage * m2 = new IRCMessage(wxT("IDRT_USER"));
|
|
|
|
IRCMessage * m2 = new IRCMessage(wxT("IDRT_USER"));
|
|
|
|
m2->addParam(usrCall);
|
|
|
|
m2->addParam(usrCall);
|
|
|
|
m2->addParam(wxT(""));
|
|
|
|
m2->addParam(wxT(""));
|
|
|
|
@ -765,8 +713,7 @@ bool IRCDDBApp::findUser(const wxString& usrCall)
|
|
|
|
|
|
|
|
|
|
|
|
void IRCDDBApp::msgChannel (IRCMessage * m)
|
|
|
|
void IRCDDBApp::msgChannel (IRCMessage * m)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (m->getPrefixNick().StartsWith(wxT("s-")) && (m->numParams >= 2)) // server msg
|
|
|
|
if (m->getPrefixNick().StartsWith(wxT("s-")) && (m->numParams >= 2)) { // server msg
|
|
|
|
{
|
|
|
|
|
|
|
|
doUpdate(m->params[1]);
|
|
|
|
doUpdate(m->params[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -778,44 +725,35 @@ void IRCDDBApp::doNotFound ( wxString& msg, wxString& retval )
|
|
|
|
|
|
|
|
|
|
|
|
wxStringTokenizer tkz(msg);
|
|
|
|
wxStringTokenizer tkz(msg);
|
|
|
|
|
|
|
|
|
|
|
|
if (!tkz.HasMoreTokens())
|
|
|
|
if (!tkz.HasMoreTokens()) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // no text in message
|
|
|
|
return; // no text in message
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString tk = tkz.GetNextToken();
|
|
|
|
wxString tk = tkz.GetNextToken();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (d->tablePattern.Matches(tk))
|
|
|
|
if (d->tablePattern.Matches(tk)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
long i;
|
|
|
|
long i;
|
|
|
|
|
|
|
|
|
|
|
|
if (tk.ToLong(&i))
|
|
|
|
if (tk.ToLong(&i)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
tableID = i;
|
|
|
|
tableID = i;
|
|
|
|
if ((tableID < 0) || (tableID >= numberOfTables))
|
|
|
|
if ((tableID < 0) || (tableID >= numberOfTables)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxLogVerbose(wxT("invalid table ID %d"), tableID);
|
|
|
|
wxLogVerbose(wxT("invalid table ID %d"), tableID);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // not a valid number
|
|
|
|
return; // not a valid number
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!tkz.HasMoreTokens())
|
|
|
|
if (!tkz.HasMoreTokens()) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // received nothing but the tableID
|
|
|
|
return; // received nothing but the tableID
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tk = tkz.GetNextToken();
|
|
|
|
tk = tkz.GetNextToken();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (tableID == 0)
|
|
|
|
if (tableID == 0) {
|
|
|
|
{
|
|
|
|
if (! d->dbPattern.Matches(tk)) {
|
|
|
|
if (! d->dbPattern.Matches(tk))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // no valid key
|
|
|
|
return; // no valid key
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -829,100 +767,82 @@ void IRCDDBApp::doUpdate ( wxString& msg )
|
|
|
|
|
|
|
|
|
|
|
|
wxStringTokenizer tkz(msg);
|
|
|
|
wxStringTokenizer tkz(msg);
|
|
|
|
|
|
|
|
|
|
|
|
if (!tkz.HasMoreTokens())
|
|
|
|
if (!tkz.HasMoreTokens()) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // no text in message
|
|
|
|
return; // no text in message
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString tk = tkz.GetNextToken();
|
|
|
|
wxString tk = tkz.GetNextToken();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (d->tablePattern.Matches(tk))
|
|
|
|
if (d->tablePattern.Matches(tk)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
long i;
|
|
|
|
long i;
|
|
|
|
|
|
|
|
|
|
|
|
if (tk.ToLong(&i))
|
|
|
|
if (tk.ToLong(&i)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
tableID = i;
|
|
|
|
tableID = i;
|
|
|
|
if ((tableID < 0) || (tableID >= numberOfTables))
|
|
|
|
if ((tableID < 0) || (tableID >= numberOfTables)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxLogVerbose(wxT("invalid table ID %d"), tableID);
|
|
|
|
wxLogVerbose(wxT("invalid table ID %d"), tableID);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // not a valid number
|
|
|
|
return; // not a valid number
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!tkz.HasMoreTokens())
|
|
|
|
if (!tkz.HasMoreTokens()) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // received nothing but the tableID
|
|
|
|
return; // received nothing but the tableID
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tk = tkz.GetNextToken();
|
|
|
|
tk = tkz.GetNextToken();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (d->datePattern.Matches(tk))
|
|
|
|
if (d->datePattern.Matches(tk)) {
|
|
|
|
{
|
|
|
|
if (!tkz.HasMoreTokens()) {
|
|
|
|
if (!tkz.HasMoreTokens())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // nothing after date string
|
|
|
|
return; // nothing after date string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString timeToken = tkz.GetNextToken();
|
|
|
|
wxString timeToken = tkz.GetNextToken();
|
|
|
|
|
|
|
|
|
|
|
|
if (! d->timePattern.Matches(timeToken))
|
|
|
|
if (! d->timePattern.Matches(timeToken)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // no time string after date string
|
|
|
|
return; // no time string after date string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxDateTime dt;
|
|
|
|
wxDateTime dt;
|
|
|
|
|
|
|
|
|
|
|
|
if (dt.ParseFormat(tk + wxT(" ") + timeToken, wxT("%Y-%m-%d %H:%M:%S")) == NULL)
|
|
|
|
if (dt.ParseFormat(tk + wxT(" ") + timeToken, wxT("%Y-%m-%d %H:%M:%S")) == NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // date+time parsing failed
|
|
|
|
return; // date+time parsing failed
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((tableID == 0) || (tableID == 1))
|
|
|
|
if ((tableID == 0) || (tableID == 1)) {
|
|
|
|
{
|
|
|
|
if (!tkz.HasMoreTokens()) {
|
|
|
|
if (!tkz.HasMoreTokens())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // nothing after time string
|
|
|
|
return; // nothing after time string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString key = tkz.GetNextToken();
|
|
|
|
wxString key = tkz.GetNextToken();
|
|
|
|
|
|
|
|
|
|
|
|
if (! d->dbPattern.Matches(key))
|
|
|
|
if (! d->dbPattern.Matches(key)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // no valid key
|
|
|
|
return; // no valid key
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!tkz.HasMoreTokens())
|
|
|
|
if (!tkz.HasMoreTokens()) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // nothing after time string
|
|
|
|
return; // nothing after time string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString value = tkz.GetNextToken();
|
|
|
|
wxString value = tkz.GetNextToken();
|
|
|
|
|
|
|
|
|
|
|
|
if (! d->dbPattern.Matches(value))
|
|
|
|
if (! d->dbPattern.Matches(value)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // no valid key
|
|
|
|
return; // no valid key
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//wxLogVerbose(wxT("TABLE %d ") + key + wxT(" ") + value, tableID );
|
|
|
|
//wxLogVerbose(wxT("TABLE %d ") + key + wxT(" ") + value, tableID );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (tableID == 1)
|
|
|
|
if (tableID == 1) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxMutexLocker lock(d->rptrMapMutex);
|
|
|
|
wxMutexLocker lock(d->rptrMapMutex);
|
|
|
|
|
|
|
|
|
|
|
|
IRCDDBAppRptrObject newRptr(dt, key, value);
|
|
|
|
IRCDDBAppRptrObject newRptr(dt, key, value);
|
|
|
|
|
|
|
|
|
|
|
|
d->rptrMap[key] = newRptr;
|
|
|
|
d->rptrMap[key] = newRptr;
|
|
|
|
|
|
|
|
|
|
|
|
if (d->initReady)
|
|
|
|
if (d->initReady) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxString arearp_cs = key;
|
|
|
|
wxString arearp_cs = key;
|
|
|
|
wxString zonerp_cs = value;
|
|
|
|
wxString zonerp_cs = value;
|
|
|
|
|
|
|
|
|
|
|
|
@ -936,9 +856,7 @@ void IRCDDBApp::doUpdate ( wxString& msg )
|
|
|
|
m2->addParam(getIPAddress(value));
|
|
|
|
m2->addParam(getIPAddress(value));
|
|
|
|
d->replyQ.putMessage(m2);
|
|
|
|
d->replyQ.putMessage(m2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if ((tableID == 0) && d->initReady) {
|
|
|
|
else if ((tableID == 0) && d->initReady)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
wxMutexLocker lock(d->rptrMapMutex);
|
|
|
|
wxMutexLocker lock(d->rptrMapMutex);
|
|
|
|
|
|
|
|
|
|
|
|
wxString userCallsign = key;
|
|
|
|
wxString userCallsign = key;
|
|
|
|
@ -949,8 +867,7 @@ void IRCDDBApp::doUpdate ( wxString& msg )
|
|
|
|
userCallsign.Replace(wxT("_"), wxT(" "));
|
|
|
|
userCallsign.Replace(wxT("_"), wxT(" "));
|
|
|
|
arearp_cs.Replace(wxT("_"), wxT(" "));
|
|
|
|
arearp_cs.Replace(wxT("_"), wxT(" "));
|
|
|
|
|
|
|
|
|
|
|
|
if (d->rptrMap.count(value) == 1)
|
|
|
|
if (d->rptrMap.count(value) == 1) {
|
|
|
|
{
|
|
|
|
|
|
|
|
IRCDDBAppRptrObject o = d->rptrMap[value];
|
|
|
|
IRCDDBAppRptrObject o = d->rptrMap[value];
|
|
|
|
zonerp_cs = o.zonerp_cs;
|
|
|
|
zonerp_cs = o.zonerp_cs;
|
|
|
|
zonerp_cs.Replace(wxT("_"), wxT(" "));
|
|
|
|
zonerp_cs.Replace(wxT("_"), wxT(" "));
|
|
|
|
@ -978,23 +895,15 @@ void IRCDDBApp::doUpdate ( wxString& msg )
|
|
|
|
|
|
|
|
|
|
|
|
static wxString getTableIDString( int tableID, bool spaceBeforeNumber )
|
|
|
|
static wxString getTableIDString( int tableID, bool spaceBeforeNumber )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (tableID == 0)
|
|
|
|
if (tableID == 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return wxT("");
|
|
|
|
return wxT("");
|
|
|
|
}
|
|
|
|
} else if ((tableID > 0) && (tableID < numberOfTables)) {
|
|
|
|
else if ((tableID > 0) && (tableID < numberOfTables))
|
|
|
|
if (spaceBeforeNumber) {
|
|
|
|
{
|
|
|
|
|
|
|
|
if (spaceBeforeNumber)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return wxString::Format(wxT(" %d"),tableID);
|
|
|
|
return wxString::Format(wxT(" %d"),tableID);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return wxString::Format(wxT("%d "),tableID);
|
|
|
|
return wxString::Format(wxT("%d "),tableID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return wxT(" TABLE_ID_OUT_OF_RANGE ");
|
|
|
|
return wxT(" TABLE_ID_OUT_OF_RANGE ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1003,45 +912,33 @@ static wxString getTableIDString( int tableID, bool spaceBeforeNumber )
|
|
|
|
void IRCDDBApp::msgQuery (IRCMessage * m)
|
|
|
|
void IRCDDBApp::msgQuery (IRCMessage * m)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (m->getPrefixNick().StartsWith(wxT("s-")) && (m->numParams >= 2)) // server msg
|
|
|
|
if (m->getPrefixNick().StartsWith(wxT("s-")) && (m->numParams >= 2)) { // server msg
|
|
|
|
{
|
|
|
|
|
|
|
|
wxString msg = m->params[1];
|
|
|
|
wxString msg = m->params[1];
|
|
|
|
wxStringTokenizer tkz(msg);
|
|
|
|
wxStringTokenizer tkz(msg);
|
|
|
|
|
|
|
|
|
|
|
|
if (!tkz.HasMoreTokens())
|
|
|
|
if (!tkz.HasMoreTokens()) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return; // no text in message
|
|
|
|
return; // no text in message
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString cmd = tkz.GetNextToken();
|
|
|
|
wxString cmd = tkz.GetNextToken();
|
|
|
|
|
|
|
|
|
|
|
|
if (cmd.IsSameAs(wxT("UPDATE")))
|
|
|
|
if (cmd.IsSameAs(wxT("UPDATE"))) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxString restOfLine = tkz.GetString();
|
|
|
|
wxString restOfLine = tkz.GetString();
|
|
|
|
doUpdate(restOfLine);
|
|
|
|
doUpdate(restOfLine);
|
|
|
|
}
|
|
|
|
} else if (cmd.IsSameAs(wxT("LIST_END"))) {
|
|
|
|
else if (cmd.IsSameAs(wxT("LIST_END")))
|
|
|
|
if (d->state == 5) { // if in sendlist processing state
|
|
|
|
{
|
|
|
|
|
|
|
|
if (d->state == 5) // if in sendlist processing state
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 3; // get next table
|
|
|
|
d->state = 3; // get next table
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (cmd.IsSameAs(wxT("LIST_MORE"))) {
|
|
|
|
else if (cmd.IsSameAs(wxT("LIST_MORE")))
|
|
|
|
if (d->state == 5) { // if in sendlist processing state
|
|
|
|
{
|
|
|
|
|
|
|
|
if (d->state == 5) // if in sendlist processing state
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 4; // send next SENDLIST
|
|
|
|
d->state = 4; // send next SENDLIST
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (cmd.IsSameAs(wxT("NOT_FOUND"))) {
|
|
|
|
else if (cmd.IsSameAs(wxT("NOT_FOUND")))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
wxString callsign;
|
|
|
|
wxString callsign;
|
|
|
|
wxString restOfLine = tkz.GetString();
|
|
|
|
wxString restOfLine = tkz.GetString();
|
|
|
|
doNotFound(restOfLine, callsign);
|
|
|
|
doNotFound(restOfLine, callsign);
|
|
|
|
|
|
|
|
|
|
|
|
if (callsign.Len() > 0)
|
|
|
|
if (callsign.Len() > 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
callsign.Replace(wxT("_"), wxT(" "));
|
|
|
|
callsign.Replace(wxT("_"), wxT(" "));
|
|
|
|
|
|
|
|
|
|
|
|
IRCMessage * m2 = new IRCMessage(wxT("IDRT_USER"));
|
|
|
|
IRCMessage * m2 = new IRCMessage(wxT("IDRT_USER"));
|
|
|
|
@ -1071,8 +968,7 @@ IRCMessageQueue * IRCDDBApp::getSendQ()
|
|
|
|
static wxString getLastEntryTime(int tableID)
|
|
|
|
static wxString getLastEntryTime(int tableID)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (tableID == 1)
|
|
|
|
if (tableID == 1) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxString max = IRCDDBAppRptrObject::maxTime.Format( wxT("%Y-%m-%d %H:%M:%S") );
|
|
|
|
wxString max = IRCDDBAppRptrObject::maxTime.Format( wxT("%Y-%m-%d %H:%M:%S") );
|
|
|
|
return max;
|
|
|
|
return max;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1092,20 +988,16 @@ wxThread::ExitCode IRCDDBApp::Entry()
|
|
|
|
|
|
|
|
|
|
|
|
int sendlistTableID = 0;
|
|
|
|
int sendlistTableID = 0;
|
|
|
|
|
|
|
|
|
|
|
|
while (!d->terminateThread)
|
|
|
|
while (!d->terminateThread) {
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (d->timer > 0)
|
|
|
|
if (d->timer > 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->timer --;
|
|
|
|
d->timer --;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(d->state)
|
|
|
|
switch(d->state) {
|
|
|
|
{
|
|
|
|
|
|
|
|
case 0: // wait for network to start
|
|
|
|
case 0: // wait for network to start
|
|
|
|
|
|
|
|
|
|
|
|
if (getSendQ() != NULL)
|
|
|
|
if (getSendQ() != NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 1;
|
|
|
|
d->state = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
@ -1118,28 +1010,21 @@ wxThread::ExitCode IRCDDBApp::Entry()
|
|
|
|
|
|
|
|
|
|
|
|
case 2: // choose server
|
|
|
|
case 2: // choose server
|
|
|
|
wxLogVerbose(wxT("IRCDDBApp: state=2 choose new 's-'-user"));
|
|
|
|
wxLogVerbose(wxT("IRCDDBApp: state=2 choose new 's-'-user"));
|
|
|
|
if (getSendQ() == NULL)
|
|
|
|
if (getSendQ() == NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 10;
|
|
|
|
d->state = 10;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
if (findServerUser()) {
|
|
|
|
{
|
|
|
|
|
|
|
|
if (findServerUser())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sendlistTableID = numberOfTables;
|
|
|
|
sendlistTableID = numberOfTables;
|
|
|
|
|
|
|
|
|
|
|
|
d->state = 3; // next: send "SENDLIST"
|
|
|
|
d->state = 3; // next: send "SENDLIST"
|
|
|
|
}
|
|
|
|
} else if (d->timer == 0) {
|
|
|
|
else if (d->timer == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 10;
|
|
|
|
d->state = 10;
|
|
|
|
IRCMessage * m = new IRCMessage(wxT("QUIT"));
|
|
|
|
IRCMessage * m = new IRCMessage(wxT("QUIT"));
|
|
|
|
|
|
|
|
|
|
|
|
m->addParam(wxT("no op user with 's-' found."));
|
|
|
|
m->addParam(wxT("no op user with 's-' found."));
|
|
|
|
|
|
|
|
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
if (q != NULL)
|
|
|
|
if (q != NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
q->putMessage(m);
|
|
|
|
q->putMessage(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1147,19 +1032,13 @@ wxThread::ExitCode IRCDDBApp::Entry()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
case 3:
|
|
|
|
if (getSendQ() == NULL)
|
|
|
|
if (getSendQ() == NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sendlistTableID --;
|
|
|
|
sendlistTableID --;
|
|
|
|
if (sendlistTableID < 0)
|
|
|
|
if (sendlistTableID < 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 6; // end of sendlist
|
|
|
|
d->state = 6; // end of sendlist
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
wxLogVerbose(wxT("IRCDDBApp: state=3 tableID=%d"), sendlistTableID);
|
|
|
|
wxLogVerbose(wxT("IRCDDBApp: state=3 tableID=%d"), sendlistTableID);
|
|
|
|
d->state = 4; // send "SENDLIST"
|
|
|
|
d->state = 4; // send "SENDLIST"
|
|
|
|
d->timer = 900; // 15 minutes max for update
|
|
|
|
d->timer = 900; // 15 minutes max for update
|
|
|
|
@ -1168,48 +1047,37 @@ wxThread::ExitCode IRCDDBApp::Entry()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
case 4:
|
|
|
|
if (getSendQ() == NULL)
|
|
|
|
if (getSendQ() == NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
if (needsDatabaseUpdate(sendlistTableID)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
if (needsDatabaseUpdate(sendlistTableID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IRCMessage * m = new IRCMessage(d->currentServer,
|
|
|
|
IRCMessage * m = new IRCMessage(d->currentServer,
|
|
|
|
wxT("SENDLIST") + getTableIDString(sendlistTableID, true)
|
|
|
|
wxT("SENDLIST") + getTableIDString(sendlistTableID, true)
|
|
|
|
+ wxT(" ") + getLastEntryTime(sendlistTableID) );
|
|
|
|
+ wxT(" ") + getLastEntryTime(sendlistTableID) );
|
|
|
|
|
|
|
|
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
if (q != NULL)
|
|
|
|
if (q != NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
q->putMessage(m);
|
|
|
|
q->putMessage(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
d->state = 5; // wait for answers
|
|
|
|
d->state = 5; // wait for answers
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 3; // don't send SENDLIST for this table, go to next table
|
|
|
|
d->state = 3; // don't send SENDLIST for this table, go to next table
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 5: // sendlist processing
|
|
|
|
case 5: // sendlist processing
|
|
|
|
if (getSendQ() == NULL)
|
|
|
|
if (getSendQ() == NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
}
|
|
|
|
} else if (d->timer == 0) {
|
|
|
|
else if (d->timer == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
IRCMessage * m = new IRCMessage(wxT("QUIT"));
|
|
|
|
IRCMessage * m = new IRCMessage(wxT("QUIT"));
|
|
|
|
|
|
|
|
|
|
|
|
m->addParam(wxT("timeout SENDLIST"));
|
|
|
|
m->addParam(wxT("timeout SENDLIST"));
|
|
|
|
|
|
|
|
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
if (q != NULL)
|
|
|
|
if (q != NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
q->putMessage(m);
|
|
|
|
q->putMessage(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1217,12 +1085,9 @@ wxThread::ExitCode IRCDDBApp::Entry()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
case 6:
|
|
|
|
if (getSendQ() == NULL)
|
|
|
|
if (getSendQ() == NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
wxLogVerbose(wxT( "IRCDDBApp: state=6 initialization completed"));
|
|
|
|
wxLogVerbose(wxT( "IRCDDBApp: state=6 initialization completed"));
|
|
|
|
|
|
|
|
|
|
|
|
d->infoTimer = 2;
|
|
|
|
d->infoTimer = 2;
|
|
|
|
@ -1234,37 +1099,30 @@ wxThread::ExitCode IRCDDBApp::Entry()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 7: // standby state after initialization
|
|
|
|
case 7: // standby state after initialization
|
|
|
|
if (getSendQ() == NULL)
|
|
|
|
if (getSendQ() == NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
d->state = 10; // disconnect DB
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (d->infoTimer > 0)
|
|
|
|
if (d->infoTimer > 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->infoTimer --;
|
|
|
|
d->infoTimer --;
|
|
|
|
|
|
|
|
|
|
|
|
if (d->infoTimer == 0)
|
|
|
|
if (d->infoTimer == 0) {
|
|
|
|
{
|
|
|
|
if (d->rptrLocation.Len() > 0) {
|
|
|
|
if (d->rptrLocation.Len() > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IRCMessage * m = new IRCMessage(d->currentServer,
|
|
|
|
IRCMessage * m = new IRCMessage(d->currentServer,
|
|
|
|
wxT("IRCDDB QTH: ") + d->rptrLocation);
|
|
|
|
wxT("IRCDDB QTH: ") + d->rptrLocation);
|
|
|
|
|
|
|
|
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
if (q != NULL)
|
|
|
|
if (q != NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
q->putMessage(m);
|
|
|
|
q->putMessage(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (d->rptrInfoURL.Len() > 0)
|
|
|
|
if (d->rptrInfoURL.Len() > 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
IRCMessage * m = new IRCMessage(d->currentServer,
|
|
|
|
IRCMessage * m = new IRCMessage(d->currentServer,
|
|
|
|
wxT("IRCDDB URL: ") + d->rptrInfoURL);
|
|
|
|
wxT("IRCDDB URL: ") + d->rptrInfoURL);
|
|
|
|
|
|
|
|
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
if (q != NULL)
|
|
|
|
if (q != NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
q->putMessage(m);
|
|
|
|
q->putMessage(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1272,26 +1130,22 @@ wxThread::ExitCode IRCDDBApp::Entry()
|
|
|
|
wxMutexLocker lock(d->moduleMapMutex);
|
|
|
|
wxMutexLocker lock(d->moduleMapMutex);
|
|
|
|
|
|
|
|
|
|
|
|
IRCDDBAppModuleMap::iterator it;
|
|
|
|
IRCDDBAppModuleMap::iterator it;
|
|
|
|
for( it = d->moduleMap.begin(); it != d->moduleMap.end(); ++it )
|
|
|
|
for( it = d->moduleMap.begin(); it != d->moduleMap.end(); ++it ) {
|
|
|
|
{
|
|
|
|
|
|
|
|
wxString value = it->second;
|
|
|
|
wxString value = it->second;
|
|
|
|
IRCMessage * m = new IRCMessage(d->currentServer,
|
|
|
|
IRCMessage * m = new IRCMessage(d->currentServer,
|
|
|
|
wxT("IRCDDB QRG: ") + value);
|
|
|
|
wxT("IRCDDB QRG: ") + value);
|
|
|
|
|
|
|
|
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
if (q != NULL)
|
|
|
|
if (q != NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
q->putMessage(m);
|
|
|
|
q->putMessage(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (d->wdTimer > 0)
|
|
|
|
if (d->wdTimer > 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->wdTimer --;
|
|
|
|
d->wdTimer --;
|
|
|
|
if (d->wdTimer == 0)
|
|
|
|
if (d->wdTimer == 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
d->wdTimer = 900; // 15 minutes
|
|
|
|
d->wdTimer = 900; // 15 minutes
|
|
|
|
|
|
|
|
|
|
|
|
IRCMessage * m = new IRCMessage(d->currentServer,
|
|
|
|
IRCMessage * m = new IRCMessage(d->currentServer,
|
|
|
|
@ -1300,8 +1154,7 @@ wxThread::ExitCode IRCDDBApp::Entry()
|
|
|
|
wxString::Format(wxT(" %d"), d->wdCounter ));
|
|
|
|
wxString::Format(wxT(" %d"), d->wdCounter ));
|
|
|
|
|
|
|
|
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
IRCMessageQueue * q = getSendQ();
|
|
|
|
if (q != NULL)
|
|
|
|
if (q != NULL) {
|
|
|
|
{
|
|
|
|
|
|
|
|
q->putMessage(m);
|
|
|
|
q->putMessage(m);
|
|
|
|
d->wdCounter = 0;
|
|
|
|
d->wdCounter = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|