]> jfr.im git - irc/evilnet/mod.chanfix.git/commitdiff
Here we are, the way I should of done this first time
authorsirvulcan <redacted>
Tue, 18 Apr 2006 04:03:59 +0000 (04:03 +0000)
committersirvulcan <redacted>
Tue, 18 Apr 2006 04:03:59 +0000 (04:03 +0000)
40 files changed:
ADDFLAGCommand.cc
ADDHOSTCommand.cc
ADDNOTECommand.cc
ADDUSERCommand.cc
ALERTCommand.cc
BLOCKCommand.cc
CHANFIXCommand.cc
CHECKCommand.cc
DEBUGCommand.cc
DELFLAGCommand.cc
DELHOSTCommand.cc
DELNOTECommand.cc
DELUSERCommand.cc
HISTORYCommand.cc
INFOCommand.cc
INVITECommand.cc
LASTCOMCommand.cc
LISTBLOCKEDCommand.cc
LISTHOSTSCommand.cc
OPLISTCommand.cc
OPNICKSCommand.cc
QUOTECommand.cc
REHASHCommand.cc
RELOADCommand.cc
REQUESTOPCommand.cc
SCORECommand.cc
SETCommand.cc
SETGROUPCommand.cc
SHUTDOWNCommand.cc
STATUSCommand.cc
SUSPENDCommand.cc
UNALERTCommand.cc
UNBLOCKCommand.cc
UNSUSPENDCommand.cc
USERSCORESCommand.cc
USETCommand.cc
WHOGROUPCommand.cc
WHOISCommand.cc
chanfix.cc
chanfix.h

index 333979cd97717e19ed3ec2f928f0c0819929a426..6fcac88f112ae358bc134dba3d6457a81bcb3c79 100644 (file)
@@ -141,6 +141,8 @@ bot->logAdminMessage("%s (%s) ADDFLAG %s %c",
                     theClient->getRealNickUserHost().c_str(),
                     targetUser->getUserName().c_str(), flag);
 
+bot->logLastComMessage(theClient, Message);
+
 } //ADDFLAGCommand::Exec
 } //Namespace cf
 } //Namespace gnuworld
index e8a5e943390c7e6b0c591ec91b6d64e27786aa79..ac0eb2935d969b765c4171d4fc494100dd546c04 100644 (file)
@@ -127,6 +127,8 @@ bot->logAdminMessage("%s (%s) ADDHOST %s %s",
                     theClient->getRealNickUserHost().c_str(), 
                     targetUser->getUserName().c_str(), st[2].c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index 811475d65b092c347131d1e9a39aef9d39bad64c..f028fe5a2434fdbe12958a3387a2d0390a51366b 100644 (file)
@@ -70,6 +70,8 @@ bot->logAdminMessage("%s (%s) ADDNOTE %s %s",
                     theClient->getRealNickUserHost().c_str(),
                     theChan->getChannel().c_str(), st.assemble(2).c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 } // namespace cf
index 1ff45f50c50bb55320dcba44ed4590806d88e968..ac2629f26a0c7f9f341ebc58d214d0ddd17c2e4e 100644 (file)
@@ -111,6 +111,8 @@ if (st.size() > 2) {
                       st[1].c_str());
 }
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 } //ADDUSERCommand::Exec
 } //namespace cf
index 966be4507ceb0907c33a2b801b068e1d1f9035f6..0b581e5da5248cf38ea4e000a41cb268f98bc1a7 100644 (file)
@@ -86,6 +86,8 @@ bot->logAdminMessage("%s (%s) ALERT %s",
                     theClient->getRealNickUserHost().c_str(),
                     theChan->getChannel().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 } // namespace cf
index afece602a5360358540afd2dd7bd2869e04d4732..fe769a3a5dd89aee82aaedf465ad1eeda71712cb 100644 (file)
@@ -121,6 +121,8 @@ bot->logAdminMessage("%s (%s) BLOCK %s%s",
                     theChan->getChannel().c_str(),
                     extraLog.c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 } // namespace cf
index 87047ce1952599f83b1cf1de36688676f73c61c9..24766916770e7218bec16b4d5ab9479ff575e8b5 100644 (file)
@@ -207,6 +207,8 @@ bot->logAdminMessage("%s (%s) CHANFIX %s%s",
                     netChan->getName().c_str(),
                     (override) ? " [override]" : "");
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index 2fa8ccca3a2621a3c2d9f39d2fdd3d0a3b83187d..1a189e47db60277b47c27a799cd6a6b643504570 100644 (file)
@@ -65,6 +65,8 @@ bot->logAdminMessage("%s (%s) CHECK %s",
                     theClient->getRealNickUserHost().c_str(),
                     netChan->getName().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index 2abbcdf6c33d3db421bf6b2891ca88b0abcba554..ab127f8ab31a3f8260aaf37a3dfd2189f3a2adb7 100644 (file)
@@ -81,6 +81,8 @@ if (option == "UPDATE") {
   }
 }
 
+bot->logLastComMessage(theClient, Message);
+
 }
 
 } // namespace cf
index 96a76759e99c179d88e6ccd7bdac81c2d7eebabf..86562c5bdbc5065aa16f6efd7c1acf2c3fa0618f 100644 (file)
@@ -140,6 +140,8 @@ bot->logAdminMessage("%s (%s) DELFLAG %s %c",
                     theClient->getRealNickUserHost().c_str(),
                     targetUser->getUserName().c_str(), flag);
 
+bot->logLastComMessage(theClient, Message);
+
 } //DELFLAGCommand::Exec
 
 } //Namespace cf
index cf0218aaa345b7e6dd1f6df9d8bed136dce61eed..f3808fc05c0ab3579936a23143960178373dd972 100644 (file)
@@ -117,6 +117,8 @@ bot->logAdminMessage("%s (%s) DELHOST %s %s",
                     theClient->getRealNickUserHost().c_str(),
                     targetUser->getUserName().c_str(), st[2].c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index 469477d6068672bc0590042478e35fb05f03e26c..b8280ed4df74a23e00524cf28359b0d9f24c68f3 100644 (file)
@@ -146,6 +146,8 @@ bot->logAdminMessage("%s (%s) DELNOTE %s %d",
                     theClient->getRealNickUserHost().c_str(),
                     theChan->getChannel().c_str(), messageId);
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index 60b241067624519e7e0b25553cd6697c22d75468..05524104458736ec7fd2341affb46768d36a5ce8 100644 (file)
@@ -99,6 +99,8 @@ if (targetUser->Delete()) {
                        std::string("Error deleting user %s.")).c_str(), st[1].c_str());
 }
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 } //DELUSERCommand::Exec
 
index 3e97f32d7ba857b4e7855df2f531925e86a1cb1a..d8c9fcadb08d275dfbf2d0f6a08d6dde756d74f2 100644 (file)
@@ -120,6 +120,8 @@ bot->logAdminMessage("%s (%s) HISTORY %s",
                     theClient->getRealNickUserHost().c_str(),
                     theChan->getChannel().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index 99d79810c27f5b681bd001ceadad183ef061ac98..f5a818efd4a9dbe669d26eff66ddd8bb7b4226c5 100644 (file)
@@ -201,6 +201,8 @@ bot->logAdminMessage("%s (%s) INFO %s",
                     theClient->getRealNickUserHost().c_str(),
                     theChan->getChannel().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index 2f959bd3720027dfb5743b10d7cded0162f57de3..1c622c57c7564f12436fc8355cc66c94e81b457a 100644 (file)
@@ -85,6 +85,8 @@ bot->logAdminMessage("%s (%s) INVITE %s [CODER-CHAN]",
                     theClient->getRealNickUserHost().c_str(),
                     theChannel->getName().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index 0204c3d8edd5e41670170aa8aef4a8c12f3786bc..737fbe06f188b31fa880236e634e6672e9ac0295 100644 (file)
@@ -125,6 +125,8 @@ bot->SendTo(theClient,
 /* Dispose of our connection instance */
 bot->theManager->removeConnection(cacheCon);
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index daa2d667a08236e7f9a8ca9c215ae6763affb13c..5ec13d3211fa6217cb05978c0d89a784cc65fb89 100644 (file)
@@ -39,7 +39,7 @@ namespace gnuworld
 {
 namespace cf
 {
-void LISTBLOCKEDCommand::Exec(iClient* theClient, sqlUser* theUser, const std::string&)
+void LISTBLOCKEDCommand::Exec(iClient* theClient, sqlUser* theUser, const std::string& Message)
 {
 
 /* Check if channel blocking has been disabled in the config. */
@@ -102,6 +102,8 @@ bot->logAdminMessage("%s (%s) LISTBLOCKED",
                     theUser->getUserName().c_str(),
                     theClient->getRealNickUserHost().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 } // namespace cf
index 11174cddd0bc0158f834587e753b3f518354bf04..db5416f9a8ed58d891c019ae3faaf874b41f4fda 100644 (file)
@@ -104,6 +104,8 @@ bot->logAdminMessage("%s (%s) LISTHOSTS %s",
                     theClient->getRealNickUserHost().c_str(),
                     targetUser->getUserName().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 } //LISTHOSTSCommand::Exec
 
index 96c295ee9769ff93fdf33f5a519bee3e7f9bfc40..9220308189f5fcff57ad91d752a097ae1ba40f17 100644 (file)
@@ -181,6 +181,8 @@ bot->logAdminMessage("%s (%s) OPLIST %s %s",
                     st[1].c_str(),
                     (st.size() > 2) ? st.assemble(2).c_str() : "");
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index b4413af5714c16039de63e1d67c6f5453b39fb78..27ecb1760f50bd1499b1e86f229008aa0134d122 100644 (file)
@@ -98,6 +98,8 @@ bot->logAdminMessage("%s (%s) OPNICKS %s",
                     theClient->getRealNickUserHost().c_str(),
                     netChan->getName().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index cc7fcf4f66fad2d1abbd22c222b9f1d0bd75c683..5d252f5f8ced24c1dd264212e84fd9697a1353b5 100644 (file)
@@ -62,6 +62,8 @@ bot->logAdminMessage("%s (%s) QUOTE %s",
                     theClient->getRealNickUserHost().c_str(),
                     st.assemble(1).c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index b27355c641e3ead9720c99b8a85119fd34d91f32..878129b3a8088d2f763cd9df3974149b2f155821 100644 (file)
@@ -90,6 +90,7 @@ bot->logAdminMessage("%s (%s) REHASH %s",
                     theClient->getRealNickUserHost().c_str(),
                     !option.empty() ? option.c_str() : "");
 
+bot->logLastComMessage(theClient, Message);
 
 return;
 }
index 8d8f64b36852524444975d8922b4ed5c4a38d37a..fe10ac750bb50bf0dce94144e6e2893391d486b0 100644 (file)
@@ -73,6 +73,8 @@ else
 
 server->LoadClient("libchanfix", bot->getConfigFileName());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index 3cb1e23e2a46b3bcf493adb81bd2fd4adee67b51..38e18a683bfa8ddd7aee1755a72d2e2275963f22 100644 (file)
@@ -252,6 +252,9 @@ bot->logAdminMessage("%s (%s) REQUESTOP %s %s",
                     theUser ? theUser->getUserName().c_str() : theClient->getUserName().c_str(),
                     theClient->getRealNickUserHost().c_str(), netChan->getName().c_str(),
                     (alert) ? " [alert]" : "");
+
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index de052af9002f8f0d62d3413a660f8f24369cc722..80d28ed763508cc6c4a7a7f768c29d831a6543ca 100644 (file)
@@ -321,6 +321,7 @@ if (compact) {
     bot->SendTo(theClient, strScoresNOP.str());
 }
 
+bot->logLastComMessage(theClient, Message);
 
 return;
 }
index b93609078464ac492dc0b835aac9ccd8c9d3e3c0..e4947eee265f2366e18b00250f19012c0de0fb6a 100644 (file)
@@ -179,6 +179,8 @@ bot->SendTo(theClient,
                             language::setting_doesnt_exist,
                             std::string("This setting does not exist.")).c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index f15108393fbaf2e6433498ff390d3677c495aeed..55dd9122af6e5ce93c14ddf95d0e6dffa3963fde 100644 (file)
@@ -82,6 +82,8 @@ bot->logAdminMessage("%s (%s) SETGROUP %s %s",
            targetUser->getUserName().c_str(),
            group.c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 } //SETGROUPCommand::Exec
 } //namespace cf
index cf61c33ebfccf9ff3299f819c04973f2c80c1ff4..134f7d4c776425d426bee100c07a35bced35ed5c 100644 (file)
@@ -70,6 +70,8 @@ if (st.size() < 2)
 else
   server->Shutdown( st.assemble(1) );
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index 636cec48b9cd283891c8b4a9be0a850269e7bd04..06b552075b122e003177b3aca0eebd3cb8898526 100644 (file)
@@ -41,7 +41,7 @@ namespace gnuworld
 namespace cf
 {
 
-void STATUSCommand::Exec(iClient* theClient, sqlUser* theUser, const std::string&)
+void STATUSCommand::Exec(iClient* theClient, sqlUser* theUser, const std::string& Message)
 {
 
 bot->SendTo(theClient, "[evilnet development's GNUWorld %s]",
@@ -99,6 +99,7 @@ bot->logAdminMessage("%s (%s) STATUS",
                     theUser ? theUser->getUserName().c_str() : "!NOT-LOGGED-IN!",
                     theClient->getRealNickUserHost().c_str());
 
+bot->logLastComMessage(theClient, Message);
 
 return;
 }
index 16d01fad0163b7935a6e1e588108a07e850e06b0..0afa179b5f61b021945d154af974a1276072655a 100644 (file)
@@ -118,6 +118,8 @@ bot->logAdminMessage("%s (%s) SUSPEND %s",
                     theClient->getRealNickUserHost().c_str(),
                     targetUser->getUserName().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 } //SUSPENDCommand::Exec
 } //Namespace cf
index 1f63fba8cdc77cbd82f06652ddbae21d5cd60fde..37400ef46113329d7d4ffca332aaf304023d54eb 100644 (file)
@@ -84,6 +84,8 @@ bot->logAdminMessage("%s (%s) UNALERT %s",
                     theClient->getRealNickUserHost().c_str(),
                     theChan->getChannel().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 } // namespace cf
index 0deb8cea2ac5a8ff04d23292447c3f31fe107204..5dc87c372d37f4ab1a74184ac2583c03fa8d7070 100644 (file)
@@ -93,6 +93,8 @@ bot->logAdminMessage("%s (%s) UNBLOCK %s",
                     theClient->getRealNickUserHost().c_str(),
                     theChan->getChannel().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 } // namespace cf
index 0fe5d33c3a2a0a2549637c5a09a7d4c9b34f05e9..db86413e803e980938ab0c4e94ffb4699aea487c 100644 (file)
@@ -109,6 +109,8 @@ bot->logAdminMessage("%s (%s) UNSUSPEND %s",
                     theClient->getRealNickUserHost().c_str(),
                     targetUser->getUserName().c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 } //UNSUSPENDCommand::Exec
 } //namespace cf
index 51b4e3d0b4ea5ec39f6c47da9840f5d17ea2b0a2..b9b152017d79dbfe2a78cbce744b0c48e6b73a35 100644 (file)
@@ -86,6 +86,8 @@ bot->logAdminMessage("%s (%s) USERSCORES %s",
                     theClient->getRealNickUserHost().c_str(),
                     st[1].c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index a6e147b9bdedd4531b9d7359f7be146ba9210d3b..ed41bcc66b598dac811e020043e2522ab8e4ce5d 100644 (file)
@@ -139,6 +139,8 @@ bot->SendTo(theClient,
                             language::setting_doesnt_exist,
                             std::string("This setting does not exist.")).c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 }
 
index 197853fddbc49295efbe4ee4b5c70fd699129940..499c299a6b28e6f30e464be5eef6ffeb84ff43a7 100644 (file)
@@ -132,6 +132,8 @@ bot->SendTo(theClient,
                        std::string("Number of users: %d.")).c_str(),
                        numUsersInGroup);
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 } //WHOGROUPCommand::Exec
 } //namespace cf
index eda49ebc2f38b94201072436019576f9bac0ab79..ba25fd6f5129b4116819eb4a96af0741efa7c7c7 100644 (file)
@@ -174,6 +174,8 @@ if (st.size() > 2 && string_upper(st[2]) == "-MODIF")
                        theUser2->getLastUpdatedBy().c_str(),
                        bot->prettyDuration(theUser2->getLastUpdated()).c_str());
 
+bot->logLastComMessage(theClient, Message);
+
 return;
 } //WHOISCommand::Exec
 } //namespace cf
index 6e87ae58859d607220dc8a46d2531cc9bb92c3e4..298f81d244ea14bb6966ad51e7ace06ad9c89323 100644 (file)
@@ -208,7 +208,7 @@ RegisterCommand(new INVITECommand(this, "INVITE",
        sqlUser::F_OWNER
        ));
 RegisterCommand(new LASTCOMCommand(this, "LASTCOM",
-       "[days]",
+       "[amount of commands] [days from]",
        1,
        sqlUser::F_OWNER
        ));
@@ -714,37 +714,6 @@ if (theUser) {
 
 commHandler->second->Exec(theClient, theUser ? theUser : NULL, Message);
 
-if ((Command != "CANFIX" && Command != "HELP")) {
-  std::string log;
-  PgDatabase* cacheCon = theManager->getConnection();
-
-  static const char *Main = "INSERT into comlog (ts,user_name,command) VALUES (now()::abstime::int4,'";
-
-  std::stringstream insertString;
-  insertString << Main
-               << theClient->getAccount()
-               << "','"
-               << Command
-               << " ";
-  unsigned int pos = 1;
-  while (pos < st.size()) {
-    insertString << st[pos]
-                << " ";
-    pos++;
-  }
-
-  insertString << "')"
-               << std::ends;
-
-  if (!cacheCon->ExecCommandOk(insertString.str().c_str())) {
-    elog << "sqlChannel::Insert> Something went wrong: "
-        << cacheCon->ErrorMessage()
-        << std::endl;
-  }
-
-  theManager->removeConnection(cacheCon);
-}
-
 xClient::OnPrivateMessage(theClient, Message);
 }
 
@@ -883,6 +852,47 @@ for (xServer::opVectorType::const_iterator ptr = theTargets.begin();
 } // for
 }
 
+bool chanfix::logLastComMessage(iClient* theClient, const std::string& Message)
+{
+  StringTokenizer st(Message);
+  if (st.empty())
+    return false;
+
+  const std::string Command = string_upper(st[0]);
+
+  std::string log;
+  PgDatabase* cacheCon = theManager->getConnection();
+
+  static const char *Main = "INSERT into comlog (ts,user_name,command) VALUES (now()::abstime::int4,'";
+
+  std::stringstream insertString;
+  insertString << Main
+               << theClient->getAccount()
+               << "','"
+               << Command
+               << " ";
+
+  unsigned int pos = 1;
+  while (pos < st.size()) {
+    insertString << st[pos]
+                << " ";
+    pos++;
+  }
+
+  insertString << "')"
+               << std::ends;
+
+  if (!cacheCon->ExecCommandOk(insertString.str().c_str())) {
+    elog << "sqlChannel::Insert> Something went wrong: "
+        << cacheCon->ErrorMessage()
+        << std::endl;
+  }
+
+  theManager->removeConnection(cacheCon);
+
+  return true;
+}
+
 /* msgTopOps */
 bool chanfix::msgTopOps(Channel* netChan) {
 
index bb00f1702a07752bbf1c9a78c126978a0cbbe462..db9e3955b008ef76399dfdb536cc4123050258e9 100644 (file)
--- a/chanfix.h
+++ b/chanfix.h
@@ -228,6 +228,7 @@ public:
        void autoFix();
        void manualFix(Channel*);
 
+       bool logLastComMessage(iClient*, const std::string&);
        bool msgTopOps(Channel*);
 
        bool fixChan(sqlChannel*, bool);