From 27dec235fbd51269d89ffd3ab7ecb1eb305a1b91 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Wed, 14 Feb 2018 16:38:33 -0700 Subject: [PATCH] added .gitignore and minor formatting --- .gitignore | 7 +++++++ IRCDDBApp.cpp | 54 ++++++++++++++++----------------------------------- 2 files changed, 24 insertions(+), 37 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ac421c --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.o +dvap_rptr +dvrptr +g2_link +g2_ircddb +g2link_test +g2link_test_audio diff --git a/IRCDDBApp.cpp b/IRCDDBApp.cpp index 440dae3..01bbf2e 100644 --- a/IRCDDBApp.cpp +++ b/IRCDDBApp.cpp @@ -20,9 +20,7 @@ public: bool op; unsigned int usn; - IRCDDBAppUserObject() { -// IRCDDBAppUserObject ("", "", ""); - } + IRCDDBAppUserObject() {} IRCDDBAppUserObject(const std::string &n, const std::string &nm, const std::string &h) { nick = n; @@ -311,10 +309,7 @@ void IRCDDBApp::userJoin(const std::string &nick, const std::string &name, const //traceit("user %d\n", u.usn); } - - - -void IRCDDBApp::userLeave (const std::string &nick) +void IRCDDBApp::userLeave(const std::string &nick) { std::string lnick = nick; ToLower(lnick); @@ -421,11 +416,11 @@ bool IRCDDBApp::findServerUser() return found; } -void IRCDDBApp::userChanOp (const std::string &nick, bool op) +void IRCDDBApp::userChanOp(const std::string &nick, bool op) { std::string lnick = nick; ToLower(lnick); - + d->userMapMutex.lock(); if (d->user.count(lnick) == 1) { d->user[lnick].op = op; @@ -466,7 +461,6 @@ std::string IRCDDBApp::getIPAddress(std::string &zonerp_cs) return ipAddr; } - bool IRCDDBApp::findGateway(const std::string &gwCall) { std::string s = gwCall.substr(0,6); @@ -546,12 +540,16 @@ bool IRCDDBApp::findRepeater(const std::string &rptrCall) return true; } - -bool IRCDDBApp::sendHeard(const std::string &myCall, const std::string &myCallExt, - const std::string &yourCall, const std::string &rpt1, - const std::string &rpt2, unsigned char flag1, - unsigned char flag2, unsigned char flag3, - const std::string &destination, const std::string &tx_msg, +bool IRCDDBApp::sendHeard(const std::string &myCall, + const std::string &myCallExt, + const std::string &yourCall, + const std::string &rpt1, + const std::string &rpt2, + unsigned char flag1, + unsigned char flag2, + unsigned char flag3, + const std::string &destination, + const std::string &tx_msg, const std::string &tx_stats) { @@ -657,7 +655,6 @@ bool IRCDDBApp::findUser(const std::string &usrCall) return true; } - void IRCDDBApp::msgChannel(IRCMessage *m) { if (0==m->getPrefixNick().compare(0, 2, "s-") && (m->numParams >= 2)) { // server msg @@ -665,7 +662,6 @@ void IRCDDBApp::msgChannel(IRCMessage *m) } } - void IRCDDBApp::doNotFound(std::string &msg, std::string &retval) { int tableID = 0; @@ -810,7 +806,7 @@ void IRCDDBApp::doUpdate(std::string &msg) m2->addParam(ip_addr); m2->addParam(tk + std::string(" ") + timeToken); d->replyQ.putMessage(m2); - + d->rptrMapMutex.unlock(); } @@ -818,7 +814,6 @@ void IRCDDBApp::doUpdate(std::string &msg) } } - static std::string getTableIDString(int tableID, bool spaceBeforeNumber) { if (tableID == 0) { @@ -834,7 +829,6 @@ static std::string getTableIDString(int tableID, bool spaceBeforeNumber) } } - void IRCDDBApp::msgQuery(IRCMessage *m) { @@ -891,7 +885,6 @@ void IRCDDBApp::msgQuery(IRCMessage *m) } } - void IRCDDBApp::setSendQ(IRCMessageQueue *s) { d->sendQ = s; @@ -902,7 +895,6 @@ IRCMessageQueue *IRCDDBApp::getSendQ() return d->sendQ; } - static std::string getLastEntryTime(int tableID) { @@ -917,16 +909,8 @@ static std::string getLastEntryTime(int tableID) return "DBERROR"; } - -static bool needsDatabaseUpdate(int tableID) -{ - return 1==tableID; -} - - void IRCDDBApp::Entry() { - int sendlistTableID = 0; while (!d->terminateThread) { @@ -991,7 +975,7 @@ void IRCDDBApp::Entry() if (getSendQ() == NULL) { d->state = 10; // disconnect DB } else { - if (needsDatabaseUpdate(sendlistTableID)) { + if (1 == sendlistTableID) { IRCMessage *m = new IRCMessage(d->currentServer, std::string("SENDLIST") + getTableIDString(sendlistTableID, true) + std::string(" ") + getLastEntryTime(sendlistTableID)); @@ -1001,7 +985,7 @@ void IRCDDBApp::Entry() d->state = 5; // wait for answers } 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 (tableID 0), go to next table } break; @@ -1122,7 +1106,3 @@ void IRCDDBApp::Entry() return; } // Entry() - - - -