]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_cban.cpp
Merge pull request #1162 from SaberUK/insp20+fix-deinstall
[user/henk/code/inspircd.git] / src / modules / m_cban.cpp
index 92f97158ecf123758a39f992d41293d2eed2ccc0..fb78e41b29cb45f9dede6dc908c219e94060c203 100644 (file)
@@ -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<std::string>& 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()