]> jfr.im git - irc/UndernetIRC/gnuworld.git/commitdiff
Added the optional -u parameter to the changline commands. This will allow opers...
authorHidden <redacted>
Sat, 6 Jun 2009 07:53:34 +0000 (07:53 +0000)
committerHidden <redacted>
Sat, 6 Jun 2009 07:53:34 +0000 (07:53 +0000)
doc/ccontrol.help.sql
mod.ccontrol/FORCECHANGLINECommand.cc
mod.ccontrol/SCHANGLINECommand.cc
mod.ccontrol/ccontrol.cc
mod.ccontrol/ccontrol.h

index c3bb504b184ad0a2b60413df114f7b75ac9f4e5a..373ff30ae56f43a48630e06e12d69eca8938bbb1 100644 (file)
@@ -1,4 +1,4 @@
--- 2001-03-02 |MrBean| "$Id: ccontrol.help.sql,v 1.17 2008/12/27 23:34:30 hidden1 Exp $"
+-- 2001-03-02 |MrBean| "$Id: ccontrol.help.sql,v 1.18 2009/06/06 07:53:34 hidden1 Exp $"
 -- Created the file and added all help topics to the database
 
 -- 2201-03-11 |MrBean|
@@ -90,11 +90,12 @@ EXCEPTIONS          4       <host mask> - user@host mask to except
 EXCEPTIONS             5       <connections> - number of connections allowed before gline/warning
 FORCECHANGLINE         1       ****** FORCECHANGLINE COMMAND ******
 FORCECHANGLINE         2       Glines all users on the given channel
-FORCECHANGLINE         3       Syntax: /msg $BOT$ forcechangline <#channel> [duration] <reason>
+FORCECHANGLINE         3       Syntax: /msg $BOT$ forcechangline [-u] <#channel> [duration] <reason>
 FORCECHANGLINE         4       <#channel> - the channel name to gline
 FORCECHANGLINE         5       [duration] - Duration of the gline, may have s,m,h,d for secs,mins,hours,days
 FORCECHANGLINE         6       <reason> - reason for the gline
-FORCECHANGLINE         7       This type of chan gline is limited for 24 hours and cannot be issued on channels with opers or channels which are marked as nomode channels
+FORCECHANGLINE         7       [-u] - only glines the unidented clients found on the channel with ~*@IP glines
+FORCECHANGLINE         8       This type of chan gline is limited for 24 hours and cannot be issued on channels with opers or channels which are marked as nomode channels
 FORCEGLINE             1       ****** FORCEGLINE COMMAND ******
 FORCEGLINE             2       Glines a host for a certain amount of time
 FORCEGLINE             3       Syntax: /msg $BOT$ forcegline [-fu] <nick|user@host> <duration[s/m/h/d]> <reason>
@@ -272,16 +273,23 @@ SCANGLINE         3       Syntax: /msg $BOT$ scangline <host mask>
 SCANGLINE              4       <host mask> - the host mask to lookup
 SCHANGLINE             1       ****** SCHANGLINE COMMAND ******
 SCHANGLINE             2       Glines all users on the given channel
-SCHANGLINE             3       Syntax: /msg $BOT$ schangline <#channel> [duration] <reason>
+SCHANGLINE             3       Syntax: /msg $BOT$ schangline [-u] <#channel> [duration] <reason>
 SCHANGLINE             4       <#channel> - the channel name to gline
 SCHANGLINE             5       [duration] - Duration of the gline, may have s,m,h,d for secs,mins,hours,days
 SCHANGLINE             6       <reason> - reason for the gline
+SCHANGLINE             7       [-u] - only glines the unidented clients found on the channel with ~*@IP glines
 SGLINE         1       ****** SGLINE COMMAND ******
 SGLINE         2       gline a user@host with relaxed restrictions
 SGLINE         3       Syntax: /msg $BOT$ sgline <user@host> [duration] <reason>
 SGLINE         4       <user@host> - the user@host to gline from the network
 SGLINE         5       [duration] - duration of the gline, supports s,m,h,d for secs,mins,hours,days
 SGLINE         6       <reason> - reason for the gline
+SHELLS         1       ****** SHELLS COMMAND ******
+SHELLS         2       Add/remove/modify shells limits/exceptions
+SHELLS         3       Syntax: /msg $BOT$ SHELLS <addcompany|addnetblock|delcompany|delnetblock|list|chlimit|chname|clearall> <Shell company|Netblock> <max connections>
+SHELLS         4       <Shell company>: The name of the shell company
+SHELLS         5       <Netblock>: CIDR netblock
+SHELLS         6       <max connections>: The number of connections allowed before gline
 SHUTDOWN               1       ****** SHUTDOWN COMMAND ******
 SHUTDOWN               2       Shutdown the service and exit
 SHUTDOWN               3       Syntax: /msg $BOT$ shutdown <reason>
@@ -321,9 +329,3 @@ WHOIS               1       ****** WHOIS COMMAND ******
 WHOIS          2       Gives information about a user on the network
 WHOIS          3       Syntax: /msg $BOT$ whois <nick>
 WHOIS          4       <nick> - the person you want to get info about
-SHELLS         1       ****** SHELLS COMMAND ******
-SHELLS         2       Add/remove/modify shells limits/exceptions
-SHELLS         3       Syntax: /msg $BOT$ SHELLS <addcompany|addnetblock|delcompany|delnetblock|list|chlimit|chname|clearall> <Shell company|Netblock> <max connections>
-SHELLS         4       <Shell company>: The name of the shell company
-SHELLS         5       <Netblock>: CIDR netblock
-SHELLS         6       <max connections>: The number of connections allowed before gline
index aa0bf75c02f2df5bbd02390e892a848aabbc00dc..dd737511ca3878fa0aa8999f90788db877edfe80 100755 (executable)
@@ -17,7 +17,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: FORCECHANGLINECommand.cc,v 1.4 2009/05/16 07:47:23 danielaustin Exp $
+ * $Id: FORCECHANGLINECommand.cc,v 1.5 2009/06/06 07:53:34 hidden1 Exp $
  */
 
 #include       <string>
@@ -41,7 +41,7 @@
 #include       "Constants.h"
 #include       "gnuworld_config.h"
 
-RCSTAG( "$Id: FORCECHANGLINECommand.cc,v 1.4 2009/05/16 07:47:23 danielaustin Exp $" ) ;
+RCSTAG( "$Id: FORCECHANGLINECommand.cc,v 1.5 2009/06/06 07:53:34 hidden1 Exp $" ) ;
 
 namespace gnuworld
 {
@@ -61,6 +61,7 @@ bool FORCECHANGLINECommand::Exec( iClient* theClient, const string& Message )
        const int MAX_CHANGLINE_LENGTH = 24*3600;
        StringTokenizer st(Message);
        unsigned int ResStart = 2;
+       int uParam = 0; // if the -u paramter is used in the command, it will only gline unidented connections
 
        if (st.size() < 4)
        {
@@ -68,6 +69,14 @@ bool FORCECHANGLINECommand::Exec( iClient* theClient, const string& Message )
                return true;
        }
 
+       if (st[1] == "-u") {
+               if (st.size() < 5) {
+                       Usage(theClient);
+                       return true;
+               }
+        uParam = 1;    
+       }
+
        StringTokenizer::size_type pos = 1;
        time_t gLength = bot->getDefaultGlineLength();
        ccUser* tmpUser = bot->IsAuth(theClient);
@@ -76,15 +85,15 @@ bool FORCECHANGLINECommand::Exec( iClient* theClient, const string& Message )
        bot->MsgChanLog("FORCECHANGLINE %s\n",st.assemble(1).c_str());
 
        /* make sure they're trying a channel gline! */
-       if (st[pos].substr(0,1) != "#")
+       if (st[pos+uParam].substr(0,1) != "#")
        {
                bot->Notice(theClient,"Umm... this is CHANGLINE, not GLINE - Try "
                        "glining a channel maybe?");
                return true;
        }
-       if (IsTimeSpec(st[2]))
+       if (IsTimeSpec(st[2+uParam]))
        {
-               gLength = extractTime( st[2], 1 );
+               gLength = extractTime( st[2+uParam], 1 );
        } else {
                gLength = bot->getDefaultGlineLength();
                ResStart = 1;
@@ -103,28 +112,28 @@ bool FORCECHANGLINECommand::Exec( iClient* theClient, const string& Message )
                return false;
        }
 
-       if (st[1].size() > channel::MaxName)
+       if (st[1+uParam].size() > channel::MaxName)
        {
                bot->Notice(theClient,"Channel name can't be more than %d "
                        "characters", channel::MaxName);
                return false;
        }
-       if(bot->isBadChannel(st[1]) != NULL)
+       if(bot->isBadChannel(st[1+uParam]) != NULL)
                {
                bot->Notice(theClient,"You cant gline a nomode channel");
                return false;
                }
-       Channel* theChan = Network->findChannel(st[1]);
+       Channel* theChan = Network->findChannel(st[1+uParam]);
        if (NULL == theChan)
        {
                bot->Notice(theClient, "Unable to find channel %s",
-                       st[1].c_str());
+                       st[1+uParam].c_str());
                return true;
        }
 
-       StringTokenizer reason(st.assemble(pos + ResStart), '|');
+       StringTokenizer reason(st.assemble(pos + ResStart + uParam), '|');
 
-       if(!bot->glineChannelUsers(theClient, theChan, reason[0], gLength, nickUserHost,true))
+       if(!bot->glineChannelUsers(theClient, theChan, reason[0], gLength, nickUserHost,true,uParam))
                {
                bot->Notice(theClient, "You cant gline a channel which has an oper in it");
                }
index e5fda2c94ca4d8bdb118119e9e4501d616c6076d..439e1c657fe1362be80ae694a4832731e153074c 100644 (file)
@@ -17,7 +17,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: SCHANGLINECommand.cc,v 1.4 2009/05/16 07:47:23 danielaustin Exp $
+ * $Id: SCHANGLINECommand.cc,v 1.5 2009/06/06 07:53:34 hidden1 Exp $
  */
 
 #include       <string>
@@ -41,7 +41,7 @@
 #include       "Constants.h"
 #include       "gnuworld_config.h"
 
-RCSTAG( "$Id: SCHANGLINECommand.cc,v 1.4 2009/05/16 07:47:23 danielaustin Exp $" ) ;
+RCSTAG( "$Id: SCHANGLINECommand.cc,v 1.5 2009/06/06 07:53:34 hidden1 Exp $" ) ;
 
 namespace gnuworld
 {
@@ -60,6 +60,7 @@ bool SCHANGLINECommand::Exec( iClient* theClient, const string& Message )
 {
        StringTokenizer st(Message);
        unsigned ResStart = 2;
+       int uParam = 0; // if the -u paramter is used in the command, it will only gline unidented connections
 
        if (st.size() < 4)
        {
@@ -67,6 +68,14 @@ bool SCHANGLINECommand::Exec( iClient* theClient, const string& Message )
                return true;
        }
 
+       if (st[1] == "-u") {
+               if (st.size() < 5) {
+                       Usage(theClient);
+                       return true;
+               }
+        uParam = 1;    
+       }
+
        StringTokenizer::size_type pos = 1;
        time_t gLength = bot->getDefaultGlineLength();
        ccUser* tmpUser = bot->IsAuth(theClient);
@@ -75,15 +84,15 @@ bool SCHANGLINECommand::Exec( iClient* theClient, const string& Message )
        bot->MsgChanLog("SCHANGLINE %s\n",st.assemble(1).c_str());
 
        /* make sure they're trying a channel gline! */
-       if (st[pos].substr(0,1) != "#")
+       if (st[pos+uParam].substr(0,1) != "#")
        {
                bot->Notice(theClient,"Umm... this is SCHANGLINE, not GLINE - Try "
                        "glining a channel maybe?");
                return true;
        }
-       if (IsTimeSpec(st[2]))
+       if (IsTimeSpec(st[2+uParam]))
        {
-               gLength = extractTime( st[2], 1 );
+               gLength = extractTime( st[2+uParam], 1 );
        } else {
                gLength = bot->getDefaultGlineLength();
                ResStart = 1;
@@ -97,24 +106,24 @@ bool SCHANGLINECommand::Exec( iClient* theClient, const string& Message )
                return false;
        }
 
-       if (st[1].size() > channel::MaxName)
+       if (st[1+uParam].size() > channel::MaxName)
        {
                bot->Notice(theClient,"Channel name can't be more than %d "
                        "characters", channel::MaxName);
                return false;
        }
 
-       Channel* theChan = Network->findChannel(st[1]);
+       Channel* theChan = Network->findChannel(st[1+uParam]);
        if (NULL == theChan)
        {
                bot->Notice(theClient, "Unable to find channel %s",
-                       st[1].c_str());
+                       st[1+uParam].c_str());
                return true;
        }
 
-       StringTokenizer reason(st.assemble ( pos + ResStart), '|');
+       StringTokenizer reason(st.assemble ( pos + ResStart + uParam), '|');
 
-       bot->glineChannelUsers(theClient, theChan, reason[0], gLength, nickUserHost, false);
+       bot->glineChannelUsers(theClient, theChan, reason[0], gLength, nickUserHost, false, uParam);
        return true;
 }
 
index 41fb1ff17b9821ad35d323ad4d7f66d795f657bf..8287b85cde9b24030050949374699390e3cf7d43 100644 (file)
@@ -20,7 +20,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: ccontrol.cc,v 1.226 2009/05/31 21:31:55 hidden1 Exp $
+ * $Id: ccontrol.cc,v 1.227 2009/06/06 07:53:34 hidden1 Exp $
 */
 
 #define MAJORVER "1"
@@ -67,7 +67,7 @@
 #include       "ccontrol_generic.h"
 #include       "gnuworld_config.h"
 
-RCSTAG( "$Id: ccontrol.cc,v 1.226 2009/05/31 21:31:55 hidden1 Exp $" ) ;
+RCSTAG( "$Id: ccontrol.cc,v 1.227 2009/06/06 07:53:34 hidden1 Exp $" ) ;
 
 namespace gnuworld
 {
@@ -257,7 +257,7 @@ RegisterCommand( new MODECommand( this, "MODE", "<channel> <modes> "
        operLevel::OPERLEVEL,
        false ) ) ;
 RegisterCommand( new SCHANGLINECommand( this, "SCHANGLINE",
-       "<#channel> <duration>[time units (s,d,h)] <reason> "
+       "[-u] <#channel> <duration>[time units (s,d,h)] <reason> "
        "Gline a given channel for the given reason",
        true,
        commandLevel::flg_SCHANGLINE,
@@ -267,7 +267,7 @@ RegisterCommand( new SCHANGLINECommand( this, "SCHANGLINE",
        operLevel::CODERLEVEL,
        true ) ) ;
 RegisterCommand( new FORCECHANGLINECommand( this, "FORCECHANGLINE",
-               "<#channel> <duration>[time units (s,d,h)] <reason> "
+               "[-u] <#channel> <duration>[time units (s,d,h)] <reason> "
                "Gline a given channel for the given reason",
                true,
                commandLevel::flg_FORCECHANGLINE,
@@ -6251,7 +6251,7 @@ void ccontrol::remBadChannel(ccBadChannel* Channel)
 badChannelsMap.erase(badChannelsMap.find(Channel->getName()));
 }
 
-bool ccontrol::glineChannelUsers(iClient* theClient, Channel* theChan, const string& reason, unsigned int gLength, const string& addedBy,bool excludeChanWithOper)
+bool ccontrol::glineChannelUsers(iClient* theClient, Channel* theChan, const string& reason, unsigned int gLength, const string& addedBy,bool excludeChanWithOper,bool unidented)
 {
 ccGline *TmpGline;
 iClient *TmpClient;
@@ -6285,6 +6285,8 @@ for (Channel::const_userIterator ptr = theChan->userList_begin();
                foundException = true;
                Notice(theClient, "There is an exception for this user: %s!%s@%s", TmpClient->getNickName().c_str(), TmpClient->getUserName().c_str(), curIP.c_str());
                }
+       if ((unidented) && (TmpClient->getUserName().substr(0,1)) != "~")
+               continue;
        gptr = glineList.find("*@" + curIP);
        if (gptr != glineList.end())
                {
@@ -6299,7 +6301,10 @@ for (Channel::const_userIterator ptr = theChan->userList_begin();
                /* create a new gline and queue it */
                TmpGline = new ccGline(SQLDb);
                assert(TmpGline != NULL);
-               TmpGline->setHost("*@"  + curIP);
+               if (unidented)
+                       TmpGline->setHost("~*@"  + curIP);
+               else
+                       TmpGline->setHost("*@"  + curIP);
                TmpGline->setExpires(unsigned(gLength));
                TmpGline->setAddedBy(addedBy);
                TmpGline->setReason(reason);
index f9bfe03618bb7675c3646d48f4a724faf7e19374..c358d82c7bd6dee01d79e6154dea0c3dc0ce059a 100755 (executable)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: ccontrol.h,v 1.108 2009/05/31 21:31:55 hidden1 Exp $
+ * $Id: ccontrol.h,v 1.109 2009/06/06 07:53:34 hidden1 Exp $
  */
 
 #ifndef __CCONTROL_H
-#define __CCONTROL_H "$Id: ccontrol.h,v 1.108 2009/05/31 21:31:55 hidden1 Exp $"
+#define __CCONTROL_H "$Id: ccontrol.h,v 1.109 2009/06/06 07:53:34 hidden1 Exp $"
 
 //Undef this if you want to log to the database
 #define LOGTOHD 
@@ -733,7 +733,7 @@ public:
        
        bool updateMisc(const string&, const unsigned int);
        
-       bool glineChannelUsers(iClient* , Channel* , const string& , unsigned int , const string& , bool);
+       bool glineChannelUsers(iClient* , Channel* , const string& , unsigned int , const string& , bool, bool);
 
        /**
         * This is a constant iterator type used to perform a read-only