X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_cban.cpp;h=fb78e41b29cb45f9dede6dc908c219e94060c203;hb=ccd4c11ea1a43d079eaae9708482ef4a9148796c;hp=92f97158ecf123758a39f992d41293d2eed2ccc0;hpb=485f3332b97c3a266ac5bdef0c5a4be7cdd1d79b;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 92f97158e..fb78e41b2 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -32,7 +32,7 @@ class CBan : public XLine public: irc::string matchtext; - CBan(time_t s_time, long d, std::string src, std::string re, std::string ch) + CBan(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& ch) : XLine(s_time, d, src, re, "CBAN") { this->matchtext = ch.c_str(); @@ -131,7 +131,8 @@ class CommandCBan : public Command else { time_t c_requires_crap = duration + ServerInstance->Time(); - 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); + std::string timestr = ServerInstance->TimeString(c_requires_crap); + ServerInstance->SNO->WriteGlobalSno('x', "%s added timed CBan for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), timestr.c_str(), reason); } } else @@ -146,7 +147,10 @@ class CommandCBan : public Command RouteDescriptor GetRouting(User* user, const std::vector& parameters) { - return ROUTE_LOCALONLY; + if (IS_LOCAL(user)) + return ROUTE_LOCALONLY; // spanningtree will send ADDLINE + + return ROUTE_BROADCAST; } }; @@ -157,12 +161,16 @@ class ModuleCBan : public Module public: ModuleCBan() : mycommand(this) + { + } + + void init() { ServerInstance->XLines->RegisterFactory(&f); - ServerInstance->AddCommand(&mycommand); + ServerInstance->Modules->AddService(mycommand); Implementation eventlist[] = { I_OnUserPreJoin, I_OnStats }; - ServerInstance->Modules->Attach(eventlist, this, 2); + ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } virtual ~ModuleCBan()