X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_timedbans.cpp;h=30aba781c8f9a021320fac4f31a9bfb45f629424;hb=fd6ee21f2f55875984884a8413d61012e066029f;hp=5db5753bd9df84c44cc76ae522d6a19fdc78baa3;hpb=94288cdc2efb02eab9f27b3225adad839a7f2b58;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 5db5753bd..30aba781c 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -28,8 +28,8 @@ using namespace std; #include "configreader.h" #include "inspircd.h" -static Server *Srv; -extern InspIRCd* ServerInstance; + + class TimedBan : public classbase { @@ -45,7 +45,7 @@ timedbans TimedBanList; class cmd_tban : public command_t { public: - cmd_tban () : command_t("TBAN", 0, 3) + cmd_tban (InspIRCd* Instance) : command_t(Instance,"TBAN", 0, 3) { this->source = "m_timedbans.so"; syntax = " "; @@ -59,7 +59,7 @@ class cmd_tban : public command_t int cm = channel->GetStatus(user); if ((cm == STATUS_HOP) || (cm == STATUS_OP)) { - if (!Srv->IsValidMask(parameters[2])) + if (!ServerInstance->IsValidMask(parameters[2])) { user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid ban mask"); return; @@ -74,14 +74,14 @@ class cmd_tban : public command_t } TimedBan T; std::string channelname = parameters[0]; - unsigned long expire = Srv->CalcDuration(parameters[1]) + time(NULL); - if (Srv->CalcDuration(parameters[1]) < 1) + unsigned long expire = ServerInstance->CalcDuration(parameters[1]) + time(NULL); + if (ServerInstance->CalcDuration(parameters[1]) < 1) { user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid ban time"); return; } char duration[MAXBUF]; - snprintf(duration,MAXBUF,"%lu",Srv->CalcDuration(parameters[1])); + snprintf(duration,MAXBUF,"%lu",ServerInstance->CalcDuration(parameters[1])); std::string mask = parameters[2]; const char *setban[32]; setban[0] = parameters[0]; @@ -89,7 +89,7 @@ class cmd_tban : public command_t setban[2] = parameters[2]; // use CallCommandHandler to make it so that the user sets the mode // themselves - Srv->CallCommandHandler("MODE",setban,3,user); + ServerInstance->CallCommandHandler("MODE",setban,3,user); /* Check if the ban was actually added (e.g. banlist was NOT full) */ bool was_added = false; for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++) @@ -116,12 +116,12 @@ class ModuleTimedBans : public Module { cmd_tban* mycommand; public: - ModuleTimedBans(Server* Me) + ModuleTimedBans(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; - mycommand = new cmd_tban(); - Srv->AddCommand(mycommand); + + mycommand = new cmd_tban(ServerInstance); + ServerInstance->AddCommand(mycommand); TimedBanList.clear(); } @@ -177,7 +177,7 @@ class ModuleTimedBans : public Module userrec* temp = new userrec(ServerInstance); temp->fd = FD_MAGIC_NUMBER; temp->server = ""; - Srv->SendMode(setban,3,temp); + ServerInstance->SendMode(setban,3,temp); /* FIX: Send mode remotely*/ std::deque n; n.push_back(i->channel); @@ -217,7 +217,7 @@ class ModuleTimedBansFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleTimedBans(Me); }