- User* dest = dynamic_cast<User*>(target);
- // check if its our metadata key, and its associated with a user
- if (dest && (extname == "accountname"))
- {
- std::string *account = accountname.get(dest);
- if (account && !account->empty())
- {
- trim(*account);
-
- if (IS_LOCAL(dest))
- dest->WriteNumeric(900, "%s %s %s :You are now logged in as %s",
- dest->nick.c_str(), dest->GetFullHost().c_str(), account->c_str(), account->c_str());
-
- AccountData ac;
- ac.user = dest;
- ac.account = *account;
- Event n((char*)&ac, this, "account_login");
- n.Send(ServerInstance);
- }
- }
- }
-
- ~ModuleServicesAccount()
- {
- ServerInstance->Modes->DelMode(&m1);
- ServerInstance->Modes->DelMode(&m2);
- ServerInstance->Modes->DelMode(&m3);
- ServerInstance->Modes->DelMode(&m4);
- ServerInstance->Modes->DelMode(&m5);
+ if (myclass->config->getBool("requireaccount") && !accountname.get(user))
+ return MOD_RES_DENY;
+ return MOD_RES_PASSTHRU;