]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_cban.cpp
Merge pull request #1147 from SaberUK/insp20+gcc6
[user/henk/code/inspircd.git] / src / modules / m_cban.cpp
index 6c7164c7db6342ea39d337af5957facd7c167652..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();
@@ -147,6 +147,9 @@ class CommandCBan : public Command
 
        RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
        {
+               if (IS_LOCAL(user))
+                       return ROUTE_LOCALONLY; // spanningtree will send ADDLINE
+
                return ROUTE_BROADCAST;
        }
 };
@@ -158,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()