+ Module* SQLutils;
+ std::string databaseid;
+ irc::string hashtype;
+ hashymodules hashers;
+ bool diduseiface;
+ parameterlist names;
+
+public:
+ ModuleSQLOper()
+ {
+ ServerInstance->Modules->UseInterface("SQLutils");
+ ServerInstance->Modules->UseInterface("SQL");
+ ServerInstance->Modules->UseInterface("HashRequest");
+
+ OnRehash(NULL);
+
+ diduseiface = false;
+
+ /* Find all modules which implement the interface 'HashRequest' */
+ modulelist* ml = ServerInstance->Modules->FindInterface("HashRequest");
+
+ /* Did we find any modules? */
+ if (ml)
+ {
+ /* Yes, enumerate them all to find out the hashing algorithm name */
+ for (modulelist::iterator m = ml->begin(); m != ml->end(); m++)
+ {
+ /* Make a request to it for its name, its implementing
+ * HashRequest so we know its safe to do this
+ */
+ std::string name = HashNameRequest(this, *m).Send();
+ /* Build a map of them */
+ hashers[name.c_str()] = *m;
+ names.push_back(name);
+ }
+ /* UseInterface doesn't do anything if there are no providers, so we'll have to call it later if a module gets loaded later on. */
+ diduseiface = true;
+ ServerInstance->Modules->UseInterface("HashRequest");
+ }
+
+ SQLutils = ServerInstance->Modules->Find("m_sqlutils.so");
+ if (!SQLutils)
+ throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqloper.so.");