X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_testclient.cpp;h=20fe6acb56b044c854eae3382a01ceb58542620a;hb=5a88424dbb33ac825aa0b9b6525179329ee75519;hp=6aec581aee179d7e26d6102ece6eee1af81d0ff7;hpb=69790e320dcc16845a30e10a5a53ee63b26853fd;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/extra/m_testclient.cpp b/src/modules/extra/m_testclient.cpp index 6aec581ae..20fe6acb5 100644 --- a/src/modules/extra/m_testclient.cpp +++ b/src/modules/extra/m_testclient.cpp @@ -3,19 +3,21 @@ #include "users.h" #include "channels.h" #include "modules.h" -#include "helperfuncs.h" + #include "inspircd.h" #include "configreader.h" #include "m_sqlv2.h" + + class ModuleTestClient : public Module { private: - Server* Srv; + public: - ModuleTestClient(Server* Me) - : Module::Module(Me), Srv(Me) + ModuleTestClient(InspIRCd* Me) + : Module::Module(Me) { } @@ -26,12 +28,12 @@ public: virtual Version GetVersion() { - return Version(1, 0, 0, 0, VF_VENDOR); + return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION); } virtual void OnBackgroundTimer(time_t foo) { - Module* target = Srv->FindFeature("SQL"); + Module* target = ServerInstance->FindFeature("SQL"); if(target) { @@ -39,11 +41,11 @@ public: if(foo.Send()) { - log(DEBUG, "Sent query, got given ID %lu", foo.id); + ServerInstance->Log(DEBUG, "Sent query, got given ID %lu", foo.id); } else { - log(DEBUG, "SQLrequest failed: %s", foo.error.Str()); + ServerInstance->Log(DEBUG, "SQLrequest failed: %s", foo.error.Str()); } } } @@ -52,7 +54,7 @@ public: { if(strcmp(SQLRESID, request->GetId()) == 0) { - log(DEBUG, "Got SQL result (%s)", request->GetId()); + ServerInstance->Log(DEBUG, "Got SQL result (%s)", request->GetId()); SQLresult* res = (SQLresult*)request; @@ -60,33 +62,33 @@ public: { if(res->Cols()) { - log(DEBUG, "Got result with %d rows and %d columns", res->Rows(), res->Cols()); + ServerInstance->Log(DEBUG, "Got result with %d rows and %d columns", res->Rows(), res->Cols()); for (int r = 0; r < res->Rows(); r++) { - log(DEBUG, "Row %d:", r); + ServerInstance->Log(DEBUG, "Row %d:", r); for(int i = 0; i < res->Cols(); i++) { - log(DEBUG, "\t[%s]: %s", res->ColName(i).c_str(), res->GetValue(r, i).d.c_str()); + ServerInstance->Log(DEBUG, "\t[%s]: %s", res->ColName(i).c_str(), res->GetValue(r, i).d.c_str()); } } } else { - log(DEBUG, "%d rows affected in query", res->Rows()); + ServerInstance->Log(DEBUG, "%d rows affected in query", res->Rows()); } } else { - log(DEBUG, "SQLrequest failed: %s", res->error.Str()); + ServerInstance->Log(DEBUG, "SQLrequest failed: %s", res->error.Str()); } return SQLSUCCESS; } - log(DEBUG, "Got unsupported API version string: %s", request->GetId()); + ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId()); return NULL; } @@ -107,7 +109,7 @@ class ModuleTestClientFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleTestClient(Me); }