]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Smart trick: the 'build complete' message is now a makefile section of its own which...
[user/henk/code/inspircd.git] / src / users.cpp
index c5199cb30eaad4ed3ecba0863d62ca0f0948c67c..c98a690250630fb01772545f9642e3f13571895d 100644 (file)
@@ -281,10 +281,9 @@ userrec::userrec(InspIRCd* Instance) : ServerInstance(Instance)
        
        for (unsigned int n = 0; n < MAXCHANS; n++)
        {
-               ucrec* x = new ucrec();
-               chans[n] = x;
-               x->channel = NULL;
-               x->uc_modes = 0;
+               chans[n] = new ucrec();
+               chans[n]->channel = NULL;
+               chans[n]->uc_modes = 0;
        }
 }
 
@@ -941,9 +940,11 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
        Instance->Log(DEBUG,"Push back to local users.");
        Instance->local_users.push_back(New);
 
-       Instance->Log(DEBUG,"Check softlimit.");
+       Instance->Log(DEBUG,"Check softlimit: %d %d %d",Instance->local_users.size(), Instance->Config->SoftLimit, MAXCLIENTS);
        if ((Instance->local_users.size() > Instance->Config->SoftLimit) || (Instance->local_users.size() >= MAXCLIENTS))
        {
+               Instance->Log(DEBUG,"Check softlimit failed");
+               Instance->WriteOpers("*** Warning: softlimit value has been reached: %d clients", Instance->Config->SoftLimit);
                userrec::QuitUser(Instance, New,"No more connections allowed");
                return;
        }
@@ -1002,19 +1003,20 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
 
 long userrec::GlobalCloneCount()
 {
-       char u1[128];
        char u2[128];
        long x = 0;
+       strlcpy(u2, this->GetIPString(), 64);
 
        for (user_hash::const_iterator a = ServerInstance->clientlist.begin(); a != ServerInstance->clientlist.end(); a++)
        {
                /* We have to match ip's as strings - we don't know what protocol
                 * a remote user may be using
                 */
-               if (strcmp(a->second->GetIPString(u1), this->GetIPString(u2)) == 0)
+               ServerInstance->Log(DEBUG,"Match %s against %s", a->second->GetIPString(), u2);
+               if (strcasecmp(a->second->GetIPString(), u2) == 0)
                        x++;
        }
-       
+
        return x;
 }
 
@@ -1132,8 +1134,11 @@ void userrec::FullConnect(CullList* Goners)
         * changes dont go out onto the network and produce 'fake direction'.
         */
        FOREACH_MOD(I_OnUserConnect,OnUserConnect(this));
-       FOREACH_MOD(I_OnPostConnect,OnPostConnect(this));
+
        this->registered = REG_ALL;
+
+       FOREACH_MOD(I_OnPostConnect,OnPostConnect(this));
+
        ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d: %s!%s@%s [%s]", this->GetPort(), this->nick, this->ident, this->host, this->GetIPString());
 }