false,
commandLevel::flg_INVITE,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_JUPE,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_MODE,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_SCHANGLINE,
false,
- false,
+ true,
false,
operLevel::CODERLEVEL,
true ) ) ;
RegisterCommand( new FORCECHANGLINECommand( this, "FORCECHANGLINE",
- "[-u] <#channel> <duration>[time units (s,d,h)] <reason> "
- "Gline a given channel for the given reason",
- true,
- commandLevel::flg_FORCECHANGLINE,
- false,
- false,
- false,
- operLevel::OPERLEVEL,
- true ) ) ;
+ "[-u] <#channel> <duration>[time units (s,d,h)] <reason> "
+ "Gline a given channel for the given reason",
+ true,
+ commandLevel::flg_FORCECHANGLINE,
+ false,
+ true,
+ false,
+ operLevel::OPERLEVEL,
+ true ) ) ;
RegisterCommand( new GLINECommand( this, "GLINE",
"<user@host> <duration>[time units (s,d,h)] <reason> "
"Gline a given user@host for the given reason",
true,
commandLevel::flg_GLINE,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_SCGLINE,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_REMGLINE,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_TRANS,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_WHOIS,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_KICK,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_ADDOPCHN,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_REMOPCHN,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
"List current IRCoperator only channels",
false,
commandLevel::flg_LOPCHN,
- false,
+ true,
false,
false,operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_CHINFO,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_LOGIN,
false,
- true,
+ false,
true,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_ADDNOP,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_REMOP,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_ADDCMD,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_DELCMD,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
false,
true,
- operLevel::OPERLEVEL,
+ operLevel::UHSLEVEL,
false ) ) ;
RegisterCommand( new SUSPENDCommand( this, "SUSPEND",
"<OPER> <DURATION> [-l level] <REASON>"
true,
commandLevel::flg_SUSPEND,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_UNSUSPEND,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_MODOP,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_MODERATE,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_UNMODERATE,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_OP,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_DEOP,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_LISTHOSTS,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) );
true,
commandLevel::flg_LIST,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true));
false,
commandLevel::flg_CLEARCHAN,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_ADDSERVER,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
true,
commandLevel::flg_LEARNNET,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
true,
commandLevel::flg_REMSERVER,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
true,
commandLevel::flg_CHECKNET,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
true,
commandLevel::flg_LASTCOM,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true) ) ;
true,
commandLevel::flg_LASTCOM,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true) ) ;
true,
commandLevel::flg_FGLINE,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
true,
commandLevel::flg_SGLINE,
false,
- false,
+ true,
false,
operLevel::CODERLEVEL,
true ) ) ;
true,
commandLevel::flg_REMSGLINE,
false,
- false,
+ true,
false,
operLevel::CODERLEVEL,
true ) ) ;
true,
commandLevel::flg_EXCEPTIONS,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
true,
commandLevel::flg_SHELLS,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
false,
commandLevel::flg_LISTIGNORES,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
false,
commandLevel::flg_REMIGNORE,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
false,
commandLevel::flg_LIST,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
true,
commandLevel::flg_COMMANDS,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
true,
commandLevel::flg_GCHAN,
false,
- false,
+ true,
false,
operLevel::CODERLEVEL,
true ) ) ;
true,
commandLevel::flg_GCHAN,
false,
- false,
+ true,
false,
operLevel::CODERLEVEL,
true ) ) ;
false,
commandLevel::flg_USERINFO,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
false,
commandLevel::flg_STATUS,
false,
- false,
+ true,
false,
operLevel::CODERLEVEL,
true ) ) ;
false,
commandLevel::flg_SHUTDOWN,
false,
- false,
+ true,
false,
operLevel::CODERLEVEL,
true ) ) ;
false,
commandLevel::flg_SCAN,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
false,
commandLevel::flg_MAXUSERS,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
false,
commandLevel::flg_CONFIG,
false,
- false,
+ true,
false,
operLevel::CODERLEVEL,
true ) ) ;
false,
commandLevel::flg_NOMODE,
false,
- false,
+ true,
false,
operLevel::SMTLEVEL,
true ) ) ;
false,
commandLevel::flg_SAY,
false,
- false,
+ true,
false,
operLevel::CODERLEVEL,
true ) ) ;
false,
commandLevel::flg_SAY,
false,
- false,
+ true,
false,
operLevel::CODERLEVEL,
true ) ) ;
false,
commandLevel::flg_REOP,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
false ) ) ;
false,
commandLevel::flg_UNJUPE,
false,
- false,
+ true,
false,
operLevel::OPERLEVEL,
true ) ) ;
ccUser* theUser = IsAuth(theClient);
-if((!theUser) && !(theClient->isOper()))
+/*if((!theUser) && !(theClient->isOper()))
{
- // We need to add the flood points for this user
- if(!theClient->getCustomData(this))
- {
- elog << "Couldnt find custom data for "
- << theClient->getNickName() << endl;
- return ;
- }
-
- ccFloodData* floodData = (static_cast< ccUserData* >(
- theClient->getCustomData(this) ))->getFlood() ;
-
- if(floodData->addPoints(flood::MESSAGE_POINTS))
- {
- // yes we need to ignore this user
- ignoreUser(floodData);
-
- MsgChanLog("[FLOOD MESSAGE: %s has been ignored",
- theClient->getNickName().c_str());
- }
+ addFloodData(theClient,flood::MESSAGE_POINTS);
xClient::OnPrivateMessage( theClient, Message ) ;
return ;
- }
+ }**/
// Attempt to find a handler for this method.
commandIterator commHandler = findCommand( Command ) ;
if((!theUser) && (ComAccess) && !(theClient->isOper()))
{
+ addFloodData(theClient,flood::MESSAGE_POINTS);
xClient::OnPrivateMessage( theClient, Message ) ;
return ;
}
//and he must be to run this command
if((theClient->isOper()) && !(theClient->getMode(iClient::MODE_SERVICES)))
Notice(theClient,"Sorry, you must be authenticated to run this command");
-
+ else if(!theClient->isOper())
+ addFloodData(theClient,flood::MESSAGE_POINTS);
xClient::OnPrivateMessage( theClient, Message ) ;
return ;
}
+
+//If user is not not opered and the command requires to be opered
+if((!theClient->isOper()) && (commHandler->second->getNeedOp())) {
+ addFloodData(theClient,flood::MESSAGE_POINTS);
+ xClient::OnPrivateMessage(theClient, Message);
+ return;
+}
if((theUser) && (!theClient->isOper()) && (theUser->getNeedOp()))
{
if(!theClient->getMode(iClient::MODE_SERVICES))
Notice(theClient,
"You must be oper'd to use this command");
+ xClient::OnPrivateMessage(theClient, Message);
+ return;
}
else if( (ComAccess) && (theUser) && !(theUser->gotAccess(commHandler->second)))
{
- if(!theClient->getMode(iClient::MODE_SERVICES))
+ if(!theClient->getMode(iClient::MODE_SERVICES) && theClient->isOper())
Notice( theClient, "You don't have access to that command" ) ;
}
else if(( (theUser) && isSuspended(theUser) ) && ( ComAccess ) )
{
- if(theClient->getMode(iClient::MODE_SERVICES))
+ if(theClient->getMode(iClient::MODE_SERVICES) && theClient->isOper())
Notice( theClient,
"Sorry, you are suspended");
}
else if(commHandler->second->getIsDisabled())
{
- if(!theClient->getMode(iClient::MODE_SERVICES))
+ if(!theClient->getMode(iClient::MODE_SERVICES) && theClient->isOper())
Notice(theClient,
"Sorry, this command is currently disabled");
}
if (!dbConnected)
{
/* failed */
- Notice(theClient, "Sorry, the database connection "
- "is currently down, please try again later.");
+ if(theClient->isOper() && !theClient->isModeK())
+ Notice(theClient, "Sorry, the database connection "
+ "is currently down, please try again later.");
xClient::OnPrivateMessage(theClient, Message);
return;
}
{
ignoreUser(LogInfo);
}
-}
+}
+
+void ccontrol::addFloodData(iClient* theClient, unsigned int floodPoints) {
+ if (!theClient->getCustomData(this)) {
+ elog << "Couldnt find custom data for "
+ << theClient->getNickName() << endl;
+ return;
+ }
+
+ ccFloodData* floodData = (static_cast<ccUserData*> (
+ theClient->getCustomData(this)))->getFlood();
+
+ if (floodData->addPoints(flood::MESSAGE_POINTS)) {
+ // yes we need to ignore this user
+ ignoreUser(floodData);
+
+ MsgChanLog("[FLOOD MESSAGE: %s has been ignored",
+ theClient->getNickName().c_str());
+ }
+}
int ccontrol::removeIgnore( const string &Host )
{
string Host = string( "*!*" )
+ theClient->getUserName()
+ string( "@" )
- + theClient->getRealInsecureHost();
+ + theClient->getRealNickUserHost();
int retMe = removeIgnore(Host);
return retMe;
}
{
const iClient* theClient = Network->findClient(Flood->getNumeric());
-Notice(theClient,"I don't think I like you anymore, consider yourself ignored!");
+if(theClient->isOper()) {
+ Notice(theClient,"I don't think I like you anymore, consider yourself ignored!");
+}
MsgChanLog("Added %s to my ignore list\n",theClient->getRealNickUserHost().c_str());
string silenceMask = string( "*!*" )
+ theClient->getUserName()
+ "@"
- + theClient->getRealInsecureHost();
+ + theClient->getRealNickUserHost();
stringstream s;
s << getCharYYXXX()
bool ccontrol::updateCommand ( Command* Comm)
{
+
+static const char *existsQ = "SELECT RealName from Commands where lower(RealName) = '";
static const char *Main = "UPDATE Commands set name = '";
if(!dbConnected)
}
stringstream theQuery;
-theQuery << Main
+theQuery << existsQ << string_lower(removeSqlChars(Comm->getRealName())) << "'";
+bool update = (SQLDb->Exec(theQuery, true) && (SQLDb->Tuples() > 0));
+theQuery.str("");
+if(update) {
+ theQuery << Main
<< removeSqlChars(Comm->getName())
<< "', isDisabled = "
<< (Comm->getIsDisabled() ? "'t'" : "'n'")
<< "'"
<< ends;
+} else {
+ theQuery << "INSERT into Commands (RealName,Name,Flags,IsDisabled,NeedOp,NoLog,MinLevel,SAccess) VALUES (";
+ theQuery << "'" << removeSqlChars(Comm->getRealName()) << "',";
+ theQuery << "'" << removeSqlChars(Comm->getName()) << "',";
+ theQuery << Comm->getFlags() << ",";
+ theQuery << (Comm->getIsDisabled() ? "'t'" : "'n'") << ",";
+ theQuery << (Comm->getNeedOp() ? "'t'" : "'n'") << ",";
+ theQuery << (Comm->getNoLog() ? "'t'" : "'n'") << ",";
+ theQuery << Comm->getMinLevel() << ",";
+ theQuery << (Comm->getSecondAccess() ? "'t'" : "'n'") << ")";
+
+}
#ifdef LOG_SQL
-elog << "ccontrol::updateCommands> "
- << theQuery.str().c_str()
- << endl;
+ elog << "ccontrol::updateCommands> "
+ << theQuery.str().c_str()
+ << endl;
#endif
if( !SQLDb->Exec( theQuery ) )