-
- /* Read the config file first */
- Conf = NULL;
- OnRehash(NULL,"");
-
- /* 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);
- }
- }
- else
- {
- throw ModuleException("I can't find any modules loaded which implement the HashRequest interface! You probably forgot to load a hashing module such as m_md5.so or m_sha256.so.");
- }
-
- ServerInstance->Modules->UseInterface("HashRequest");
-
- mycommand = new CommandMkpasswd(ServerInstance, this, hashers, names);
- ServerInstance->AddCommand(mycommand);
- Implementation eventlist[] = { I_OnRehash, I_OnPassCompare };
- ServerInstance->Modules->Attach(eventlist, this, 2);
- }
-
- virtual ~ModuleOperHash()
- {
- ServerInstance->Modules->DoneWithInterface("HashRequest");