X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_mssql.cpp;h=43d546819fb26200c6dd58b5bab9e4c254d088ca;hb=7e843c22e16c81054bad18073d24fe1a07026431;hp=9cc7a567c80afaf5153e563fbfcdb0c45f5b961b;hpb=8235290c734c17f5b52533876136e9a61d231c9d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp index 9cc7a567c..43d546819 100644 --- a/src/modules/extra/m_mssql.cpp +++ b/src/modules/extra/m_mssql.cpp @@ -35,7 +35,7 @@ typedef std::deque ResultQueue; unsigned long count(const char * const str, char a) { unsigned long n = 0; - for (const char *p = reinterpret_cast(str); *p; ++p) + for (const char *p = str; *p; ++p) { if (*p == '?') ++n; @@ -50,13 +50,9 @@ Mutex* LoggingMutex; class QueryThread : public SocketThread { private: - ModuleMsSQL* Parent; - InspIRCd* ServerInstance; + ModuleMsSQL* const Parent; public: - QueryThread(InspIRCd* si, ModuleMsSQL* mod) - : SocketThread(si), Parent(mod), ServerInstance(si) - { - } + QueryThread(ModuleMsSQL* mod) : Parent(mod) { } ~QueryThread() { } virtual void Run(); virtual void OnNotify(); @@ -232,7 +228,6 @@ class SQLConn : public classbase { private: ResultQueue results; - InspIRCd* ServerInstance; Module* mod; SQLhost host; TDSLOGIN* login; @@ -242,8 +237,8 @@ class SQLConn : public classbase public: QueryQueue queue; - SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi) - : ServerInstance(SI), mod(m), host(hi), login(NULL), sock(NULL), context(NULL) + SQLConn(Module* m, const SQLhost& hi) + : mod(m), host(hi), login(NULL), sock(NULL), context(NULL) { if (OpenDB()) { @@ -511,7 +506,7 @@ class SQLConn : public classbase { SQLConn* sc = (SQLConn*)pContext->parent; LoggingMutex->Lock(); - sc->ServerInstance->Logs->Log("m_mssql", DEBUG, "Message for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); + ServerInstance->Logs->Log("m_mssql", DEBUG, "Message for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); LoggingMutex->Unlock(); return 0; } @@ -520,7 +515,7 @@ class SQLConn : public classbase { SQLConn* sc = (SQLConn*)pContext->parent; LoggingMutex->Lock(); - sc->ServerInstance->Logs->Log("m_mssql", DEFAULT, "Error for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); + ServerInstance->Logs->Log("m_mssql", DEFAULT, "Error for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); LoggingMutex->Unlock(); return 0; } @@ -643,8 +638,8 @@ class ModuleMsSQL : public Module QueryThread* queryDispatcher; public: - ModuleMsSQL(InspIRCd* Me) - : Module(Me), currid(0) + ModuleMsSQL() + : currid(0) { LoggingMutex = new Mutex(); ResultsMutex = new Mutex(); @@ -658,7 +653,7 @@ class ModuleMsSQL : public Module ReadConf(); - queryDispatcher = new QueryThread(ServerInstance, this); + queryDispatcher = new QueryThread(this); ServerInstance->Threads->Start(queryDispatcher); ServerInstance->Modules->PublishInterface("SQL", this); @@ -709,7 +704,7 @@ class ModuleMsSQL : public Module bool HostInConf(const SQLhost &h) { - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -729,7 +724,7 @@ class ModuleMsSQL : public Module { ClearOldConnections(); - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -760,7 +755,7 @@ class ModuleMsSQL : public Module SQLConn* newconn; - newconn = new SQLConn(ServerInstance, this, hi); + newconn = new SQLConn(this, hi); connections.insert(std::make_pair(hi.id, newconn)); } @@ -837,7 +832,7 @@ class ModuleMsSQL : public Module virtual Version GetVersion() { - return Version("$Id$", VF_VENDOR | VF_SERVICEPROVIDER, API_VERSION); + return Version("MsSQL provider", VF_VENDOR | VF_SERVICEPROVIDER, API_VERSION); } };