* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2010 InspIRCd Development Team
* See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
SimpleExtItem<SaslAuthenticator>& authExt;
CommandSASL(Module* Creator, SimpleExtItem<SaslAuthenticator>& ext) : Command(Creator, "SASL", 2), authExt(ext)
{
- this->disabled = true; // should not be called by users
+ this->flags_needed = FLAG_SERVERONLY; // should not be called by users
}
CmdResult Handle(const std::vector<std::string>& parameters, User *user)
ModuleSASL()
: authExt("sasl_auth", this), cap(this, "sasl"), auth(this, authExt, cap), sasl(this, authExt)
{
- Implementation eventlist[] = { I_OnEvent, I_OnUserRegister };
- ServerInstance->Modules->Attach(eventlist, this, 2);
+ Implementation eventlist[] = { I_OnEvent, I_OnUserRegister, I_OnSetConnectClass };
+ ServerInstance->Modules->Attach(eventlist, this, 3);
ServiceProvider* providelist[] = { &auth, &sasl, &authExt };
ServerInstance->Modules->AddServices(providelist, 3);
return MOD_RES_PASSTHRU;
}
+ ModResult OnSetConnectClass(LocalUser* user, ConnectClass* myclass)
+ {
+ if (myclass->config->getBool("requiresasl"))
+ {
+ const AccountExtItem* ext = GetAccountExtItem();
+ if (ext && !ext->get(user))
+ return MOD_RES_DENY;
+ }
+ return MOD_RES_PASSTHRU;
+ }
+
~ModuleSASL()
{
}