]> jfr.im git - irc/evilnet/mod.chanfix.git/commitdiff
tweak the messages and make them both optional. Also uncommented the isservice code...
authorsirvulcan <redacted>
Tue, 19 Sep 2006 04:05:08 +0000 (04:05 +0000)
committersirvulcan <redacted>
Tue, 19 Sep 2006 04:05:08 +0000 (04:05 +0000)
chanfix.cc
chanfix.example.conf.in
chanfix.h

index db2acbfa46ae17c582e8239a4de30c89529050bf..eb0260fc8472ff96f63db56df5dfb4e00c7da203 100644 (file)
@@ -373,6 +373,8 @@ joinChanModes = chanfixConfig->Require("joinChanModes")->second ;
 enableAutoFix = atob(chanfixConfig->Require("enableAutoFix")->second) ;
 enableChanFix = atob(chanfixConfig->Require("enableChanFix")->second) ;
 enableChannelBlocking = atob(chanfixConfig->Require("enableChannelBlocking")->second) ;
+autoFixNotice = atob(chanfixConfig->Require("autoFixNotice")->second) ;
+manualFixNotice = atob(chanfixConfig->Require("manualFixNotice")->second) ; 
 joinChannels = atob(chanfixConfig->Require("joinChannels")->second) ;
 stopAutoFixOnOp = atob(chanfixConfig->Require("stopAutoFixOnOp")->second) ;
 stopChanFixOnOp = atob(chanfixConfig->Require("stopChanFixOnOp")->second) ;
@@ -824,20 +826,14 @@ void chanfix::OnChannelModeO( Channel* theChan, ChannelUser* theUser,
 {
 /* if (currentState != RUN) return; */
 
-/* COMMENTED OUT DUE TO isService() NOT IN CORE YET
- * TODO: make sure that we ignore ops to C from servers (ie when it joins on a fix)
- *       assuming that joinchannel triggers this.
- * if (theUser) {
- *     // Let's see what server did the mode
- *     iServer* theServer = Network->findServer(theUser->getClient()->getIntYY());
- *     // If it was a service, then add the channel to the block list.
- *     if (theServer && theServer != MyUplink->getUplink() && theServer->isService()) {
- *       // Check if it isn't already in the block list. If not, add it.
- *       if (!isTempBlocked(theChan->getName()))
- *         tempBlockList.insert(tempBlockType::value_type(theChan->getName(), currentTime()));
- *     }
- * }
- */
+if (theUser) {
+  iServer* theServer = Network->findServer(theUser->getClient()->getIntYY());
+  if (theServer && theServer != MyUplink->getUplink() && theServer->isService()) {
+    if (!isTempBlocked(theChan->getName()))
+      tempBlockList.insert(tempBlockType::value_type(theChan->getName(), currentTime()));
+  }
+}
+
        
 if (theChan->size() < minClients)
   return;
@@ -1741,7 +1737,7 @@ MyUplink->JoinChannel(this, theChan->getName());
 
 void chanfix::PartChan(Channel* theChan)
 {
-MyUplink->PartChannel(this, theChan->getName(), "Channel Fixed");
+MyUplink->PartChannel(this, theChan->getName(), "");
 }
 
 /* Check for the channel service server to see if it is linked. */
@@ -1865,10 +1861,10 @@ for (xNetwork::channelIterator ptr = Network->channels_begin(); ptr != Network->
         autoFixQ.insert(fixQueueType::value_type(thisChan->getName(), currentTime()));
         numOpLess++;
 
-        if (doJoinChannels()) {
+        if (doJoinChannels())
           JoinChan(thisChan);
-          Message(thisChan, "Channel fix in progress, please stand by.");
-        }
+        if (doAutoFixNotice())
+          Message(thisChan, "Automatic channel fix in progress, please stand by.");
        }
      }
    }
@@ -1922,8 +1918,8 @@ if (useBurstToFix && thisChan->getCreationTime() > 1) {
 
 if (doJoinChannels())
   JoinChan(thisChan);
-
-Message(thisChan, "Channel fix in progress, please stand by.");
+if (doManualFixNotice())
+  Message(thisChan, "Channel fix in progress, please stand by.");
 
 manFixQ.insert(fixQueueType::value_type(thisChan->getName(), currentTime() + CHANFIX_DELAY));
 }
@@ -2103,12 +2099,15 @@ void chanfix::stopFixingChan(Channel* theChan, bool force)
 if (!theChan) return;
 
 bool inFix = false;
+int type = 0;
 
 if ((stopAutoFixOnOp || force) && isBeingAutoFixed(theChan)) {
+  type = 1;
   inFix = true;
   removeFromAutoQ(theChan);
 }
 if ((stopChanFixOnOp || force) && isBeingChanFixed(theChan)) {
+  type = 2;
   inFix = true;
   removeFromManQ(theChan);
 }
@@ -2121,6 +2120,11 @@ if (inFix) {
   }
 }
 
+if ((type == 1) && (doAutoFixNotice()))
+  Message(theChan, "Channel has been automatically fixed.");
+else if ((type == 2) && (doManualFixNotice()))
+  Message(theChan, "Channel has been fixed.");
+
 if (doJoinChannels())
   PartChan(theChan);
 
@@ -2294,6 +2298,8 @@ for (fixQueueType::iterator ptr = autoFixQ.begin(); ptr != autoFixQ.end(); ) {
       */
      if (isFixed || currentTime() - sqlChan->getFixStart() > AUTOFIX_MAXIMUM) {
        Channel* theChan = Network->findChannel(sqlChan->getChannel());
+       if (doAutoFixNotice())
+         Message(theChan, "Channel has been automatically fixed.");
        if (doJoinChannels())
          PartChan(theChan);
        autoFixQ.erase(ptr++);
@@ -2324,6 +2330,8 @@ for (fixQueueType::iterator ptr = manFixQ.begin(); ptr != manFixQ.end(); ) {
       */
      if (isFixed || currentTime() - sqlChan->getFixStart() > CHANFIX_MAXIMUM + CHANFIX_DELAY) {
        Channel* theChan = Network->findChannel(sqlChan->getChannel());
+       if (doManualFixNotice())
+         Message(theChan, "Channel has been fixed.");
        if (doJoinChannels())
          PartChan(theChan);
        manFixQ.erase(ptr++);
index eb2a995423b70d2c6a8e3a37097faac8b1b82a9a..4a5aef5ce8cc3217ae7e9f452d5c48f05033b864 100644 (file)
@@ -64,6 +64,14 @@ enableChannelBlocking = true
 # Should chanfix join the channel its fixing? this avoids the hopping issue
 joinChannels = true
 
+# Should chanfix send notices saying the channel is being fixed for auto
+# fixes. Also a notice after its finished saying its done?
+autoFixNotice = true
+
+# Should chanfix send notices saying the channel is being fixed for manual
+# fixes Also a notice after its finished saying its done?
+manualFixNotice = true
+
 # Should auto fixes stop if an already reopped user ops another user?
 stopAutoFixOnOp = true
 
index 0a9e36bb7d056e8f4bf7c5f9b5326e53e131d2f9..6d5eb01981f5344edfee33c9e79214e57e62bb94 100644 (file)
--- a/chanfix.h
+++ b/chanfix.h
@@ -425,6 +425,8 @@ public:
        bool            enableChanFix;
        bool            enableChannelBlocking;
        bool            joinChannels;
+       bool            autoFixNotice;
+       bool            manualFixNotice;
        bool            stopAutoFixOnOp;
        bool            stopChanFixOnOp;
        bool            allowTopOpFix;
@@ -502,6 +504,8 @@ public:
        bool doChanFix() { return enableChanFix; }
        bool doChanBlocking() { return enableChannelBlocking; }
        bool doJoinChannels() { return joinChannels; }
+       bool doAutoFixNotice() { return autoFixNotice; }
+       bool doManualFixNotice() { return manualFixNotice; }
        STATE getState() { return currentState; }
        bool isChanServLinked() { return chanServLinked; }
        bool isUpdateRunning() { return updateInProgress; }
@@ -528,8 +532,6 @@ public:
                { enableChanFix = _enableChanFix; }
        inline void     setDoChanBlocking(bool _enableChannelBlocking)
                { enableChannelBlocking = _enableChannelBlocking; }
-       inline void     setJoinChannels(bool _joinChannels)
-               { joinChannels = _joinChannels; }
        inline void     setCurrentDay()
                { currentDay = currentTime() / 86400 % DAYSAMPLES; }