+class CommandSASL : public Command
+{
+ Module* Creator;
+ public:
+ CommandSASL(InspIRCd* Instance, Module* creator) : Command(Instance, "SASL", 0, 2), Creator(creator)
+ {
+ this->source = "m_sasl.so";
+ this->disabled = true; // should not be called by users
+ }
+
+ CmdResult Handle(const std::vector<std::string>& parameters, User *user)
+ {
+ User* target = ServerInstance->FindNick(parameters[1]);
+ if (!target)
+ {
+ ServerInstance->Logs->Log("m_sasl", DEBUG,"User not found in sasl ENCAP event: %s", parameters[1].c_str());
+ return CMD_FAILURE;
+ }
+
+ SaslAuthenticator *sasl;
+ if (!target->GetExt("sasl_authenticator", sasl))
+ return CMD_FAILURE;
+
+ SaslState state = sasl->ProcessInboundMessage(parameters);
+ if (state == SASL_DONE)
+ {
+ delete sasl;
+ target->Shrink("sasl");
+ }
+ return CMD_SUCCESS;
+ }
+};