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,
--- /dev/null
+/**
+ * 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
LASTCOMCommand.cc \
LISTBLOCKEDCommand.cc \
LISTHOSTSCommand.cc \
+ LISTTEMPBLOCKEDCommand.cc \
OPLISTCommand.cc \
OPNICKSCommand.cc \
QUOTECommand.cc \
SHUTDOWNCommand.cc \
STATUSCommand.cc \
SUSPENDCommand.cc \
+ TEMPBLOCKCommand.cc \
UNALERTCommand.cc \
UNBLOCKCommand.cc \
UNSUSPENDCommand.cc \
+ UNTEMPBLOCKCommand.cc \
USERSCORESCommand.cc \
USETCommand.cc \
WHOGROUPCommand.cc \
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 \
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 \
LASTCOMCommand.cc \
LISTBLOCKEDCommand.cc \
LISTHOSTSCommand.cc \
+ LISTTEMPBLOCKEDCommand.cc \
OPLISTCommand.cc \
OPNICKSCommand.cc \
QUOTECommand.cc \
SHUTDOWNCommand.cc \
STATUSCommand.cc \
SUSPENDCommand.cc \
+ TEMPBLOCKCommand.cc \
UNALERTCommand.cc \
UNBLOCKCommand.cc \
UNSUSPENDCommand.cc \
+ UNTEMPBLOCKCommand.cc \
USERSCORESCommand.cc \
USETCommand.cc \
WHOGROUPCommand.cc \
@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@
@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@
@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
@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
@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
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,
}
/* 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,
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,
--- /dev/null
+/**
+ * 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
--- /dev/null
+/**
+ * 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
1,
sqlUser::F_LOGGEDIN
));
+RegisterCommand(new LISTTEMPBLOCKEDCommand(this, "LISTTEMPBLOCKED",
+ "",
+ 1,
+ sqlUser::F_BLOCK
+ ));
RegisterCommand(new OPLISTCommand(this, "OPLIST",
"<#channel> [-all] [-days]",
2,
2,
sqlUser::F_USERMANAGER | sqlUser::F_SERVERADMIN
));
+RegisterCommand(new TEMPBLOCKCommand(this, "TEMPBLOCK",
+ "<#channel>",
+ 2,
+ sqlUser::F_BLOCK
+ ));
RegisterCommand(new UNALERTCommand(this, "UNALERT",
"<#channel>",
2,
2,
sqlUser::F_USERMANAGER | sqlUser::F_SERVERADMIN
));
+RegisterCommand(new UNTEMPBLOCKCommand(this, "UNTEMPBLOCK",
+ "<#channel>",
+ 2,
+ sqlUser::F_BLOCK
+ ));
RegisterCommand(new USERSCORESCommand(this, "USERSCORES",
"<account>",
2,
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++;
removeFromAutoQ(theChan);
}
if ((stopChanFixOnOp || force) && isBeingChanFixed(theChan)) {
- type = 2;
inFix = true;
removeFromManQ(theChan);
}
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)
void rotateDB();
void expireTempBlocks();
-
+
void prepareUpdate(bool);
void updateDB();
DECLARE_COMMAND( BLOCK )
DECLARE_COMMAND( UNBLOCK )
DECLARE_COMMAND( LISTBLOCKED )
+DECLARE_COMMAND( TEMPBLOCK )
+DECLARE_COMMAND( UNTEMPBLOCK )
+DECLARE_COMMAND( LISTTEMPBLOCKED )
/* Comment commands */
DECLARE_COMMAND( ADDNOTE )
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.
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.
<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
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
\.
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;
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;
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;
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;
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;
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;
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 */