]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_hostchange.cpp
Theres no need to check the address of a stack declared array for NULL, thanks darix
[user/henk/code/inspircd.git] / src / modules / m_hostchange.cpp
index b2db6d00427f05d83d27db087bd32e2cec92406c..17c597e7153dcd52b46350a87b49a659c4960dca 100644 (file)
@@ -12,9 +12,7 @@
  */
 
 #include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
+#include "wildcard.h"
 
 /* $ModDesc: Provides masking of user hostnames in a different way to m_cloaking */
 
@@ -56,7 +54,7 @@ class ModuleHostChange : public Module
 
        Priority Prioritize()
        {
-               return (Priority)ServerInstance->PriorityAfter("m_cloaking.so");
+               return (Priority)ServerInstance->Modules->PriorityAfter("m_cloaking.so");
        }
 
        void Implements(char* List)
@@ -64,7 +62,7 @@ class ModuleHostChange : public Module
                List[I_OnRehash] = List[I_OnUserConnect] = 1;
        }
 
-       virtual void OnRehash(userrec* user, const std::string &parameter)
+       virtual void OnRehash(User* user, const std::string &parameter)
        {
                ConfigReader Conf(ServerInstance);
                MySuffix = Conf.ReadValue("host","suffix",0);
@@ -96,17 +94,17 @@ class ModuleHostChange : public Module
                return Version(1,1,0,1,VF_VENDOR,API_VERSION);
        }
        
-       virtual void OnUserConnect(userrec* user)
+       virtual void OnUserConnect(User* user)
        {
                for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++)
                {
-                       if (ServerInstance->MatchText(std::string(user->ident)+"@"+std::string(user->host),i->first))
+                       if (((match(user->MakeHost(),i->first.c_str(),true)) || (match(user->MakeHostIP(),i->first.c_str()))))
                        {
-                               Host* h = (Host*)i->second;
+                               Host* h = i->second;
 
-                               if (!i->second->ports.empty())
+                               if (!h->ports.empty())
                                {
-                                       irc::portparser portrange(i->second->ports, false);
+                                       irc::portparser portrange(h->ports, false);
                                        long portno = -1;
                                        bool foundany = false;