* ---------------------------------------------------
*/
-#include <string>
-#include <deque>
-#include <map>
+#include "inspircd.h"
#include <sqlite3.h>
-
#include "users.h"
#include "channels.h"
#include "modules.h"
-#include "inspircd.h"
-#include "configreader.h"
#include "m_sqlv2.h"
/* $ModDesc: sqlite3 provider */
-/* $CompileFlags: pkgconfversion("sqlite3","3.4") pkgconfincludes("sqlite3","/sqlite3.h","") */
+/* $CompileFlags: pkgconfversion("sqlite3","3.3") pkgconfincludes("sqlite3","/sqlite3.h","") */
/* $LinkerFlags: pkgconflibs("sqlite3","/libsqlite3.so","-lsqlite3") */
/* $ModDep: m_sqlv2.h */
ResultNotifier* resultnotify = NULL;
-class ResultNotifier : public InspSocket
+class ResultNotifier : public BufferedSocket
{
Module* mod;
insp_sockaddr sock_us;
public:
/* Create a socket on a random port. Let the tcp stack allocate us an available port */
#ifdef IPV6
- ResultNotifier(InspIRCd* SI, Module* m) : InspSocket(SI, "::1", 0, true, 3000), mod(m)
+ ResultNotifier(InspIRCd* SI, Module* m) : BufferedSocket(SI, "::1", 0, true, 3000), mod(m)
#else
- ResultNotifier(InspIRCd* SI, Module* m) : InspSocket(SI, "127.0.0.1", 0, true, 3000), mod(m)
+ ResultNotifier(InspIRCd* SI, Module* m) : BufferedSocket(SI, "127.0.0.1", 0, true, 3000), mod(m)
#endif
{
uslen = sizeof(sock_us);
}
}
- ResultNotifier(InspIRCd* SI, Module* m, int newfd, char* ip) : InspSocket(SI, newfd, ip), mod(m)
+ ResultNotifier(InspIRCd* SI, Module* m, int newfd, char* ip) : BufferedSocket(SI, newfd, ip), mod(m)
{
}
{
paramlist* p = (paramlist*)params;
((SQLConn*)(*p)[0])->AffectedReady(((SQLite3Result*)(*p)[1]));
- }\r
+ }
void ResultReady(SQLite3Result *res, int cols, char **data, char **colnames)
{
ModuleSQLite3(InspIRCd* Me)
: Module::Module(Me), currid(0)
{
- ServerInstance->UseInterface("SQLutils");
+ ServerInstance->Modules->UseInterface("SQLutils");
- if (!ServerInstance->PublishFeature("SQL", this))
+ if (!ServerInstance->Modules->PublishFeature("SQL", this))
{
throw ModuleException("m_sqlite3: Unable to publish feature 'SQL'");
}
ReadConf();
- ServerInstance->PublishInterface("SQL", this);
+ ServerInstance->Modules->PublishInterface("SQL", this);
}
virtual ~ModuleSQLite3()
resultnotify->OnError(I_ERR_SOCKET);
resultnotify->ClosePending = true;
delete resultnotify;
- ServerInstance->UnpublishInterface("SQL", this);
- ServerInstance->UnpublishFeature("SQL");
- ServerInstance->DoneWithInterface("SQLutils");
+ ServerInstance->Modules->UnpublishInterface("SQL", this);
+ ServerInstance->Modules->UnpublishFeature("SQL");
+ ServerInstance->Modules->DoneWithInterface("SQLutils");
}
void Implements(char* List)
}
}
- virtual void OnRehash(userrec* user, const std::string ¶meter)
+ virtual void OnRehash(User* user, const std::string ¶meter)
{
ReadConf();
}
((ModuleSQLite3*)mod)->SendQueue();
}
-class ModuleSQLite3Factory : public ModuleFactory
-{
- public:
- ModuleSQLite3Factory()
- {
- }
+MODULE_INIT(ModuleSQLite3)
- ~ModuleSQLite3Factory()
- {
- }
-
- virtual Module * CreateModule(InspIRCd* Me)
- {
- return new ModuleSQLite3(Me);
- }
-};
-
-extern "C" void * init_module( void )
-{
- return new ModuleSQLite3Factory;
-}