+ if(strcmp(SQLRESID, request->GetId()) == 0)
+ {
+ SQLresult* res = static_cast<SQLresult*>(request);
+
+ User* user = GetAssocUser(this, SQLutils, res->id).S().user;
+ UnAssociate(this, SQLutils, res->id).S();
+
+ if(user)
+ {
+ if(res->error.Id() == NO_ERROR)
+ {
+ if(res->Rows())
+ {
+ /* We got a row in the result, this is enough really */
+ user->Extend("sqlauthed");
+ }
+ else if (verbose)
+ {
+ /* No rows in result, this means there was no record matching the user */
+ ServerInstance->WriteOpers("Forbidden connection from %s!%s@%s (SQL query returned no matches)", user->nick, user->ident, user->host);
+ user->Extend("sqlauth_failed");
+ }
+ }
+ else if (verbose)
+ {
+ ServerInstance->WriteOpers("Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick, user->ident, user->host, res->error.Str());
+ user->Extend("sqlauth_failed");
+ }
+ }
+ else
+ {
+ return NULL;
+ }
+
+ if (!user->GetExt("sqlauthed"))
+ {
+ User::QuitUser(ServerInstance,user,killreason);
+ }
+ return SQLSUCCESS;
+ }
+ return NULL;