]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Make log targets in config space-seperated (ie: 'USERINPUT USEROUTPUT') like the...
[user/henk/code/inspircd.git] / src / users.cpp
index 2e0e0d3cce99e2f4f0f0fcde2a85d94c279fcbf5..e3aeb299b8a8d2ea90e2a15a6248f5a794f369dd 100644 (file)
@@ -88,13 +88,13 @@ void User::StartDNSLookup()
        try
        {
                bool cached;
-               const char* ip = this->GetIPString();
+               const char* sip = this->GetIPString();
 
                /* Special case for 4in6 (Have i mentioned i HATE 4in6?) */
-               if (!strncmp(ip, "0::ffff:", 8))
-                       res_reverse = new UserResolver(this->ServerInstance, this, ip + 8, DNS_QUERY_PTR4, cached);
+               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, ip, this->GetProtocolFamily() == AF_INET ? DNS_QUERY_PTR4 : DNS_QUERY_PTR6, cached);
+                       res_reverse = new UserResolver(this->ServerInstance, this, sip, this->GetProtocolFamily() == AF_INET ? DNS_QUERY_PTR4 : DNS_QUERY_PTR6, cached);
 
                this->ServerInstance->AddResolver(res_reverse, cached);
        }
@@ -405,21 +405,21 @@ InvitedList* User::GetInviteList()
        return &invites;
 }
 
-void User::InviteTo(const irc::string &channel, time_t timeout)
+void User::InviteTo(const irc::string &channel, time_t invtimeout)
 {
        time_t now = time(NULL);
-       if (timeout != 0 && now > timeout) return; /* Don't add invites that are expired from the get-go. */
+       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)
        {
                if (channel == i->first)
                {
-                       if (i->second != 0 && timeout > i->second)
+                       if (i->second != 0 && invtimeout > i->second)
                        {
-                               i->second = timeout;
+                               i->second = invtimeout;
                        }
                }
        }
-       invites.push_back(std::make_pair(channel, timeout));
+       invites.push_back(std::make_pair(channel, invtimeout));
 }
 
 void User::RemoveInvite(const irc::string &channel)
@@ -721,7 +721,12 @@ void User::QuitUser(InspIRCd* Instance, User *user, const std::string &quitreaso
        user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident, user->host, *operreason ? operreason : quitreason.c_str());
        user->quietquit = false;
        user->quitmsg = quitreason;
-       user->operquitmsg = operreason;
+
+       if (!*operreason)
+               user->operquitmsg = quitreason;
+       else
+               user->operquitmsg = operreason;
+
        Instance->GlobalCulls.AddItem(user);
 }
 
@@ -926,7 +931,7 @@ bool User::ForceNickChange(const char* newnick)
        return false;
 }
 
-void User::SetSockAddr(int protocol_family, const char* ip, int port)
+void User::SetSockAddr(int protocol_family, const char* sip, int port)
 {
        this->cachedip = "";
 
@@ -938,7 +943,7 @@ void User::SetSockAddr(int protocol_family, const char* ip, int port)
                        sockaddr_in6* sin = new sockaddr_in6;
                        sin->sin6_family = AF_INET6;
                        sin->sin6_port = port;
-                       inet_pton(AF_INET6, ip, &sin->sin6_addr);
+                       inet_pton(AF_INET6, sip, &sin->sin6_addr);
                        this->ip = (sockaddr*)sin;
                }
                break;
@@ -948,7 +953,7 @@ void User::SetSockAddr(int protocol_family, const char* ip, int port)
                        sockaddr_in* sin = new sockaddr_in;
                        sin->sin_family = AF_INET;
                        sin->sin_port = port;
-                       inet_pton(AF_INET, ip, &sin->sin_addr);
+                       inet_pton(AF_INET, sip, &sin->sin_addr);
                        this->ip = (sockaddr*)sin;
                }
                break;
@@ -1060,7 +1065,7 @@ void User::Write(std::string text)
 
        try
        {
-               ServerInstance->Logs->Log("USERIO", DEBUG,"C[%d] O %s", this->GetFd(), text.c_str());
+               ServerInstance->Logs->Log("USEROUTPUT", DEBUG,"C[%d] O %s", this->GetFd(), text.c_str());
                text.append("\r\n");
        }
        catch (...)
@@ -1380,25 +1385,25 @@ bool User::ChangeName(const char* gecos)
        return true;
 }
 
-bool User::ChangeDisplayedHost(const char* host)
+bool User::ChangeDisplayedHost(const char* shost)
 {
-       if (!strcmp(host, this->dhost))
+       if (!strcmp(shost, this->dhost))
                return true;
 
        if (IS_LOCAL(this))
        {
                int MOD_RESULT = 0;
-               FOREACH_RESULT(I_OnChangeLocalUserHost,OnChangeLocalUserHost(this,host));
+               FOREACH_RESULT(I_OnChangeLocalUserHost,OnChangeLocalUserHost(this,shost));
                if (MOD_RESULT)
                        return false;
-               FOREACH_MOD(I_OnChangeHost,OnChangeHost(this,host));
+               FOREACH_MOD(I_OnChangeHost,OnChangeHost(this,shost));
        }
 
        if (this->ServerInstance->Config->CycleHosts)
                this->WriteCommonExcept("QUIT :Changing hosts");
 
        /* Fix by Om: User::dhost is 65 long, this was truncating some long hosts */
-       strlcpy(this->dhost,host,64);
+       strlcpy(this->dhost,shost,64);
 
        this->InvalidateCache();
 
@@ -1445,7 +1450,7 @@ bool User::ChangeIdent(const char* newident)
        return true;
 }
 
-void User::SendAll(const char* command, char* text, ...)
+void User::SendAll(const char* command, const char* text, ...)
 {
        char textbuffer[MAXBUF];
        char formatbuffer[MAXBUF];