]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Change module API to use LocalUser* where correct
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 21 Oct 2009 23:45:19 +0000 (23:45 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 21 Oct 2009 23:45:19 +0000 (23:45 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11943 e03df62e-2008-0410-955e-edbf42e46eb7

35 files changed:
include/inspircd.h
include/modules.h
src/commands/cmd_nick.cpp
src/commands/cmd_user.cpp
src/inspircd.cpp
src/modules.cpp
src/modules/extra/m_geoip.cpp
src/modules/extra/m_ldapauth.cpp
src/modules/extra/m_ssl_gnutls.cpp
src/modules/m_antibear.cpp
src/modules/m_cap.cpp
src/modules/m_cgiirc.cpp
src/modules/m_cloaking.cpp
src/modules/m_conn_join.cpp
src/modules/m_conn_umodes.cpp
src/modules/m_conn_waitpong.cpp
src/modules/m_connectban.cpp
src/modules/m_connflood.cpp
src/modules/m_dnsbl.cpp
src/modules/m_hostchange.cpp
src/modules/m_ident.cpp
src/modules/m_invisible.cpp
src/modules/m_jumpserver.cpp
src/modules/m_lockserv.cpp
src/modules/m_randquote.cpp
src/modules/m_rline.cpp
src/modules/m_sasl.cpp
src/modules/m_shun.cpp
src/modules/m_spanningtree/main.cpp
src/modules/m_spanningtree/main.h
src/modules/m_sqlauth.cpp
src/modules/m_sqllog.cpp
src/modules/m_sqlutils.cpp
src/usermanager.cpp
src/users.cpp

index caebe2eeb91c6f98fd8212e1788200e3aac483db..e79a56f53387e6f3e873292381c3f46e543da2aa 100644 (file)
@@ -313,7 +313,7 @@ class CoreExport InspIRCd
         * @param user The user to verify
         * @return True if all modules have finished checking this user
         */
-       bool AllModulesReportReady(User* user);
+       bool AllModulesReportReady(LocalUser* user);
 
        /** Logfile pathname specified on the commandline, or empty string
         */
index ae29b21766d8d7d3cec62c3465d51ef065e30467..a066d104a3c8555bdba5cae5e0384a17dbed5968 100644 (file)
@@ -106,7 +106,7 @@ struct ModResult {
 /** If you change the module API in any way, increment this value.
  * This MUST be a pure integer, with no parenthesis
  */
-#define API_VERSION 136
+#define API_VERSION 137
 
 class ServerConfig;
 
@@ -308,7 +308,7 @@ enum Implementation
        I_OnUserPostNick, I_OnPreMode, I_On005Numeric, I_OnKill, I_OnRemoteKill, I_OnLoadModule,
        I_OnUnloadModule, I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnCheckInvite,
        I_OnRawMode, I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnCheckChannelBan, I_OnExtBanCheck,
-       I_OnStats, I_OnChangeLocalUserHost, I_OnChangeLocalUserGecos, I_OnPreTopicChange,
+       I_OnStats, I_OnChangeLocalUserHost, I_OnPreTopicChange,
        I_OnPostTopicChange, I_OnEvent, I_OnGlobalOper, I_OnPostConnect, I_OnAddBan,
        I_OnDelBan, I_OnChangeLocalUserGECOS, I_OnUserRegister, I_OnChannelPreDelete, I_OnChannelDelete,
        I_OnPostOper, I_OnSyncNetwork, I_OnSetAway, I_OnUserList, I_OnPostCommand, I_OnPostJoin,
@@ -368,7 +368,7 @@ class CoreExport Module : public classbase
         * The details of the connecting user are available to you in the parameter User *user
         * @param user The user who is connecting
         */
-       virtual void OnUserConnect(User* user);
+       virtual void OnUserConnect(LocalUser* user);
 
        /** Called when a user quits.
         * The details of the exiting user are available to you in the parameter User *user
@@ -386,7 +386,7 @@ class CoreExport Module : public classbase
         * which might assign resources to user, such as dns lookups, objects and sockets.
         * @param user The user who is disconnecting
         */
-       virtual void OnUserDisconnect(User* user);
+       virtual void OnUserDisconnect(LocalUser* user);
 
        /** Called whenever a channel is about to be deleted
         * @param chan The channel being deleted
@@ -959,7 +959,7 @@ class CoreExport Module : public classbase
         * @param user The user to check
         * @return true to indicate readiness, false if otherwise
         */
-       virtual ModResult OnCheckReady(User* user);
+       virtual ModResult OnCheckReady(LocalUser* user);
 
        /** Called whenever a user is about to register their connection (e.g. before the user
         * is sent the MOTD etc). Modules can use this method if they are performing a function
@@ -970,7 +970,7 @@ class CoreExport Module : public classbase
         * @param user The user registering
         * @return 1 to indicate user quit, 0 to continue
         */
-       virtual ModResult OnUserRegister(User* user);
+       virtual ModResult OnUserRegister(LocalUser* user);
 
        /** Called whenever a user joins a channel, to determine if invite checks should go ahead or not.
         * This method will always be called for each join, wether or not the channel is actually +i, and
@@ -1059,7 +1059,7 @@ class CoreExport Module : public classbase
         * @param newhost The new hostname
         * @return 1 to deny the host change, 0 to allow
         */
-       virtual ModResult OnChangeLocalUserHost(User* user, const std::string &newhost);
+       virtual ModResult OnChangeLocalUserHost(LocalUser* user, const std::string &newhost);
 
        /** Called whenever a change of a local users GECOS (fullname field) is attempted.
         * return 1 to deny the name change, or 0 to allow it.
@@ -1067,7 +1067,7 @@ class CoreExport Module : public classbase
         * @param newhost The new GECOS
         * @return 1 to deny the GECOS change, 0 to allow
         */
-       virtual ModResult OnChangeLocalUserGECOS(User* user, const std::string &newhost);
+       virtual ModResult OnChangeLocalUserGECOS(LocalUser* user, const std::string &newhost);
 
        /** Called before a topic is changed.
         * Return 1 to deny the topic change, 0 to check details on the change, -1 to let it through with no checks
index a6e1e88c77b7f207173c542cede68c91025217d4..ee8c4625cfff2b804a17d726b081d348370f5d26 100644 (file)
@@ -191,7 +191,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
                if (user->registered == REG_NICKUSER)
                {
                        /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
-                       FIRST_MOD_RESULT(OnUserRegister, MOD_RESULT, (user));
+                       FIRST_MOD_RESULT(OnUserRegister, MOD_RESULT, (IS_LOCAL(user)));
                        if (MOD_RESULT == MOD_RES_DENY)
                                return CMD_FAILURE;
 
index e396e0c84e69b4d2f7eb14ce98c963fa81ff657c..8410a28532d2fd98ed6a5feb20fa4819c4c223ea 100644 (file)
  * the same way, however, they can be fully unloaded, where these
  * may not.
  */
-class CommandUser : public Command
+class CommandUser : public SplitCommand
 {
  public:
        /** Constructor for user.
         */
-       CommandUser ( Module* parent) : Command(parent,"USER",4,4) { works_before_reg = true; Penalty = 0; syntax = "<username> <localhost> <remotehost> <GECOS>"; }
+       CommandUser ( Module* parent) : SplitCommand(parent,"USER",4,4) { works_before_reg = true; Penalty = 0; syntax = "<username> <localhost> <remotehost> <GECOS>"; }
        /** Handle command.
         * @param parameters The parameters to the comamnd
         * @param pcnt The number of parameters passed to teh command
         * @param user The user issuing the command
         * @return A value from CmdResult to indicate command success or failure.
         */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+       CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser *user);
 };
 
-CmdResult CommandUser::Handle (const std::vector<std::string>& parameters, User *user)
+CmdResult CommandUser::HandleLocal(const std::vector<std::string>& parameters, LocalUser *user)
 {
        /* A user may only send the USER command once */
        if (!(user->registered & REG_USER))
index ca6a59cacb3137edd4c2a466595f3c2884ffe39c..4404e2323beda8ebc5d0f8aa30666f334b7b5412 100644 (file)
@@ -794,7 +794,7 @@ int InspIRCd::Run()
  * (until this returns true, a user will block in the waiting state, waiting to connect up to the
  * registration timeout maximum seconds)
  */
-bool InspIRCd::AllModulesReportReady(User* user)
+bool InspIRCd::AllModulesReportReady(LocalUser* user)
 {
        ModResult res;
        FIRST_MOD_RESULT(OnCheckReady, res, (user));
index a0eb9e19ea643bf797b333df9c31b5a5d4332476..a4b9e05fa7a13d04fbe41ca47bbcc16c536f79af 100644 (file)
@@ -63,9 +63,9 @@ Module::~Module()
 }
 
 ModResult      Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { return MOD_RES_PASSTHRU; }
-void           Module::OnUserConnect(User*) { }
+void           Module::OnUserConnect(LocalUser*) { }
 void           Module::OnUserQuit(User*, const std::string&, const std::string&) { }
-void           Module::OnUserDisconnect(User*) { }
+void           Module::OnUserDisconnect(LocalUser*) { }
 void           Module::OnUserJoin(Membership*, bool, bool, CUList&) { }
 void           Module::OnPostJoin(Membership*) { }
 void           Module::OnUserPart(Membership*, std::string&, CUList&) { }
@@ -91,8 +91,8 @@ void          Module::OnUnloadModule(Module*) { }
 void           Module::OnBackgroundTimer(time_t) { }
 ModResult      Module::OnPreCommand(std::string&, std::vector<std::string>&, User *, bool, const std::string&) { return MOD_RES_PASSTHRU; }
 void           Module::OnPostCommand(const std::string&, const std::vector<std::string>&, User *, CmdResult, const std::string&) { }
-ModResult      Module::OnCheckReady(User*) { return MOD_RES_PASSTHRU; }
-ModResult      Module::OnUserRegister(User*) { return MOD_RES_PASSTHRU; }
+ModResult      Module::OnCheckReady(LocalUser*) { return MOD_RES_PASSTHRU; }
+ModResult      Module::OnUserRegister(LocalUser*) { return MOD_RES_PASSTHRU; }
 ModResult      Module::OnUserPreKick(User*, Membership*, const std::string&) { return MOD_RES_PASSTHRU; }
 void           Module::OnUserKick(User*, Membership*, const std::string&, CUList&) { }
 ModResult      Module::OnRawMode(User*, Channel*, const char, const std::string &, bool, int) { return MOD_RES_PASSTHRU; }
@@ -103,8 +103,8 @@ ModResult   Module::OnCheckChannelBan(User*, Channel*) { return MOD_RES_PASSTHRU;
 ModResult      Module::OnCheckBan(User*, Channel*, const std::string&) { return MOD_RES_PASSTHRU; }
 ModResult      Module::OnExtBanCheck(User*, Channel*, char) { return MOD_RES_PASSTHRU; }
 ModResult      Module::OnStats(char, User*, string_list&) { return MOD_RES_PASSTHRU; }
-ModResult      Module::OnChangeLocalUserHost(User*, const std::string&) { return MOD_RES_PASSTHRU; }
-ModResult      Module::OnChangeLocalUserGECOS(User*, const std::string&) { return MOD_RES_PASSTHRU; }
+ModResult      Module::OnChangeLocalUserHost(LocalUser*, const std::string&) { return MOD_RES_PASSTHRU; }
+ModResult      Module::OnChangeLocalUserGECOS(LocalUser*, const std::string&) { return MOD_RES_PASSTHRU; }
 ModResult      Module::OnPreTopicChange(User*, Channel*, const std::string&) { return MOD_RES_PASSTHRU; }
 void           Module::OnEvent(Event&) { }
 void           Module::OnRequest(Request&) { }
index ff6e3c7c2be3cddd0b0d1b0879cc97e92a997df3..d2d8f93f8b64546f4f2f77e2e2d2f8fec62f599c 100644 (file)
@@ -62,23 +62,19 @@ class ModuleGeoIP : public Module
                }
        }
 
-       virtual ModResult OnUserRegister(User* user)
+       virtual ModResult OnUserRegister(LocalUser* user)
        {
-               /* only do lookups on local users */
-               if (IS_LOCAL(user))
+               const char* c = GeoIP_country_code_by_addr(gi, user->GetIPString());
+               if (c)
                {
-                       const char* c = GeoIP_country_code_by_addr(gi, user->GetIPString());
-                       if (c)
-                       {
-                               std::map<std::string, std::string>::iterator x = GeoBans.find(c);
-                               if (x != GeoBans.end())
-                                       ServerInstance->Users->QuitUser(user,  x->second);
-                       }
-                       else
-                       {
-                               if (banunknown)
-                                       ServerInstance->Users->QuitUser(user, "Could not identify your country of origin. Access denied.");
-                       }
+                       std::map<std::string, std::string>::iterator x = GeoBans.find(c);
+                       if (x != GeoBans.end())
+                               ServerInstance->Users->QuitUser(user,  x->second);
+               }
+               else
+               {
+                       if (banunknown)
+                               ServerInstance->Users->QuitUser(user, "Could not identify your country of origin. Access denied.");
                }
                return MOD_RES_PASSTHRU;
        }
index 50c95270482b06c2ef3d350d2985d5cc30ad8e69..26e9683673a5686f590908702b3178cec4c0e463 100644 (file)
@@ -111,7 +111,7 @@ public:
                return true;
        }
 
-       ModResult OnUserRegister(User* user)
+       ModResult OnUserRegister(LocalUser* user)
        {
                if ((!allowpattern.empty()) && (InspIRCd::Match(user->nick,allowpattern)))
                {
@@ -208,7 +208,7 @@ public:
                }
        }
 
-       ModResult OnCheckReady(User* user)
+       ModResult OnCheckReady(LocalUser* user)
        {
                return ldapAuthed.get(user) ? MOD_RES_PASSTHRU : MOD_RES_DENY;
        }
index 0267b65953c34fcf41c30bf5ef3d2849f75728c3..29e439ed3fd7a2a3d9c342bb3e5a9fa1832315b1 100644 (file)
@@ -551,7 +551,7 @@ class ModuleSSLGnuTLS : public Module
        {
                // This occurs AFTER OnUserConnect so we can be sure the
                // protocol module has propagated the NICK message.
-               if (user->GetIOHook() == this && (IS_LOCAL(user)))
+               if (user->GetIOHook() == this)
                {
                        if (sessions[user->GetFd()].sess)
                        {
index f4f725ab279a80cf1289a0990ec7fbea06cfdabf..abc4608ff697c41aa9c5cc86eecf496ebcc05925 100644 (file)
@@ -62,7 +62,7 @@ class ModuleAntiBear : public Module
                return MOD_RES_PASSTHRU;
        }
 
-       virtual ModResult OnUserRegister(User* user)
+       virtual ModResult OnUserRegister(LocalUser* user)
        {
                user->WriteNumeric(439, "%s :This server has anti-spambot mechanisms enabled.", user->nick.c_str());
                user->WriteNumeric(931, "%s :Malicious bots, spammers, and other automated systems of dubious origin are NOT welcome here.", user->nick.c_str());
index 2c7e58e6aa0e61840b0f37c5de23daebc57ee24b..5c820043c704ab4abac6e0aa2770e8bd0eaed1bd 100644 (file)
@@ -142,7 +142,7 @@ class ModuleCAP : public Module
                ServerInstance->Modules->Attach(eventlist, this, 1);
        }
 
-       ModResult OnCheckReady(User* user)
+       ModResult OnCheckReady(LocalUser* user)
        {
                /* Users in CAP state get held until CAP END */
                if (cmd.reghold.get(user))
index 53c761b3eaace24faa0f8cc7600c5163dd87c336..745dc13d2225b8878cc8ef4c04d99889f99840d3 100644 (file)
@@ -214,7 +214,7 @@ public:
                }
        }
 
-       virtual ModResult OnUserRegister(User* user)
+       virtual ModResult OnUserRegister(LocalUser* user)
        {
                for(CGIHostlist::iterator iter = cmd.Hosts.begin(); iter != cmd.Hosts.end(); iter++)
                {
@@ -253,7 +253,7 @@ public:
                return MOD_RES_PASSTHRU;
        }
 
-       virtual void OnUserConnect(User* user)
+       virtual void OnUserConnect(LocalUser* user)
        {
                std::string *webirc_hostname = cmd.webirc_hostname.get(user);
                std::string *webirc_ip = cmd.webirc_ip.get(user);
index c61868dc35bdfad8f267da7fd539b4f01b94309d..0ad790de933a645996d302d1cda65d7c49e8ed9d 100644 (file)
@@ -74,10 +74,10 @@ class CloakUser : public ModeHandler
 
                                std::string* cloak = ext.get(dest);
 
-                               if (!cloak)
+                               if (!cloak && IS_LOCAL(dest))
                                {
                                        /* Force creation of missing cloak */
-                                       creator->OnUserConnect(dest);
+                                       creator->OnUserConnect(IS_LOCAL(dest));
                                        cloak = ext.get(dest);
                                }
                                if (cloak)
@@ -424,7 +424,7 @@ class ModuleCloaking : public Module
                }
        }
 
-       void OnUserConnect(User* dest)
+       void OnUserConnect(LocalUser* dest)
        {
                std::string* cloak = cu.ext.get(dest);
                if (cloak)
index ef834e55ac7e36bab1feeac71c0f126bb255b191..df575f1b3c48db57e5bd7c21e244b41a3df595af 100644 (file)
@@ -73,11 +73,10 @@ class ModuleConnJoin : public Module
                        return Version("Forces users to join the specified channel(s) on connect", VF_VENDOR);
                }
 
-               virtual void OnPostConnect(User* user)
+               void OnPostConnect(User* user)
                {
                        if (!IS_LOCAL(user))
                                return;
-
                        for(std::vector<std::string>::iterator it = Joinchans.begin(); it != Joinchans.end(); it++)
                                if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax))
                                        Channel::JoinUser(user, it->c_str(), false, "", false, ServerInstance->Time());
index 714114f04f66506bc444b391a8f691eeb1d583be..22a4ee0aaec2f10747ec1fe65bf08e9b13b0f34e 100644 (file)
@@ -35,11 +35,8 @@ class ModuleModesOnConnect : public Module
                return Version("Sets (and unsets) modes on users when they connect", VF_VENDOR);
        }
 
-       virtual void OnUserConnect(User* user)
+       virtual void OnUserConnect(LocalUser* user)
        {
-               if (!IS_LOCAL(user))
-                       return;
-
                // Backup and zero out the disabled usermodes, so that we can override them here.
                char save[64];
                memcpy(save, ServerInstance->Config->DisabledUModes,
index 46f4a69eb7605256ceb240330f1b19a158111adf..362835c6db0c8cba1845ca28a07dce220b682c8c 100644 (file)
@@ -55,7 +55,7 @@ class ModuleWaitPong : public Module
                return out;
        }
 
-       ModResult OnUserRegister(User* user)
+       ModResult OnUserRegister(LocalUser* user)
        {
                std::string pingrpl = RandString();
 
@@ -92,7 +92,7 @@ class ModuleWaitPong : public Module
                return MOD_RES_PASSTHRU;
        }
 
-       ModResult OnCheckReady(User* user)
+       ModResult OnCheckReady(LocalUser* user)
        {
                return ext.get(user) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
        }
index f956cb7db92470661cf37f3c28477cc8b03147e7..9506bc2fecb16df06ce2fff86a10cd999e82bf8a 100644 (file)
@@ -66,7 +66,7 @@ class ModuleConnectBan : public Module
                banduration = ServerInstance->Duration(duration);
        }
 
-       virtual void OnUserConnect(User *u)
+       virtual void OnUserConnect(LocalUser *u)
        {
                int range = 32;
                clonemap::iterator i;
index b2aaab45abb1cd52c9bcb96b9fd7c8cb2a6dfdc9..d2738fe181431e670b0ac8e814b7838590c261c6 100644 (file)
@@ -57,7 +57,7 @@ public:
                first = ServerInstance->Time();
        }
 
-       virtual ModResult OnUserRegister(User* user)
+       virtual ModResult OnUserRegister(LocalUser* user)
        {
                time_t next = ServerInstance->Time();
 
index d97ea940a8aecf05e5f55e8218ef434ec31a8c7b..486a816da0cc633fde966c7666d3b24c96f9504a 100644 (file)
@@ -46,12 +46,12 @@ class DNSBLConfEntry
 class DNSBLResolver : public Resolver
 {
        int theirfd;
-       User* them;
+       LocalUser* them;
        DNSBLConfEntry *ConfEntry;
 
  public:
 
-       DNSBLResolver(Module *me, const std::string &hostname, User* u, int userfd, DNSBLConfEntry *conf, bool &cached)
+       DNSBLResolver(Module *me, const std::string &hostname, LocalUser* u, int userfd, DNSBLConfEntry *conf, bool &cached)
                : Resolver(hostname, DNS_QUERY_A, cached, me)
        {
                theirfd = userfd;
@@ -322,42 +322,38 @@ class ModuleDNSBL : public Module
                ReadConf();
        }
 
-       virtual ModResult OnUserRegister(User* user)
+       virtual ModResult OnUserRegister(LocalUser* user)
        {
-               /* only do lookups on local users */
-               if (IS_LOCAL(user))
-               {
-                       /* following code taken from bopm, reverses an IP address. */
-                       struct in_addr in;
-                       unsigned char a, b, c, d;
-                       char reversedipbuf[128];
-                       std::string reversedip;
-                       bool success;
+               /* following code taken from bopm, reverses an IP address. */
+               struct in_addr in;
+               unsigned char a, b, c, d;
+               char reversedipbuf[128];
+               std::string reversedip;
+               bool success;
 
-                       success = inet_aton(user->GetIPString(), &in);
+               success = inet_aton(user->GetIPString(), &in);
 
-                       if (!success)
-                               return MOD_RES_PASSTHRU;
+               if (!success)
+                       return MOD_RES_PASSTHRU;
 
-                       d = (unsigned char) (in.s_addr >> 24) & 0xFF;
-                       c = (unsigned char) (in.s_addr >> 16) & 0xFF;
-                       b = (unsigned char) (in.s_addr >> 8) & 0xFF;
-                       a = (unsigned char) in.s_addr & 0xFF;
+               d = (unsigned char) (in.s_addr >> 24) & 0xFF;
+               c = (unsigned char) (in.s_addr >> 16) & 0xFF;
+               b = (unsigned char) (in.s_addr >> 8) & 0xFF;
+               a = (unsigned char) in.s_addr & 0xFF;
 
-                       snprintf(reversedipbuf, 128, "%d.%d.%d.%d", d, c, b, a);
-                       reversedip = std::string(reversedipbuf);
+               snprintf(reversedipbuf, 128, "%d.%d.%d.%d", d, c, b, a);
+               reversedip = std::string(reversedipbuf);
 
-                       // For each DNSBL, we will run through this lookup
-                       for (std::vector<DNSBLConfEntry *>::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++)
-                       {
-                               // Fill hostname with a dnsbl style host (d.c.b.a.domain.tld)
-                               std::string hostname = reversedip + "." + (*i)->domain;
+               // For each DNSBL, we will run through this lookup
+               for (std::vector<DNSBLConfEntry *>::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++)
+               {
+                       // Fill hostname with a dnsbl style host (d.c.b.a.domain.tld)
+                       std::string hostname = reversedip + "." + (*i)->domain;
 
-                               /* now we'd need to fire off lookups for `hostname'. */
-                               bool cached;
-                               DNSBLResolver *r = new DNSBLResolver(this, hostname, user, user->GetFd(), *i, cached);
-                               ServerInstance->AddResolver(r, cached);
-                       }
+                       /* now we'd need to fire off lookups for `hostname'. */
+                       bool cached;
+                       DNSBLResolver *r = new DNSBLResolver(this, hostname, user, user->GetFd(), *i, cached);
+                       ServerInstance->AddResolver(r, cached);
                }
 
                /* don't do anything with this hot potato */
index 7d998e2676f3553409c11075d9d96bc8ab02c059..4a067bcacbfc2c3bd2c1becd75ce95700ffa47c1 100644 (file)
@@ -91,9 +91,8 @@ class ModuleHostChange : public Module
                return Version("Provides masking of user hostnames in a different way to m_cloaking", VF_VENDOR);
        }
 
-       virtual void OnUserConnect(User* iuser)
+       virtual void OnUserConnect(LocalUser* user)
        {
-               LocalUser* user = (LocalUser*)iuser;
                for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++)
                {
                        if (((InspIRCd::MatchCIDR(user->MakeHost(), i->first)) || (InspIRCd::MatchCIDR(user->MakeHostIP(), i->first))))
index 8df849902e248698ef402ca03de1b1396ccdee63..fbd7706fe7efd2a802887b0b456b0ade555e2e53 100644 (file)
@@ -303,7 +303,7 @@ class ModuleIdent : public Module
                        RequestTimeout = 5;
        }
 
-       virtual ModResult OnUserRegister(User *user)
+       virtual ModResult OnUserRegister(LocalUser *user)
        {
                ConfigTag* tag = user->MyClass->config;
                if (!tag->getBool("useident", true))
@@ -334,7 +334,7 @@ class ModuleIdent : public Module
         * creating a Timer object and especially better than creating a
         * Timer per ident lookup!
         */
-       virtual ModResult OnCheckReady(User *user)
+       virtual ModResult OnCheckReady(LocalUser *user)
        {
                /* Does user have an ident socket attached at all? */
                IdentRequestSocket *isock = ext.get(user);
@@ -389,10 +389,10 @@ class ModuleIdent : public Module
        {
                /* Module unloading, tidy up users */
                if (target_type == TYPE_USER)
-                       OnUserDisconnect((User*)item);
+                       OnUserDisconnect((LocalUser*)item);
        }
 
-       virtual void OnUserDisconnect(User *user)
+       virtual void OnUserDisconnect(LocalUser *user)
        {
                /* User disconnect (generic socket detatch event) */
                IdentRequestSocket *isock = ext.get(user);
index 12e0cfa84ffecc52e11d40b3b1548404cce6da30..0c7cc4dc76e6b6e2396ea0b386e982f80e2f872d 100644 (file)
@@ -41,10 +41,6 @@ class InvisibleMode : public ModeHandler
                        if (m && adding)
                                m->OnUserQuit(dest, "Connection closed", "Connection closed");
 
-                       /* This has to come after setting/unsetting the handler */
-                       if (m && !adding)
-                               m->OnPostConnect(dest);
-
                        /* User appears to vanish or appear from nowhere */
                        for (UCListIter f = dest->chans.begin(); f != dest->chans.end(); f++)
                        {
index d46e85bdde48dd52af25c9c8ae2422923903bcaf..10453818a02563e8d29ff420fbf85f9b2b23a74b 100644 (file)
@@ -146,7 +146,7 @@ class ModuleJumpServer : public Module
        {
        }
 
-       virtual ModResult OnUserRegister(User* user)
+       virtual ModResult OnUserRegister(LocalUser* user)
        {
                if (js.port && js.redirect_new_users)
                {
index 100b7864b70803a5521fac51ae2c1e69a0b5295b..58f468c502cd2853e06b01a06c2082932895e4ad 100644 (file)
@@ -93,7 +93,7 @@ public:
                ResetLocked();
        }
 
-       virtual ModResult OnUserRegister(User* user)
+       virtual ModResult OnUserRegister(LocalUser* user)
        {
                if (locked)
                {
@@ -103,7 +103,7 @@ public:
                return MOD_RES_PASSTHRU;
        }
 
-       virtual ModResult OnCheckReady(User* user)
+       virtual ModResult OnCheckReady(LocalUser* user)
        {
                return locked ? MOD_RES_DENY : MOD_RES_PASSTHRU;
        }
index f6925e9740eab5614dec68fc9d168caa7c24062a..6c6f060e85ea3f3b521e631e519fcbd7783de2b3 100644 (file)
@@ -97,7 +97,7 @@ class ModuleRandQuote : public Module
                return Version("Provides random Quotes on Connect.",VF_VENDOR);
        }
 
-       virtual void OnUserConnect(User* user)
+       virtual void OnUserConnect(LocalUser* user)
        {
                cmd.Handle(std::vector<std::string>(), user);
        }
index 63ab0ccbb0ccbcb9b82eabc14a32234f78251c4e..87a95a1ff41faf07e77d04d8c4891fc40d3fd49f 100644 (file)
@@ -230,7 +230,7 @@ class ModuleRLine : public Module
                return Version("RLINE: Regexp user banning.", VF_COMMON | VF_VENDOR);
        }
 
-       virtual void OnUserConnect(User* user)
+       virtual void OnUserConnect(LocalUser* user)
        {
                // Apply lines on user connect
                XLine *rl = ServerInstance->XLines->MatchesLine("R", user);
index 8e1a73354782fef65ec538d5718b6fc62707aea2..677e930f20c20ccc558d013ad995daa990f99367 100644 (file)
@@ -237,7 +237,7 @@ class ModuleSASL : public Module
                        ServerInstance->Logs->Log("m_sasl", DEFAULT, "WARNING: m_services_account.so and m_cap.so are not loaded! m_sasl.so will NOT function correctly until these two modules are loaded!");
        }
 
-       ModResult OnUserRegister(User *user)
+       ModResult OnUserRegister(LocalUser *user)
        {
                SaslAuthenticator *sasl_ = authExt.get(user);
                if (sasl_)
index d4053fba05a42c9d86b30fde1f3eba06dd2ba2a1..b4adc93002c2eebffa8ffb7434b2381043e92645 100644 (file)
@@ -236,7 +236,7 @@ class ModuleShun : public Module
                affectopers = MyConf.ReadFlag("shun", "affectopers", "no", 0);
        }
 
-       virtual void OnUserConnect(User* user)
+       virtual void OnUserConnect(LocalUser* user)
        {
                if (!IS_LOCAL(user))
                        return;
index 3b18874d3c7ccfa158361477ede460caa5b8c54a..a0acd9b08b9aba2d8cd2907efdb52c12f11d7394 100644 (file)
@@ -46,7 +46,7 @@ ModuleSpanningTree::ModuleSpanningTree()
        {
                I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostTopicChange,
                I_OnWallops, I_OnUserNotice, I_OnUserMessage, I_OnBackgroundTimer, I_OnUserJoin,
-               I_OnChangeLocalUserHost, I_OnChangeName, I_OnChangeIdent, I_OnUserPart, I_OnUnloadModule,
+               I_OnChangeHost, I_OnChangeName, I_OnChangeIdent, I_OnUserPart, I_OnUnloadModule,
                I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnPreRehash,
                I_OnOper, I_OnAddLine, I_OnDelLine, I_OnMode, I_OnLoadModule, I_OnStats,
                I_OnSetAway, I_OnPostCommand, I_OnUserConnect
@@ -592,7 +592,7 @@ void ModuleSpanningTree::OnBackgroundTimer(time_t curtime)
        DoConnectTimeout(curtime);
 }
 
-void ModuleSpanningTree::OnUserConnect(User* user)
+void ModuleSpanningTree::OnUserConnect(LocalUser* user)
 {
        if (user->quitting)
                return;
@@ -630,21 +630,19 @@ void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created, C
        }
 }
 
-ModResult ModuleSpanningTree::OnChangeLocalUserHost(User* user, const std::string &newhost)
+void ModuleSpanningTree::OnChangeHost(User* user, const std::string &newhost)
 {
-       if (user->registered != REG_ALL)
-               return MOD_RES_PASSTHRU;
+       if (user->registered != REG_ALL || !IS_LOCAL(user))
+               return;
 
        parameterlist params;
        params.push_back(newhost);
        Utils->DoOneToMany(user->uuid,"FHOST",params);
-       return MOD_RES_PASSTHRU;
 }
 
 void ModuleSpanningTree::OnChangeName(User* user, const std::string &gecos)
 {
-       // only occurs for local clients
-       if (user->registered != REG_ALL)
+       if (user->registered != REG_ALL || !IS_LOCAL(user))
                return;
 
        parameterlist params;
index 69244259882ad1b2f91c6929802b80f899ac6066..b9d5debb397b6cbc9fd2f8c5a9cb2b75099e79e6 100644 (file)
@@ -161,7 +161,7 @@ class ModuleSpanningTree : public Module
        ModResult OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line);
        void OnPostCommand(const std::string &command, const std::vector<std::string>& parameters, User *user, CmdResult result, const std::string &original_line);
        void OnGetServerDescription(const std::string &servername,std::string &description);
-       void OnUserConnect(User* source);
+       void OnUserConnect(LocalUser* source);
        void OnUserInvite(User* source,User* dest,Channel* channel, time_t);
        void OnPostTopicChange(User* user, Channel* chan, const std::string &topic);
        void OnWallops(User* user, const std::string &text);
@@ -169,7 +169,7 @@ class ModuleSpanningTree : public Module
        void OnUserMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list);
        void OnBackgroundTimer(time_t curtime);
        void OnUserJoin(Membership* memb, bool sync, bool created, CUList& excepts);
-       ModResult OnChangeLocalUserHost(User* user, const std::string &newhost);
+       void OnChangeHost(User* user, const std::string &newhost);
        void OnChangeName(User* user, const std::string &gecos);
        void OnChangeIdent(User* user, const std::string &ident);
        void OnUserPart(Membership* memb, std::string &partmessage, CUList& excepts);
index 6763e82145d512736be922873d565dc08d34b6fb..a4c237e4e3a932c9ae72f18b9d9729bae8cfc216 100644 (file)
@@ -69,7 +69,7 @@ public:
                verbose         = Conf.ReadFlag("sqlauth", "verbose", 0);               /* Set to true if failed connects should be reported to operators */
        }
 
-       ModResult OnUserRegister(User* user)
+       ModResult OnUserRegister(LocalUser* user)
        {
                if ((!allowpattern.empty()) && (InspIRCd::Match(user->nick,allowpattern)))
                {
@@ -176,7 +176,7 @@ public:
                }
        }
 
-       ModResult OnCheckReady(User* user)
+       ModResult OnCheckReady(LocalUser* user)
        {
                return sqlAuthed.get(user) ? MOD_RES_PASSTHRU : MOD_RES_DENY;
        }
index 6bdcda6cb515d0f7f293dd5cae3d0771f2e5eec5..8ff12a8d9fce471294a8b085d00e24a72f65e51a 100644 (file)
@@ -248,7 +248,7 @@ class ModuleSQLLog : public Module
                return MOD_RES_PASSTHRU;
        }
 
-       virtual void OnUserConnect(User* user)
+       virtual void OnUserConnect(LocalUser* user)
        {
                AddLogEntry(LT_CONNECT,user->nick,user->host,user->server);
        }
index 28f32ec26cec4ef4aca644a46c05679b32f4695a..db5a990e17831384e2fa29585e89638de62fa2b8 100644 (file)
@@ -97,7 +97,7 @@ public:
                }
        }
 
-       void OnUserDisconnect(User* user)
+       void OnUserDisconnect(LocalUser* user)
        {
                /* A user is disconnecting, first we need to check if they have a list of queries associated with them.
                 * Then, if they do, we need to erase each of them from our IdUserMap (iduser) so when the module that
index db2b3a75c56b8ff377a5eb8bf6ce12fed4ad9fbd..6889ddba369c757197800c114780665518e606c4 100644 (file)
@@ -198,14 +198,13 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char
                user->WriteCommonQuit(reason, oper_reason);
        }
 
-       FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(user));
-
        if (user->registered != REG_ALL)
                if (ServerInstance->Users->unregistered_count)
                        ServerInstance->Users->unregistered_count--;
 
        if (IS_LOCAL(user))
        {
+               FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(IS_LOCAL(user)));
                user->DoWrite();
                if (user->GetIOHook())
                {
index 1643c1a37bd57f0c0eba07667a0ebc5b6d5f10f5..dfb386871be45b24da09bf4b5fc4c4c2fb41146c 100644 (file)
@@ -1438,7 +1438,7 @@ bool User::ChangeName(const char* gecos)
        if (IS_LOCAL(this))
        {
                ModResult MOD_RESULT;
-               FIRST_MOD_RESULT(OnChangeLocalUserGECOS, MOD_RESULT, (this,gecos));
+               FIRST_MOD_RESULT(OnChangeLocalUserGECOS, MOD_RESULT, (IS_LOCAL(this),gecos));
                if (MOD_RESULT == MOD_RES_DENY)
                        return false;
                FOREACH_MOD(I_OnChangeName,OnChangeName(this,gecos));
@@ -1520,7 +1520,7 @@ bool User::ChangeDisplayedHost(const char* shost)
        if (IS_LOCAL(this))
        {
                ModResult MOD_RESULT;
-               FIRST_MOD_RESULT(OnChangeLocalUserHost, MOD_RESULT, (this,shost));
+               FIRST_MOD_RESULT(OnChangeLocalUserHost, MOD_RESULT, (IS_LOCAL(this),shost));
                if (MOD_RESULT == MOD_RES_DENY)
                        return false;
        }