Skip to content

Commit

Permalink
Allow antiknocker to act in report mode only.
Browse files Browse the repository at this point in the history
  • Loading branch information
SadieCat committed Nov 3, 2024
1 parent f594d74 commit 4aa2dea
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions 4/m_antiknocker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

/// $ModAuthor: Sadie Powell <[email protected]>
/// $ModConfig: <antiknock nickregex="(st|sn|cr|pl|pr|fr|fl|qu|br|gr|sh|sk|tr|kl|wr|bl|[bcdfgklmnprstvwz])([aeiou][aeiou][bcdfgklmnprstvwz])(ed|est|er|le|ly|y|ies|iest|ian|ion|est|ing|led|inger|[abcdfgklmnprstvwz])" docmd="yes" donick="yes" donotice="yes" doshun="yes" shunduration="15" shunreason="User was caught in an antiknock trap">
/// $ModConfig: <antiknock nickregex="(st|sn|cr|pl|pr|fr|fl|qu|br|gr|sh|sk|tr|kl|wr|bl|[bcdfgklmnprstvwz])([aeiou][aeiou][bcdfgklmnprstvwz])(ed|est|er|le|ly|y|ies|iest|ian|ion|est|ing|led|inger|[abcdfgklmnprstvwz])" docmd="yes" dokill="yes" donick="yes" donotice="yes" doshun="yes" shunduration="15" shunreason="User was caught in an antiknock trap">
/// $ModDesc: Attempts to block a common IRC spambot.
/// $ModDepends: core 4

Expand All @@ -33,6 +33,7 @@ class ModuleAntiKnocker final
{
public:
bool docmd;
bool dokill;
bool donick;
bool donotice;
bool doshun;
Expand All @@ -56,12 +57,15 @@ class ModuleAntiKnocker final
delete sh;
}

std::string message;
if (!user->IsFullyConnected())
message = "Connection timeout";
else
message = INSP_FORMAT("Ping timeout: {} seconds", user->GetClass()->pingtime);
ServerInstance->Users.QuitUser(user, message);
if (dokill)
{
std::string message;
if (!user->IsFullyConnected())
message = "Connection timeout";
else
message = INSP_FORMAT("Ping timeout: {} seconds", user->GetClass()->pingtime);
ServerInstance->Users.QuitUser(user, message);
}
}

ModuleAntiKnocker()
Expand All @@ -87,6 +91,7 @@ class ModuleAntiKnocker final
}

docmd = tag->getBool("docmd", true);
dokill = tag->getBool("dokill", true);
donick = tag->getBool("donick", true);
donotice = tag->getBool("donotice", true);
doshun = tag->getBool("doshun", true);
Expand Down

0 comments on commit 4aa2dea

Please sign in to comment.