[SithNet-Patches] [CVS] Module gnuworld-sithnet: Change committed
Brought to you by:
darthsidious_
From: Tim I. <dar...@us...> - 2003-08-30 22:24:31
|
Committer : Tim Ireland <dar...@us...> CVSROOT : /cvsroot/sithnet-dev Module : gnuworld-sithnet Commit time: 2003-08-30 22:24:29 UTC Modified files: mod.cservice/ADMINKILLCommand.cc mod.cservice/KILLCommand.cc Log message: bug fixes, these currently do not work. ---------------------- diff included ---------------------- Index: gnuworld-sithnet/mod.cservice/ADMINKILLCommand.cc diff -u gnuworld-sithnet/mod.cservice/ADMINKILLCommand.cc:1.1 gnuworld-sithnet/mod.cservice/ADMINKILLCommand.cc:1.2 --- gnuworld-sithnet/mod.cservice/ADMINKILLCommand.cc:1.1 Thu Aug 21 16:14:13 2003 +++ gnuworld-sithnet/mod.cservice/ADMINKILLCommand.cc Sat Aug 30 15:24:19 2003 @@ -4,13 +4,13 @@ * 23/06/2003 - Tim Ireland <dar...@us...> * Initial Version. * Make purely to kill time, if it works cool :) - * If it doesnt it may never. + * If it doesnt it may never - if you want to do a bugfix and send it to me, feel free :). * Based from the mod.nickserv RECOVERCommand * * This is similar to my KILLCommand.cc, except you can #define wether or not * you want to use it in your cservice_config.h file ( if you choose to * enable, be aware that all *750+ admins can use it... ) - * $Id: ADMINKILLCommand.cc,v 1.1 2003/08/21 23:14:13 darthsidious_ Exp $ + * $Id: ADMINKILLCommand.cc,v 1.2 2003/08/30 22:24:19 darthsidious_ Exp $ */ #include <string> @@ -18,59 +18,56 @@ #include <iostream> #include <iomanip> +#include "Network.h" +#include "iClient.h" //is this needed? put in because compiler came back with iClient not defined, now 'not declared in this scope' +#include "NetworkTarget.h" // needed? y/n? #include "StringTokenizer.h" #include "ELog.h" #include "cservice.h" #include "responses.h" #include "networkData.h" #include "cservice_config.h" -#include "Network.h" -const char KILLCommand_cc_rcsId[] = "$Id: ADMINKILLCommand.cc,v 1.1 2003/08/21 23:14:13 darthsidious_ Exp $" ; +// are any other #nclude's needed? - i really need to relearn all this :S + +const char ADMINKILLCommand_cc_rcsId[] = "$Id: ADMINKILLCommand.cc,v 1.2 2003/08/30 22:24:19 darthsidious_ Exp $" ; namespace gnuworld { using namespace gnuworld; -bool KILLCommand::Exec( iClient* theClient, const string& Message ) +bool ADMINKILLCommand::Exec( iClient* theClient, const string& Message ) { -bot->incStat("COMMANDS.ADMINKILL"); + bot->incStat("COMMANDS.ADMINKILL"); -#ifdef USE_ADMINKILL + #ifdef USE_ADMINKILL -StringTokenizer st( Message ) ; -if( st.size() < 3 ) + StringTokenizer st( Message ) ; + if( st.size() < 3 ) { - Usage(theClient); - return true; + Usage(theClient); + return true; } -/* - * Fetch the sqlUser record attached to this client. If there isn't one, - * they aren't logged in - tell them they should be. - */ + /* + * Fetch the sqlUser record attached to this client. If there isn't one, + * they aren't logged in - tell them they should be. + */ -sqlUser* theUser = bot->isAuthed(theClient, false); -if (!theUser) - { - return false; - } + sqlUser* theUser = bot->isAuthed(theClient, true); + if (!theUser) return false; -int admLevel = bot->getAdminAccessLevel(theUser); -// int oLevel = bot->GetOfficialAccessLevel(theUser); -if (admLevel < level::adminkill) // && (oLevel < level::official::scoder) - -/* keep this command 'quiet' i.e. dont let unauthorised user's - * know anyhting about it - * - bot->Notice(theClient, - bot->getResponse(theUser, - language::insuf_access, - string("Sorry, you have insufficient access to -perform that command."))); - */ - return false; + sqlChannel* admChan = bot->getChannelRecord("*"); + + int admLevel = bot->getAccessLevel(theUser, admChan); + if (admLevel < level::adminkill) + { + bot->Notice(theClient, + bot->getResponse(theUser, + language::insuf_access, + string("Sorry, you have insufficient access to perform that command."))); + return false; } /* @@ -79,7 +76,7 @@ */ iClient* Target = Network->findNick( st[ 2 ] ) ; -if( NULL == Target ) +if( iClient == NULL ) { bot->Notice( theClient, "Unable to find nick: %s", st[ 2 ].c_str() ) ; Index: gnuworld-sithnet/mod.cservice/KILLCommand.cc diff -u gnuworld-sithnet/mod.cservice/KILLCommand.cc:1.1 gnuworld-sithnet/mod.cservice/KILLCommand.cc:1.2 --- gnuworld-sithnet/mod.cservice/KILLCommand.cc:1.1 Thu Aug 21 16:14:13 2003 +++ gnuworld-sithnet/mod.cservice/KILLCommand.cc Sat Aug 30 15:24:19 2003 @@ -7,7 +7,7 @@ * If it doesnt it may never. * Based from the mod.nickserv RECOVERCommand * - * $Id: KILLCommand.cc,v 1.1 2003/08/21 23:14:13 darthsidious_ Exp $ + * $Id: KILLCommand.cc,v 1.2 2003/08/30 22:24:19 darthsidious_ Exp $ */ #include <string> @@ -17,9 +17,9 @@ #include "responses.h" #include "networkData.h" #include "cservice_config.h" -#include "Network.h" +#include "levels.h" -const char KILLCommand_cc_rcsId[] = "$Id: KILLCommand.cc,v 1.1 2003/08/21 23:14:13 darthsidious_ Exp $" ; +const char KILLCommand_cc_rcsId[] = "$Id: KILLCommand.cc,v 1.2 2003/08/30 22:24:19 darthsidious_ Exp $" ; namespace gnuworld { @@ -29,54 +29,46 @@ bool KILLCommand::Exec( iClient* theClient, const string& Message ) { -bot->incStat("COMMANDS.KILL"); + bot->incStat("COMMANDS.KILL"); -StringTokenizer st( Message ) ; -if( st.size() < 3 ) + StringTokenizer st( Message ) ; + if( st.size() < 3 ) { - Usage(theClient); - return true; + Usage(theClient); + return true; } -/* - * Fetch the sqlUser record attached to this client. If there isn't one, - * they aren't logged in - tell them they should be. - */ + /* + * Fetch the sqlUser record attached to this client. If there isn't one, + * they aren't logged in - tell them they should be. + */ -sqlUser* theUser = bot->isAuthed(theClient, false); -if (!theUser) - { - return false; - } + sqlUser* theUser = bot->isAuthed(theClient, true); + if (!theUser) return false; -int aLevel = bot->getAdminAccessLevel(theUser); -/* int oLevel = bot->GetOfficialAccessLevel(theUser); */ -if (aLevel < level::kill) - -/* keep this command 'quiet' i.e. dont let unauthorised user's - * know anyhting about it - * - bot->Notice(theClient, - bot->getResponse(theUser, - language::insuf_access, - string("Sorry, you have insufficient access to -perform that command."))); - */ - return false; + sqlChannel* admChan = bot->getChannelRecord("*"); + + int admLevel = bot->getAccessLevel(theUser, admChan); + if (admLevel < level::adminkill) + { + bot->Notice(theClient, + bot->getResponse(theUser, + language::insuf_access, + string("Sorry, you have insufficient access to perform that command."))); + return false; } -iClient* Target = Network->findNick( st[ 2 ] ) ; -if( NULL == Target ) +iClient* theClient = Network->findNick( st[ 2 ] ) ; +if( iClient == NULL ) { bot->Notice( theClient, "Unable to find nick: %s", st[ 2 ].c_str() ) ; return true ; } - if( Target->getMode(iClient::MODE_SERVICES)) + if( theClient->getMode(iClient::MODE_SERVICES)) { - bot->Notice(theClient,"Cannot Kill %s as it appears to be a -Network Service.",st[ 2 ].c_str()); + bot->Notice(theClient,"Cannot Kill %s as it appears to be a Network Service.",st[ 3 ].c_str()); return false; } } @@ -88,7 +80,7 @@ bot->Kill(targetClient, " %s ",reason.c_str()); -bot->Notice(theClient, "Succesfully Killed " + theClient->getNickName()); +bot->Notice(theClient, "Succesfully Killed " + iClient->getNickName()); bot->logAdminMessage("KILL %s",theClient->getNickName.c_str()); ----------------------- End of diff ----------------------- |