]> jfr.im git - irc/evilnet/mod.chanfix.git/commitdiff
temporary channel blocking commands, works in with the automated temp block system...
authorsirvulcan <redacted>
Tue, 26 Sep 2006 06:14:42 +0000 (06:14 +0000)
committersirvulcan <redacted>
Tue, 26 Sep 2006 06:14:42 +0000 (06:14 +0000)
17 files changed:
CHANFIXCommand.cc
LISTTEMPBLOCKEDCommand.cc [new file with mode: 0644]
Makefile.am
Makefile.in
OPLISTCommand.cc
REQUESTOPCommand.cc
SCORECommand.cc
TEMPBLOCKCommand.cc [new file with mode: 0644]
UNTEMPBLOCKCommand.cc [new file with mode: 0644]
chanfix.cc
chanfix.h
chanfixCommands.h
doc/chanfix.help.sql
doc/chanfix.language.english.sql
responses.h
sqlChannel.cc
sqlChannel.h

index 24766916770e7218bec16b4d5ab9479ff575e8b5..b612469d5c09ba6df68275a2597ef329fbe8e356 100644 (file)
@@ -171,6 +171,16 @@ if (theChan->getFlag(sqlChannel::F_BLOCKED)) {
   return;
 }
 
+/* Don't fix a blocked channel. */
+if (bot->isTempBlocked(theChan->getChannel())) {
+  bot->SendTo(theClient,
+              bot->getResponse(theUser,
+                              language::channel_temp_blocked,
+                              std::string("The channel %s is TEMPBLOCKED.")).c_str(),
+                                          theChan->getChannel().c_str());
+  return;
+}
+
 /* Don't fix an alerted channel without the OVERRIDE flag. */
 if (theChan->getFlag(sqlChannel::F_ALERT) && !override) {
   bot->SendTo(theClient,
diff --git a/LISTTEMPBLOCKEDCommand.cc b/LISTTEMPBLOCKEDCommand.cc
new file mode 100644 (file)
index 0000000..8ece452
--- /dev/null
@@ -0,0 +1,86 @@
+/**
+ * LISTTEMPBLOCKEDCommand.cc
+ *
+ * 26/09/2006 - Neil Spierling <sirvulcan@gmail.com>
+ * Initial Version
+ *
+ * Lists all temp blocked chans that chanfix has stored
+ *
+ * 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 the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ *
+ * $Id: LISTBLOCKEDCommand.cc 1553 2006-04-18 04:03:59Z sirvulcan $
+ */
+
+#include "gnuworld_config.h"
+#include "Network.h"
+
+#include "chanfix.h"
+#include "responses.h"
+#include "StringTokenizer.h"
+#include "sqlChannel.h"
+#include "sqlUser.h"
+
+RCSTAG("$Id: LISTBLOCKEDCommand.cc 1553 2006-04-18 04:03:59Z sirvulcan $");
+
+namespace gnuworld
+{
+namespace cf
+{
+void LISTTEMPBLOCKEDCommand::Exec(iClient* theClient, sqlUser* theUser, const std::string& Message)
+{
+int numBlocks = 0;
+
+/* Check if channel blocking has been disabled in the config. */
+if (!bot->doChanBlocking()) {
+  bot->SendTo(theClient,
+              bot->getResponse(theUser,
+                              language::channel_blocking_disabled,
+                              std::string("Channel blocking is disabled.")).c_str());
+  return;
+}
+
+bot->SendTo(theClient,
+       bot->getResponse(theUser,
+               language::list_temp_blocked_chans,
+               std::string("List of all temp blocked channels:")).c_str());
+
+
+for (xNetwork::channelIterator cptr = Network->channels_begin(); cptr != Network->channels_end() ; ++cptr ) {
+  Channel* thisChan = cptr->second ;
+  bool isBlocked = bot->isTempBlocked(thisChan->getName());
+
+  if (isBlocked) {
+      bot->SendTo(theClient, thisChan->getName());
+      numBlocks++;
+  }
+}
+
+bot->SendTo(theClient,
+       bot->getResponse(theUser,
+               language::list_total_temp_blocked,
+               std::string("%d channels temp blocked.")).c_str(),
+               numBlocks);
+
+bot->logAdminMessage("%s (%s) LISTTEMPBLOCKED",
+                    theUser->getUserName().c_str(),
+                    theClient->getRealNickUserHost().c_str());
+
+bot->logLastComMessage(theClient, Message);
+
+return;
+}
+} // namespace cf
+} // namespace gnuworld
index 0b18d09cf0892ce8bce2c4d57ddb97d715668281..73bfda2d858de19cf96e7bd1a4109984566cda46 100644 (file)
@@ -25,6 +25,7 @@ libchanfix_la_SOURCES = chanfix.cc \
        LASTCOMCommand.cc \
        LISTBLOCKEDCommand.cc \
        LISTHOSTSCommand.cc \
+       LISTTEMPBLOCKEDCommand.cc \
        OPLISTCommand.cc \
        OPNICKSCommand.cc \
        QUOTECommand.cc \
@@ -38,9 +39,11 @@ libchanfix_la_SOURCES = chanfix.cc \
        SHUTDOWNCommand.cc \
        STATUSCommand.cc \
        SUSPENDCommand.cc \
+       TEMPBLOCKCommand.cc \
        UNALERTCommand.cc \
        UNBLOCKCommand.cc \
        UNSUSPENDCommand.cc \
+       UNTEMPBLOCKCommand.cc \
        USERSCORESCommand.cc \
        USETCommand.cc \
        WHOGROUPCommand.cc \
index cffe26d6597fbb42a9d1221cb1f0a203700882ee..0db438abc13565ace73ae90212334832bc5b1fbc 100644 (file)
@@ -81,6 +81,7 @@ am_libchanfix_la_OBJECTS = libchanfix_la-chanfix.lo \
        libchanfix_la-INVITECommand.lo libchanfix_la-LASTCOMCommand.lo \
        libchanfix_la-LISTBLOCKEDCommand.lo \
        libchanfix_la-LISTHOSTSCommand.lo \
+       libchanfix_la-LISTTEMPBLOCKEDCommand.lo \
        libchanfix_la-OPLISTCommand.lo libchanfix_la-OPNICKSCommand.lo \
        libchanfix_la-QUOTECommand.lo libchanfix_la-REHASHCommand.lo \
        libchanfix_la-RELOADCommand.lo \
@@ -89,9 +90,11 @@ am_libchanfix_la_OBJECTS = libchanfix_la-chanfix.lo \
        libchanfix_la-SETCommand.lo libchanfix_la-SETGROUPCommand.lo \
        libchanfix_la-SHUTDOWNCommand.lo \
        libchanfix_la-STATUSCommand.lo libchanfix_la-SUSPENDCommand.lo \
+       libchanfix_la-TEMPBLOCKCommand.lo \
        libchanfix_la-UNALERTCommand.lo \
        libchanfix_la-UNBLOCKCommand.lo \
        libchanfix_la-UNSUSPENDCommand.lo \
+       libchanfix_la-UNTEMPBLOCKCommand.lo \
        libchanfix_la-USERSCORESCommand.lo \
        libchanfix_la-USETCommand.lo libchanfix_la-WHOGROUPCommand.lo \
        libchanfix_la-WHOISCommand.lo libchanfix_la-sqlChanOp.lo \
@@ -255,6 +258,7 @@ libchanfix_la_SOURCES = chanfix.cc \
        LASTCOMCommand.cc \
        LISTBLOCKEDCommand.cc \
        LISTHOSTSCommand.cc \
+       LISTTEMPBLOCKEDCommand.cc \
        OPLISTCommand.cc \
        OPNICKSCommand.cc \
        QUOTECommand.cc \
@@ -268,9 +272,11 @@ libchanfix_la_SOURCES = chanfix.cc \
        SHUTDOWNCommand.cc \
        STATUSCommand.cc \
        SUSPENDCommand.cc \
+       TEMPBLOCKCommand.cc \
        UNALERTCommand.cc \
        UNBLOCKCommand.cc \
        UNSUSPENDCommand.cc \
+       UNTEMPBLOCKCommand.cc \
        USERSCORESCommand.cc \
        USETCommand.cc \
        WHOGROUPCommand.cc \
@@ -418,6 +424,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-LASTCOMCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-LISTBLOCKEDCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-LISTHOSTSCommand.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-LISTTEMPBLOCKEDCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-OPLISTCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-OPNICKSCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-QUOTECommand.Plo@am__quote@
@@ -431,9 +438,11 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-SHUTDOWNCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-STATUSCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-SUSPENDCommand.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-TEMPBLOCKCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-UNALERTCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-UNBLOCKCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-UNSUSPENDCommand.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-UNTEMPBLOCKCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-USERSCORESCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-USETCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-WHOGROUPCommand.Plo@am__quote@
@@ -619,6 +628,13 @@ libchanfix_la-LISTHOSTSCommand.lo: LISTHOSTSCommand.cc
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -c -o libchanfix_la-LISTHOSTSCommand.lo `test -f 'LISTHOSTSCommand.cc' || echo '$(srcdir)/'`LISTHOSTSCommand.cc
 
+libchanfix_la-LISTTEMPBLOCKEDCommand.lo: LISTTEMPBLOCKEDCommand.cc
+@am__fastdepCXX_TRUE@  if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -MT libchanfix_la-LISTTEMPBLOCKEDCommand.lo -MD -MP -MF "$(DEPDIR)/libchanfix_la-LISTTEMPBLOCKEDCommand.Tpo" -c -o libchanfix_la-LISTTEMPBLOCKEDCommand.lo `test -f 'LISTTEMPBLOCKEDCommand.cc' || echo '$(srcdir)/'`LISTTEMPBLOCKEDCommand.cc; \
+@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/libchanfix_la-LISTTEMPBLOCKEDCommand.Tpo" "$(DEPDIR)/libchanfix_la-LISTTEMPBLOCKEDCommand.Plo"; else rm -f "$(DEPDIR)/libchanfix_la-LISTTEMPBLOCKEDCommand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='LISTTEMPBLOCKEDCommand.cc' object='libchanfix_la-LISTTEMPBLOCKEDCommand.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -c -o libchanfix_la-LISTTEMPBLOCKEDCommand.lo `test -f 'LISTTEMPBLOCKEDCommand.cc' || echo '$(srcdir)/'`LISTTEMPBLOCKEDCommand.cc
+
 libchanfix_la-OPLISTCommand.lo: OPLISTCommand.cc
 @am__fastdepCXX_TRUE@  if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -MT libchanfix_la-OPLISTCommand.lo -MD -MP -MF "$(DEPDIR)/libchanfix_la-OPLISTCommand.Tpo" -c -o libchanfix_la-OPLISTCommand.lo `test -f 'OPLISTCommand.cc' || echo '$(srcdir)/'`OPLISTCommand.cc; \
 @am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/libchanfix_la-OPLISTCommand.Tpo" "$(DEPDIR)/libchanfix_la-OPLISTCommand.Plo"; else rm -f "$(DEPDIR)/libchanfix_la-OPLISTCommand.Tpo"; exit 1; fi
@@ -710,6 +726,13 @@ libchanfix_la-SUSPENDCommand.lo: SUSPENDCommand.cc
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -c -o libchanfix_la-SUSPENDCommand.lo `test -f 'SUSPENDCommand.cc' || echo '$(srcdir)/'`SUSPENDCommand.cc
 
+libchanfix_la-TEMPBLOCKCommand.lo: TEMPBLOCKCommand.cc
+@am__fastdepCXX_TRUE@  if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -MT libchanfix_la-TEMPBLOCKCommand.lo -MD -MP -MF "$(DEPDIR)/libchanfix_la-TEMPBLOCKCommand.Tpo" -c -o libchanfix_la-TEMPBLOCKCommand.lo `test -f 'TEMPBLOCKCommand.cc' || echo '$(srcdir)/'`TEMPBLOCKCommand.cc; \
+@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/libchanfix_la-TEMPBLOCKCommand.Tpo" "$(DEPDIR)/libchanfix_la-TEMPBLOCKCommand.Plo"; else rm -f "$(DEPDIR)/libchanfix_la-TEMPBLOCKCommand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='TEMPBLOCKCommand.cc' object='libchanfix_la-TEMPBLOCKCommand.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -c -o libchanfix_la-TEMPBLOCKCommand.lo `test -f 'TEMPBLOCKCommand.cc' || echo '$(srcdir)/'`TEMPBLOCKCommand.cc
+
 libchanfix_la-UNALERTCommand.lo: UNALERTCommand.cc
 @am__fastdepCXX_TRUE@  if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -MT libchanfix_la-UNALERTCommand.lo -MD -MP -MF "$(DEPDIR)/libchanfix_la-UNALERTCommand.Tpo" -c -o libchanfix_la-UNALERTCommand.lo `test -f 'UNALERTCommand.cc' || echo '$(srcdir)/'`UNALERTCommand.cc; \
 @am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/libchanfix_la-UNALERTCommand.Tpo" "$(DEPDIR)/libchanfix_la-UNALERTCommand.Plo"; else rm -f "$(DEPDIR)/libchanfix_la-UNALERTCommand.Tpo"; exit 1; fi
@@ -731,6 +754,13 @@ libchanfix_la-UNSUSPENDCommand.lo: UNSUSPENDCommand.cc
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -c -o libchanfix_la-UNSUSPENDCommand.lo `test -f 'UNSUSPENDCommand.cc' || echo '$(srcdir)/'`UNSUSPENDCommand.cc
 
+libchanfix_la-UNTEMPBLOCKCommand.lo: UNTEMPBLOCKCommand.cc
+@am__fastdepCXX_TRUE@  if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -MT libchanfix_la-UNTEMPBLOCKCommand.lo -MD -MP -MF "$(DEPDIR)/libchanfix_la-UNTEMPBLOCKCommand.Tpo" -c -o libchanfix_la-UNTEMPBLOCKCommand.lo `test -f 'UNTEMPBLOCKCommand.cc' || echo '$(srcdir)/'`UNTEMPBLOCKCommand.cc; \
+@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/libchanfix_la-UNTEMPBLOCKCommand.Tpo" "$(DEPDIR)/libchanfix_la-UNTEMPBLOCKCommand.Plo"; else rm -f "$(DEPDIR)/libchanfix_la-UNTEMPBLOCKCommand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='UNTEMPBLOCKCommand.cc' object='libchanfix_la-UNTEMPBLOCKCommand.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -c -o libchanfix_la-UNTEMPBLOCKCommand.lo `test -f 'UNTEMPBLOCKCommand.cc' || echo '$(srcdir)/'`UNTEMPBLOCKCommand.cc
+
 libchanfix_la-USERSCORESCommand.lo: USERSCORESCommand.cc
 @am__fastdepCXX_TRUE@  if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -MT libchanfix_la-USERSCORESCommand.lo -MD -MP -MF "$(DEPDIR)/libchanfix_la-USERSCORESCommand.Tpo" -c -o libchanfix_la-USERSCORESCommand.lo `test -f 'USERSCORESCommand.cc' || echo '$(srcdir)/'`USERSCORESCommand.cc; \
 @am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/libchanfix_la-USERSCORESCommand.Tpo" "$(DEPDIR)/libchanfix_la-USERSCORESCommand.Plo"; else rm -f "$(DEPDIR)/libchanfix_la-USERSCORESCommand.Tpo"; exit 1; fi
index 595d9e1e52cb17b20604890a9e0cbf0d94b8e641..67acc575da21e5259b9d6885dce51b4c7055688d 100644 (file)
@@ -172,8 +172,14 @@ for (chanfix::chanOpsType::iterator opPtr = myOps.begin();
 sqlChannel* theChan = bot->getChannelRecord(st[1]);
 if (theChan) {
   bot->SendTo(theClient, "Notes: %d", theChan->countNotes(0));
-       
-  if (theChan->getFlag(sqlChannel::F_BLOCKED))
+
+  if (bot->isTempBlocked(theChan->getChannel()))
+    bot->SendTo(theClient,
+                bot->getResponse(theUser,
+                                language::info_chan_temp_blocked,
+                                std::string("%s is TEMPBLOCKED.")).c_str(),
+                                            theChan->getChannel().c_str());
+  else if (theChan->getFlag(sqlChannel::F_BLOCKED))
     bot->SendTo(theClient,
               bot->getResponse(theUser,
                               language::info_chan_blocked,
index 38e18a683bfa8ddd7aee1755a72d2e2275963f22..79ac49f1d99c21516f0adc355a76019c699364f1 100644 (file)
@@ -218,7 +218,8 @@ if (bot->isBeingAutoFixed(netChan)) {
 }
 
 /* Don't fix a blocked or alerted channel. */
-if ((theChan->getFlag(sqlChannel::F_BLOCKED)) || (theChan->getFlag(sqlChannel::F_ALERT))) {
+if ((bot->isTempBlocked(theChan->getChannel())) || (theChan->getFlag(sqlChannel::F_BLOCKED)) || 
+    (theChan->getFlag(sqlChannel::F_ALERT))) {
   bot->SendTo(theClient,
               bot->getResponse(theUser,
                               language::channel_blocked_non_oper,
index c9f4316b1b414ea83cfb67b84aff3656d9ccb0f8..c3961ee47a0bc532065fb90d79bfe7cf74ea9ddf 100644 (file)
@@ -331,6 +331,12 @@ if (theChan) {
                               language::info_chan_blocked,
                               std::string("%s is BLOCKED.")).c_str(),
                                           theChan->getChannel().c_str());
+  else if (bot->isTempBlocked(theChan->getChannel()))
+    bot->SendTo(theClient,
+              bot->getResponse(theUser,
+                              language::info_chan_temp_blocked,
+                              std::string("%s is TEMPBLOCKED.")).c_str(),
+                                          theChan->getChannel().c_str());
   else if (theChan->getFlag(sqlChannel::F_ALERT))
     bot->SendTo(theClient,
               bot->getResponse(theUser,
diff --git a/TEMPBLOCKCommand.cc b/TEMPBLOCKCommand.cc
new file mode 100644 (file)
index 0000000..9010a3f
--- /dev/null
@@ -0,0 +1,125 @@
+/**
+ * TEMPBLOCKCommand.cc
+ *
+ * 19/09/2006 - Neil Spierling
+ * Initial Version
+ *
+ * Temporary blocks a channel from being fixed, both automatically and
+ * manually
+ *
+ * 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 the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ *
+ * $Id: BLOCKCommand.cc 1553 2006-04-18 04:03:59Z sirvulcan $
+ */
+
+#include "gnuworld_config.h"
+#include "Network.h"
+
+#include "chanfix.h"
+#include "responses.h"
+#include "StringTokenizer.h"
+#include "sqlChannel.h"
+#include "sqlUser.h"
+
+RCSTAG("$Id: BLOCKCommand.cc 1553 2006-04-18 04:03:59Z sirvulcan $");
+
+namespace gnuworld
+{
+namespace cf
+{
+
+void TEMPBLOCKCommand::Exec(iClient* theClient, sqlUser* theUser, const std::string& Message)
+{
+StringTokenizer st(Message);
+
+/* Check if channel blocking has been disabled in the config. */
+if (!bot->doChanBlocking()) {
+  bot->SendTo(theClient,
+              bot->getResponse(theUser,
+                              language::channel_blocking_disabled,
+                              std::string("Channel blocking is disabled.")).c_str());
+  return;
+}
+
+if (st[1][0] != '#') {
+  bot->SendTo(theClient,
+              bot->getResponse(theUser,
+                              language::invalid_channel_name,
+                              std::string("%s is an invalid channel name.")).c_str(),
+                                          st[1].c_str());
+  return;
+}
+
+sqlChannel* theChan = bot->getChannelRecord(st[1]);
+if (!theChan) theChan = bot->newChannelRecord(st[1]);
+
+if (!bot->isTempBlocked(theChan->getChannel()))
+      bot->tempBlockList.insert(chanfix::tempBlockType::value_type(theChan->getChannel(), bot->currentTime()));
+else {
+  bot->SendTo(theClient,
+              bot->getResponse(theUser,
+                              language::channel_already_temp_blocked,
+                              std::string("The channel %s is already temp blocked.")).c_str(),
+                                          theChan->getChannel().c_str());
+  return;
+}
+
+/* Add note to the channel about this command */
+theChan->addNote(sqlChannel::EV_TEMPBLOCK, theClient, st.assemble(2));
+
+bot->SendTo(theClient,
+            bot->getResponse(theUser,
+                            language::channel_has_been_temp_blocked,
+                            std::string("The channel %s has been temp blocked.")).c_str(),
+                                        theChan->getChannel().c_str());
+
+/* Warn and remove from the queue if it is being fixed */
+std::string extraLog;
+Channel* netChan = Network->findChannel(st[1]);
+if (netChan) {
+  if (bot->isBeingChanFixed(netChan)) {
+    bot->SendTo(theClient,
+               bot->getResponse(theUser,
+                       language::block_aborting_manual_fix,
+                       std::string("WARNING: Channel %s is being manually fixed; aborting fix as per TEMPBLOCK.")).c_str(),
+                                   theChan->getChannel().c_str());
+    bot->stopFixingChan(netChan, true);
+    extraLog = " (current manual fix aborted)";
+  }
+  if (bot->isBeingAutoFixed(netChan)) {
+    bot->SendTo(theClient,
+               bot->getResponse(theUser,
+                       language::block_aborting_auto_fix,
+                       std::string("WARNING: Channel %s is being automatically fixed; aborting fix as per TEMPBLOCK.")).c_str(),
+                                   theChan->getChannel().c_str());
+    bot->stopFixingChan(netChan, true);
+    extraLog = " (current autofix aborted)";
+  }
+}
+
+/* Log command */
+bot->logAdminMessage("%s (%s) TEMPBLOCK %s%s",
+                    theUser->getUserName().c_str(),
+                    theClient->getRealNickUserHost().c_str(),
+                    theChan->getChannel().c_str(),
+                    extraLog.c_str());
+
+bot->logLastComMessage(theClient, Message);
+
+return;
+}
+} // namespace cf
+} // namespace gnuworld
diff --git a/UNTEMPBLOCKCommand.cc b/UNTEMPBLOCKCommand.cc
new file mode 100644 (file)
index 0000000..c332dbb
--- /dev/null
@@ -0,0 +1,97 @@
+/**
+ * UNTEMPBLOCKCommand.cc
+ *
+ * 09/26/2006 - Neil Spierling <sirvulcan@gmail.com>
+ * Initial Version
+ *
+ * Removes the temp block on a channel
+ *
+ * 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 the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ *
+ * $Id: UNBLOCKCommand.cc 1553 2006-04-18 04:03:59Z sirvulcan $
+ */
+
+#include "gnuworld_config.h"
+
+#include "chanfix.h"
+#include "responses.h"
+#include "StringTokenizer.h"
+#include "sqlChannel.h"
+#include "sqlUser.h"
+
+RCSTAG("$Id: UNBLOCKCommand.cc 1553 2006-04-18 04:03:59Z sirvulcan $");
+
+namespace gnuworld
+{
+namespace cf
+{
+
+void UNTEMPBLOCKCommand::Exec(iClient* theClient, sqlUser* theUser, const std::string& Message)
+{
+StringTokenizer st(Message);
+
+/* Check if channel blocking has been disabled in the config. */
+if (!bot->doChanBlocking()) {
+  bot->SendTo(theClient,
+              bot->getResponse(theUser,
+                              language::channel_blocking_disabled,
+                              std::string("Channel blocking is disabled.")).c_str());
+  return;
+}
+       
+sqlChannel* theChan = bot->getChannelRecord(st[1]);
+if (!theChan) {
+  bot->SendTo(theClient,
+              bot->getResponse(theUser,
+                              language::no_entry_in_db,
+                              std::string("There is no entry in the database for %s.")).c_str(),
+                                          st[1].c_str());
+  return;
+}
+
+if (!bot->isTempBlocked(theChan->getChannel())) {
+  bot->SendTo(theClient,
+              bot->getResponse(theUser,
+                              language::channel_not_temp_blocked,
+                              std::string("The channel %s is not temp blocked.")).c_str(),
+                                          theChan->getChannel().c_str());
+  return;
+}
+
+/* Remove from temp block list */
+bot->tempBlockList.erase(theChan->getChannel());
+
+/* Add note to the channel about this command */
+theChan->addNote(sqlChannel::EV_UNTEMPBLOCK, theClient, "");
+
+bot->SendTo(theClient,
+            bot->getResponse(theUser,
+                            language::channel_untempblocked,
+                            std::string("Channel %s has been untempblocked.")).c_str(),
+                                        theChan->getChannel().c_str());
+
+/* Log command */
+bot->logAdminMessage("%s (%s) UNTEMPBLOCK %s",
+                    theUser->getUserName().c_str(),
+                    theClient->getRealNickUserHost().c_str(),
+                    theChan->getChannel().c_str());
+
+bot->logLastComMessage(theClient, Message);
+
+return;
+}
+} // namespace cf
+} // namespace gnuworld
index 9eb69d9e1e86764f65f36f163588301ff6f61ba3..7578c6098d1ce766047701860c852afb82cc83c7 100644 (file)
@@ -224,6 +224,11 @@ RegisterCommand(new LISTHOSTSCommand(this, "LISTHOSTS",
        1,
        sqlUser::F_LOGGEDIN
        ));
+RegisterCommand(new LISTTEMPBLOCKEDCommand(this, "LISTTEMPBLOCKED",
+       "",
+       1,
+       sqlUser::F_BLOCK
+       ));
 RegisterCommand(new OPLISTCommand(this, "OPLIST",
        "<#channel> [-all] [-days]",
        2,
@@ -296,6 +301,11 @@ RegisterCommand(new SUSPENDCommand(this, "SUSPEND",
        2,
        sqlUser::F_USERMANAGER | sqlUser::F_SERVERADMIN
        ));
+RegisterCommand(new TEMPBLOCKCommand(this, "TEMPBLOCK",
+       "<#channel>",
+       2,
+       sqlUser::F_BLOCK
+       ));
 RegisterCommand(new UNALERTCommand(this, "UNALERT",
        "<#channel>",
        2,
@@ -311,6 +321,11 @@ RegisterCommand(new UNSUSPENDCommand(this, "UNSUSPEND",
        2,
        sqlUser::F_USERMANAGER | sqlUser::F_SERVERADMIN
        ));
+RegisterCommand(new UNTEMPBLOCKCommand(this, "UNTEMPBLOCK",
+       "<#channel>",
+       2,
+       sqlUser::F_BLOCK
+       ));
 RegisterCommand(new USERSCORESCommand(this, "USERSCORES",
        "<account>",
        2,
@@ -1856,7 +1871,8 @@ for (xNetwork::channelIterator ptr = Network->channels_begin(); ptr != Network->
 
        if ((sqlChan->getMaxScore() > 
           static_cast<int>(static_cast<float>(FIX_MIN_ABS_SCORE_END)
-          * MAX_SCORE)) && !sqlChan->getFlag(sqlChannel::F_BLOCKED)) {
+          * MAX_SCORE)) && !sqlChan->getFlag(sqlChannel::F_BLOCKED) &&
+          !isTempBlocked(thisChan->getName())) {
         elog << "chanfix::autoFix> DEBUG: " << thisChan->getName() << " is opless, fixing." << std::endl;
         autoFixQ.insert(fixQueueType::value_type(thisChan->getName(), currentTime()));
         numOpLess++;
@@ -2107,7 +2123,6 @@ if ((stopAutoFixOnOp || force) && isBeingAutoFixed(theChan)) {
   removeFromAutoQ(theChan);
 }
 if ((stopChanFixOnOp || force) && isBeingChanFixed(theChan)) {
-  type = 2;
   inFix = true;
   removeFromManQ(theChan);
 }
@@ -2922,6 +2937,10 @@ else if (whichEvent == sqlChannel::EV_REQUESTOP)
   return "REQUESTOP";
 else if (whichEvent == sqlChannel::EV_BLOCK)
   return "BLOCK";
+else if (whichEvent == sqlChannel::EV_TEMPBLOCK)
+  return "TEMPBLOCK";
+else if (whichEvent == sqlChannel::EV_UNTEMPBLOCK)
+  return "UNTEMPBLOCK";
 else if (whichEvent == sqlChannel::EV_UNBLOCK)
   return "UNBLOCK";
 else if (whichEvent == sqlChannel::EV_ALERT)
index 6d5eb01981f5344edfee33c9e79214e57e62bb94..e59b7d635acf36afa18cc0b59efd5586a9f28f87 100644 (file)
--- a/chanfix.h
+++ b/chanfix.h
@@ -265,7 +265,7 @@ public:
        void rotateDB();
        
        void expireTempBlocks();
-       
+
        void prepareUpdate(bool);
        void updateDB();
 
index b1761e114b3ebef626efec4e0c4114ff2d917c3a..316b41af0875dc4951d390fffea44eb75a9ed450 100644 (file)
@@ -118,6 +118,9 @@ DECLARE_COMMAND( WHOGROUP )
 DECLARE_COMMAND( BLOCK )
 DECLARE_COMMAND( UNBLOCK )
 DECLARE_COMMAND( LISTBLOCKED )
+DECLARE_COMMAND( TEMPBLOCK )
+DECLARE_COMMAND( UNTEMPBLOCK )
+DECLARE_COMMAND( LISTTEMPBLOCKED )
 
 /* Comment commands */
 DECLARE_COMMAND( ADDNOTE )
index 24795ddccd3e686e18c0c60c93fe9ec23652823f..24f835eca7bcff54b5d612713b2c9567f8cdae74 100644 (file)
@@ -26,6 +26,7 @@ INFO  1       Shows all notes of the specified channel and whether the channel is activ
 LASTCOM        1       Shows all the last commands which where issued to the bot.
 LISTBLOCKED    1       Lists all of the channels that chanfix will not score.
 LISTHOSTS      1       With no username specified, it lists the hostmasks chanfix recognizes you by. Otherwise, it views the specified username's host list.\nNOTE: Server admins (+a) can only view host lists of users within their own server group. Users lower than server admin status can only view their own host lists.
+LISTTEMPBLOCKED        1       Lists all of the channels that chanfix will not score temporarly.
 OPLIST 1       Shows the top 10 op accounts and their scores for the specified channel. Possible flags\n-all (or ALL or !) - Lists all scores.\n-days - Displays a small bar of the 2 week scoring period showing when a person was opped (. means never opped, 0 means 0-10%, 9 means 91-100%)
 OPNICKS        1       Shows the nicknames currently opped on the specified channel.
 REHASH 1       Reloads the translations, configuration, or help values based on the specified target.
@@ -35,8 +36,10 @@ SCORE        1       Without extra arguments, shows the top scores of <channel>.\nOtherwise,
 SET    1       Sets various configuration options to the specified values.\nBoolean settings: ENABLE_AUTOFIX, ENABLE_CHANFIX, ENABLE_CHANNEL_BLOCKING.\nInteger settings: NUM_SERVERS.
 STATUS 1       Shows current statistics such as: uptime, percentage network presence, fix and block settings.
 SUSPEND        1       Suspends the specified user.
+TEMPBLOCK      1       Temporary blocks a channel from being fixed, both automatically and manually.\nThe reason will be shown when doing INFO <channel>.
 UNALERT        1       Removes a channel from alert status.
 UNBLOCK        1       Removes a channel from the blocklist causing it to be fixable again.
+UNTEMPBLOCK    1       Removes a channel from the temporary blocklist causing it to be fixable again.
 USET   1       Sets options on your account. Possible settings:\nNOTICE - receive notices, if no then PRIVMSG's will be sent.\nLANG - What language chanfix will communicate with you in; available languages: EN - English.
 WHOIS  1       Shows account information for the specified user.
 SETGROUP       1       Sets the group for the specified user.
@@ -47,7 +50,7 @@ WHOGROUP      1       Shows all users in the specified group along with their flags. If no
 <INDEXNORMAL>  1       \002Normal User\002: CANFIX REQUESTOP
 <INDEXOPER>    1       \002Oper Level\002: SCORE CSCORE CHECK HISTORY INFO OPLIST OPNICKS STATUS
 <INDEXLOGGEDIN>        1       \002Logged In\002: LISTHOSTS USET USERSCORES WHOIS
-<INDEXBLOCK>   1       \002Blocker (+b)\002: BLOCK UNBLOCK LISTBLOCKED
+<INDEXBLOCK>   1       \002Blocker (+b)\002: BLOCK TEMPBLOCK UNBLOCK UNTEMPBLOCK LISTBLOCKED LISTTEMPBLOCKED
 <INDEXCOMMENT> 1       \002Commenter (+c)\002: ADDNOTE DELNOTE ALERT UNALERT
 <INDEXCHANFIX> 1       \002Chanfixer (+f)\002: CHANFIX
 <INDEXOWNER>   1       \002Owner (+o)\002: LASTCOM REHASH RELOAD SET SHUTDOWN
index c996c304c47ebe4d6577f4bb37b31a4353ebeb92..a7e4036afd1816442ea26d66195b063849417c68 100644 (file)
@@ -214,4 +214,14 @@ COPY "translations" FROM stdin;
 1      208     You cannot see logs more than one year ago.     31337   0
 1      209     Listing last %d messages from day %d.   31337   0
 1      210     End of LASTCOM report.  31337   0
+1      211     The channel %s is TEMPBLOCKED.  31337   0
+1      212     List of all temp blocked channels:      31337   0
+1      213     %d channels temp blocked.       31337   0
+1      214     %s is TEMPBLOCKED.      31337   0
+1      215     The channel %s is already temp blocked. 31337   0
+1      216     The channel %s has been temp blocked.   31337   0
+1      217     WARNING: Channel %s is being manually fixed; aborting fix as per TEMPBLOCK.     31337   0
+1      218     WARNING: Channel %s is being automatically fixed; aborting fix as per TEMPBLOCK.        31337   0
+1      219     The channel %s is not temp blocked.     31337   0
+1      220     Channel %s has been untempblocked.      31337   0
 \.
index a0c8c9623a80d5d946977307ccbc14a3608f1990..f60ccc3c20d802971b3888325aca381359d535a5 100644 (file)
@@ -93,6 +93,7 @@ namespace cf
                const int not_enough_servers_non_oper   = 200;
                const int channel_being_auto_fixed_noper        = 201;
                const int channel_blocked_non_oper      = 202;
+               const int channel_temp_blocked          = 211;
 
                /* CHECK */
                const int check_results                 = 37;
@@ -152,6 +153,7 @@ namespace cf
                const int temporarily_blocked           = 188;
                const int info_fix_started              = 192;
                const int info_fix_waiting              = 193;
+               const int info_chan_temp_blocked        = 214;
 
                /* INVITE */
                const int cant_find_channel             = 77;
@@ -172,6 +174,10 @@ namespace cf
                const int host_list_header              = 164;
                const int host_list_footer              = 165;
 
+               /* LISTTEMPBLOCKED */
+               const int list_temp_blocked_chans       = 212;
+               const int list_total_temp_blocked       = 213;
+
                /* OPLIST */
                const int top_unique_op_accounts        = 80;
                const int found_unique_op_accounts      = 81;
@@ -251,6 +257,12 @@ namespace cf
                const int user_suspended                = 120;
                const int user_cant_suspend_self        = 159;
 
+               /* TEMPBLOCK */
+               const int channel_already_temp_blocked  = 215;
+               const int channel_has_been_temp_blocked = 216;
+               const int block_aborting_manual_fix     = 217;
+               const int block_aborting_auto_fix       = 218;
+
                /* UNALERT */
                const int no_alert_set                  = 121;
                const int alert_removed                 = 122;
@@ -266,6 +278,10 @@ namespace cf
                const int user_not_suspended            = 126;
                const int user_unsuspended              = 127;
 
+               /* UNTEMPBLOCK */
+               const int channel_not_temp_blocked      = 219;
+               const int channel_untempblocked         = 220;
+
                /* USERSCORES */
                const int userscores_header             = 194;
                const int userscores_noscore            = 195;
index 68a43ada7806030abe57181d56c041f779c14fc7..7b04bd323e216f81f885757a8603d716975ac8eb 100644 (file)
@@ -41,14 +41,16 @@ namespace cf
 const sqlChannel::flagType sqlChannel::F_BLOCKED       = 0x00000001 ;
 const sqlChannel::flagType sqlChannel::F_ALERT         = 0x00000002 ;
 
-const int sqlChannel::EV_MISC          = 1 ; /* Uncategorized event */
-const int sqlChannel::EV_NOTE          = 2 ; /* Miscellaneous notes */
-const int sqlChannel::EV_CHANFIX       = 3 ; /* Manual chanfixes */
-const int sqlChannel::EV_BLOCK         = 4 ; /* Channel block */
-const int sqlChannel::EV_UNBLOCK       = 5 ; /* Channel unblock */
-const int sqlChannel::EV_ALERT         = 6 ; /* Channel alert */
-const int sqlChannel::EV_UNALERT       = 7 ; /* Channel unalert */
-const int sqlChannel::EV_REQUESTOP     = 8 ; /* Requestops */
+const int sqlChannel::EV_MISC          = 1  ; /* Uncategorized event */
+const int sqlChannel::EV_NOTE          = 2  ; /* Miscellaneous notes */
+const int sqlChannel::EV_CHANFIX       = 3  ; /* Manual chanfixes */
+const int sqlChannel::EV_BLOCK         = 4  ; /* Channel block */
+const int sqlChannel::EV_UNBLOCK       = 5  ; /* Channel unblock */
+const int sqlChannel::EV_ALERT         = 6  ; /* Channel alert */
+const int sqlChannel::EV_UNALERT       = 7  ; /* Channel unalert */
+const int sqlChannel::EV_REQUESTOP     = 8  ; /* Requestops */
+const int sqlChannel::EV_TEMPBLOCK     = 9  ; /* Temp channel block */
+const int sqlChannel::EV_UNTEMPBLOCK   = 10 ; /* Temp channel unblock */
 
 unsigned long int sqlChannel::maxUserId = 0;
 
index 9ea4ec092b705376c4d45125e1a2810efc3b3002..91c8b8d3a8bb732691080c8e96c724076732855a 100644 (file)
@@ -58,6 +58,8 @@ public:
        static const int        EV_NOTE; /* Miscellaneous notes */
        static const int        EV_CHANFIX; /* Manual chanfixes */
        static const int        EV_BLOCK; /* Channel block */
+       static const int        EV_TEMPBLOCK; /* Temp channel block */
+       static const int        EV_UNTEMPBLOCK; /* Temp channel block */
        static const int        EV_UNBLOCK; /* Channel unblock */
        static const int        EV_ALERT; /* Channel alert */
        static const int        EV_UNALERT; /* Channel unalert */