]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Revert "Remove user no longer being watched, not the quitting one. Fix from Szymek...
[user/henk/code/inspircd.git] / src / users.cpp
index 39922104ea300a574243088f3d08507b8e5f526f..848f2a1eb23f1c60c78da4653b7bf8bbc6768f41 100644 (file)
@@ -98,14 +98,13 @@ void User::StartDNSLookup()
        try
        {
                bool cached = false;
-               const char* sip = this->GetIPString(false);
+               const char* sip = this->GetIPString();
                UserResolver *res_reverse;
 
-               /* Special case for 4in6 (Have i mentioned i HATE 4in6?) */
-               if (!strncmp(sip, "0::ffff:", 8))
-                       res_reverse = new UserResolver(this->ServerInstance, this, sip + 8, DNS_QUERY_PTR4, cached);
-               else
-                       res_reverse = new UserResolver(this->ServerInstance, this, sip, this->GetProtocolFamily() == AF_INET ? DNS_QUERY_PTR4 : DNS_QUERY_PTR6, cached);
+               QueryType resolvtype = strchr(sip, ':') ? DNS_QUERY_PTR6 : DNS_QUERY_PTR4;
+               // when GetProtocolFamily() works correctly with 4in6, this can be replaced by
+               // this->GetProtocolFamily() == AF_INET ? DNS_QUERY_PTR4 : DNS_QUERY_PTR6;
+               res_reverse = new UserResolver(this->ServerInstance, this, sip, resolvtype, cached);
 
                this->ServerInstance->AddResolver(res_reverse, cached);
        }
@@ -399,7 +398,7 @@ const std::string& User::GetFullRealHost()
 
 bool User::IsInvited(const irc::string &channel)
 {
-       time_t now = ServerInstance->Time();
+       time_t now = time(NULL);
        InvitedList::iterator safei;
        for (InvitedList::iterator i = invites.begin(); i != invites.end(); ++i)
        {
@@ -421,7 +420,7 @@ bool User::IsInvited(const irc::string &channel)
 
 InvitedList* User::GetInviteList()
 {
-       time_t now = ServerInstance->Time();
+       time_t now = time(NULL);
        /* Weed out expired invites here. */
        InvitedList::iterator safei;
        for (InvitedList::iterator i = invites.begin(); i != invites.end(); ++i)
@@ -439,7 +438,7 @@ InvitedList* User::GetInviteList()
 
 void User::InviteTo(const irc::string &channel, time_t invtimeout)
 {
-       time_t now = ServerInstance->Time();
+       time_t now = time(NULL);
        if (invtimeout != 0 && now > invtimeout) return; /* Don't add invites that are expired from the get-go. */
        for (InvitedList::iterator i = invites.begin(); i != invites.end(); ++i)
        {
@@ -1233,7 +1232,7 @@ const char* User::GetCIDRMask(int range)
        return ""; // unused, but oh well
 }
 
-const char* User::GetIPString(bool translate4in6)
+const char* User::GetIPString()
 {
        static char buf[40];
 
@@ -1257,12 +1256,6 @@ const char* User::GetIPString(bool translate4in6)
                        {
                                strlcpy(&temp[1], buf, sizeof(temp) - 1);
                                *temp = '0';
-                               if (translate4in6 && !strncmp(temp, "0::ffff:", 8))
-                               {
-                                       this->cachedip = temp + 8;
-                                       return temp + 8;
-                               }
-
                                this->cachedip = temp;
                                return temp;
                        }
@@ -1672,9 +1665,10 @@ bool User::ChangeDisplayedHost(const char* shost)
                FOREACH_RESULT(I_OnChangeLocalUserHost,OnChangeLocalUserHost(this,shost));
                if (MOD_RESULT)
                        return false;
-               FOREACH_MOD(I_OnChangeHost,OnChangeHost(this,shost));
        }
 
+       FOREACH_MOD(I_OnChangeHost, OnChangeHost(this,shost));
+
        int MOD_RESULT = 0;
        FOREACH_RESULT(I_OnHostCycle, OnHostCycle(this));
 
@@ -1830,6 +1824,9 @@ ConnectClass* User::SetClass(const std::string &explicit_name)
                {
                        ConnectClass* c = *i;
 
+                       if (c->GetDisabled())
+                               continue; // can't possibly match, removed from conf
+
                        if (explicit_name == c->GetName())
                        {
                                ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Explicitly set to %s", explicit_name.c_str());
@@ -1852,6 +1849,13 @@ ConnectClass* User::SetClass(const std::string &explicit_name)
                                ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "DENY %s %d %s", c->GetHost().c_str(), c->GetPort(), c->GetName().c_str());
                        }
 
+                       /* if it's disabled, we can't match this one. */
+                       if (c->GetDisabled())
+                       {
+                               ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Class disabled");
+                               continue;
+                       }
+
                        /* check if host matches.. */
                        if (!InspIRCd::MatchCIDR(this->GetIPString(), c->GetHost(), NULL) && 
                            !InspIRCd::MatchCIDR(this->host, c->GetHost(), NULL))