]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_sqlite3.cpp
Header tidyups. Apart from module to module API stuff and external deps, modules...
[user/henk/code/inspircd.git] / src / modules / extra / m_sqlite3.cpp
index 086e70ac5a4fe3512f4e6dd16bec81f2fd681ce3..d51bc16953845bb8647c571fcbbdcc63d0e1254f 100644 (file)
@@ -13,9 +13,6 @@
 
 #include "inspircd.h"
 #include <sqlite3.h>
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 #include "m_sqlv2.h"
 
 /* $ModDesc: sqlite3 provider */
@@ -50,7 +47,7 @@ class ResultNotifier : public BufferedSocket
        virtual bool OnDataReady()
        {
                char data = 0;
-               if (Instance->SE->Recv(this, &data, 1, 0) > 0)
+               if (ServerInstance->SE->Recv(this, &data, 1, 0) > 0)
                {
                        Dispatch();
                        return true;
@@ -64,7 +61,7 @@ class ResultNotifier : public BufferedSocket
 class SQLiteListener : public ListenSocketBase
 {
        ModuleSQLite3* Parent;
-       insp_sockaddr sock_us;
+       irc::sockets::insp_sockaddr sock_us;
        socklen_t uslen;
        FileReader* index;
 
@@ -266,18 +263,18 @@ class SQLConn : public classbase
 {
  private:
        ResultQueue results;
-       InspIRCd* Instance;
+       InspIRCd* ServerInstance;
        Module* mod;
        SQLhost host;
        sqlite3* conn;
 
  public:
        SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi)
-       : Instance(SI), mod(m), host(hi)
+       : ServerInstance(SI), mod(m), host(hi)
        {
                if (OpenDB() != SQLITE_OK)
                {
-                       Instance->Logs->Log("m_sqlite3",DEFAULT, "WARNING: Could not open DB with id: " + host.id);
+                       ServerInstance->Logs->Log("m_sqlite3",DEFAULT, "WARNING: Could not open DB with id: " + host.id);
                        CloseDB();
                }
        }
@@ -298,7 +295,7 @@ class SQLConn : public classbase
                /* Total length of the unescaped parameters */
                unsigned long paramlen;
 
-               /* Total length of query, used for binary-safety in mysql_real_query */
+               /* Total length of query, used for binary-safety */
                unsigned long querylength = 0;
 
                paramlen = 0;
@@ -310,7 +307,7 @@ class SQLConn : public classbase
                /* To avoid a lot of allocations, allocate enough memory for the biggest the escaped query could possibly be.
                 * sizeofquery + (totalparamlength*2) + 1
                 *
-                * The +1 is for null-terminating the string for mysql_real_escape_string
+                * The +1 is for null-terminating the string
                 */
                query = new char[req.query.q.length() + (paramlen*2) + 1];
                queryend = query;
@@ -448,15 +445,15 @@ class SQLConn : public classbase
                                return;
                        }
 
-                       insp_sockaddr addr;
+                       irc::sockets::insp_sockaddr addr;
 
 #ifdef IPV6
-                       insp_aton("::1", &addr.sin6_addr);
+                       irc::sockets::insp_aton("::1", &addr.sin6_addr);
                        addr.sin6_family = AF_FAMILY;
                        addr.sin6_port = htons(listener->GetPort());
 #else
-                       insp_inaddr ia;
-                       insp_aton("127.0.0.1", &ia);
+                       irc::sockets::insp_inaddr ia;
+                       irc::sockets::insp_aton("127.0.0.1", &ia);
                        addr.sin_family = AF_FAMILY;
                        addr.sin_addr = ia;
                        addr.sin_port = htons(listener->GetPort());
@@ -522,7 +519,6 @@ class ModuleSQLite3 : public Module
                ClearAllConnections();
 
                ServerInstance->SE->DelFd(listener);
-               //listener->Close();
                ServerInstance->BufferedSocketCull();
 
                if (QueueFD >= 0)