]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_shun.cpp
m_cloaking: don't apply cloak to already cloaked users during registration
[user/henk/code/inspircd.git] / src / modules / m_shun.cpp
index 096d2f9eee97799e15ead02d952a043c68573ba8..8bf4d30e7bf341d4d6ce773bc7c1734455bb586e 100644 (file)
@@ -30,10 +30,10 @@ class Shun : public XLine
 public:
        std::string matchtext;
 
-       Shun(time_t s_time, long d, std::string src, std::string re, std::string shunmask)
+       Shun(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& shunmask)
                : XLine(s_time, d, src, re, "SHUN")
+               , matchtext(shunmask)
        {
-               this->matchtext = shunmask;
        }
 
        ~Shun()
@@ -108,8 +108,8 @@ class CommandShun : public Command
 
                std::string target = parameters[0];
                
-               User *find = ServerInstance->FindNick(target.c_str());
-               if (find)
+               User *find = ServerInstance->FindNick(target);
+               if ((find) && (find->registered == REG_ALL))
                        target = std::string("*!*@") + find->GetIPString();
 
                if (parameters.size() == 1)
@@ -168,6 +168,9 @@ class CommandShun : 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;
        }
 };
@@ -182,12 +185,16 @@ class ModuleShun : public Module
 
  public:
        ModuleShun() : cmd(this)
+       {
+       }
+
+       void init()
        {
                ServerInstance->XLines->RegisterFactory(&f);
-               ServerInstance->AddCommand(&cmd);
+               ServerInstance->Modules->AddService(cmd);
 
                Implementation eventlist[] = { I_OnStats, I_OnPreCommand, I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, this, 3);
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
                OnRehash(NULL);
        }