X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_opersha256.cpp;h=44b2c936d9b2814eb087a074d0342666d8cf4b53;hb=7c0c957577a195b4819e4d7f2c9672d7c7522b0d;hp=74dad83158863b2ce0d55d34b348c5bf5789b30d;hpb=b37a253d962ed7af1ea7a328abf2a1af74f30759;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_opersha256.cpp b/src/modules/m_opersha256.cpp index 74dad8315..44b2c936d 100644 --- a/src/modules/m_opersha256.cpp +++ b/src/modules/m_opersha256.cpp @@ -44,10 +44,10 @@ using namespace std; #include "users.h" #include "channels.h" #include "modules.h" -#include "helperfuncs.h" + #include "inspircd.h" -static Server *Srv; + #define SHA256_DIGEST_SIZE (256 / 8) #define SHA256_BLOCK_SIZE (512 / 8) @@ -56,6 +56,8 @@ static Server *Srv; typedef unsigned int uint32_t; #endif +/** An sha 256 context, used by m_opersha256 + */ class SHA256Context : public classbase { public: @@ -225,20 +227,23 @@ void SHA256(const char *src, char *dest, int len) } } +/** Handle /MKSHA256 + */ class cmd_mksha256 : public command_t { public: - cmd_mksha256() : command_t("MKSHA256", 'o', 1) + cmd_mksha256 (InspIRCd* Instance) : command_t(Instance,"MKSHA256", 'o', 1) { this->source = "m_opersha256.so"; syntax = ""; } - void Handle(const char** parameters, int pcnt, userrec *user) + CmdResult Handle(const char** parameters, int pcnt, userrec *user) { char buffer[SHA256_BLOCK_SIZE + 1]; SHA256(parameters[0], buffer, strlen(parameters[0])); - user->WriteServ( "NOTICE %s :SHA256 hashed password for %s is %s", user->nick, parameters[0], buffer); + user->WriteServ("NOTICE %s :SHA256 hashed password for %s is %s", user->nick, parameters[0], buffer); + return CMD_SUCCESS; } }; @@ -250,8 +255,8 @@ public: ModuleOperSHA256(InspIRCd* Me) : Module::Module(Me) { - mksha256cmd = new cmd_mksha256(); - Srv->AddCommand(mksha256cmd); + mksha256cmd = new cmd_mksha256(ServerInstance); + ServerInstance->AddCommand(mksha256cmd); } virtual ~ModuleOperSHA256()