X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_cban.cpp;h=bfb30f5e8a687c1b461f3132195f9b32121819c7;hb=e80a1296a096ff2c495b3cd2a3913d5e5f6ec450;hp=025540d9f67952916ca5df00b710bc076253f435;hpb=1c1c5fc3f01c42a09d34594989679bbc8fb21c0d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 025540d9f..bfb30f5e8 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -23,8 +23,8 @@ class CBan : public XLine public: irc::string matchtext; - CBan(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string ch) - : XLine(Instance, s_time, d, src, re, "CBAN") + CBan(time_t s_time, long d, std::string src, std::string re, std::string ch) + : XLine(s_time, d, src, re, "CBAN") { this->matchtext = ch.c_str(); } @@ -50,7 +50,6 @@ public: { ServerInstance->SNO->WriteToSnoMask('x',"Removing expired CBan %s (set by %s %ld seconds ago)", this->matchtext.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time)); - ServerInstance->PI->SendSNONotice("x", "Removing expired CBan " + assign(this->matchtext) + " (set by " + this->source + " " + ConvToStr(ServerInstance->Time() - this->set_time) + " seconds ago)"); } const char* Displayable() @@ -64,13 +63,13 @@ public: class CBanFactory : public XLineFactory { public: - CBanFactory(InspIRCd* Instance) : XLineFactory(Instance, "CBAN") { } + CBanFactory() : XLineFactory("CBAN") { } /** Generate a shun */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { - return new CBan(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + return new CBan(set_time, duration, source, reason, xline_specific_mask); } bool AutoApplyToUserList(XLine *x) @@ -84,9 +83,9 @@ class CBanFactory : public XLineFactory class CommandCBan : public Command { public: - CommandCBan(InspIRCd* Me, Module* Creator) : Command(Me, Creator, "CBAN", "o", 1, 3) + CommandCBan(Module* Creator) : Command(Creator, "CBAN", 1, 3) { - this->syntax = " [ :]"; + flags_needed = 'o'; this->syntax = " [ :]"; TRANSLATE4(TR_TEXT,TR_TEXT,TR_TEXT,TR_END); } @@ -99,8 +98,7 @@ class CommandCBan : public Command { if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "CBAN", user)) { - ServerInstance->SNO->WriteToSnoMask('x',"%s removed CBan on %s.",user->nick.c_str(),parameters[0].c_str()); - ServerInstance->PI->SendSNONotice("x", user->nick + " removed CBan on " + parameters[0]); + ServerInstance->SNO->WriteGlobalSno('x', "%s removed CBan on %s.",user->nick.c_str(),parameters[0].c_str()); } else { @@ -118,7 +116,7 @@ class CommandCBan : public Command try { - r = new CBan(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), reason, parameters[0].c_str()); + r = new CBan(ServerInstance->Time(), duration, user->nick.c_str(), reason, parameters[0].c_str()); } catch (...) { @@ -131,14 +129,12 @@ class CommandCBan : public Command { if (!duration) { - ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent CBan for %s: %s", user->nick.c_str(), parameters[0].c_str(), reason); - ServerInstance->PI->SendSNONotice("x", user->nick + " added permenant CBan for " + parameters[0] + ": " + std::string(reason)); + ServerInstance->SNO->WriteGlobalSno('x', "%s added permanent CBan for %s: %s", user->nick.c_str(), parameters[0].c_str(), reason); } else { time_t c_requires_crap = duration + ServerInstance->Time(); - ServerInstance->SNO->WriteToSnoMask('x', "%s added timed CBan for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), reason); - ServerInstance->PI->SendSNONotice("x", user->nick + " added timed CBan for " + parameters[0] + ", expires on " + ServerInstance->TimeString(c_requires_crap) + ": " + std::string(reason)); + ServerInstance->SNO->WriteGlobalSno('x', "%s added timed CBan for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), reason); } ServerInstance->XLines->ApplyLines(); @@ -166,7 +162,7 @@ class ModuleCBan : public Module CBanFactory f; public: - ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(Me, this), f(Me) + ModuleCBan() : mycommand(this) { ServerInstance->XLines->RegisterFactory(&f); @@ -209,7 +205,7 @@ class ModuleCBan : public Module virtual Version GetVersion() { - return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); + return Version("Gives /cban, aka C:lines. Think Q:lines, for channels.", VF_COMMON | VF_VENDOR, API_VERSION); } };