X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fusers.cpp;h=108ce138559dfb4b6a0d9e76fb000a824d7d9ed6;hb=73eb66f2b1c82f9e1d1a24093aa4a305c2cfe2e7;hp=80515ffb8aa8e1afb9b0483d41428846bda76180;hpb=e20a0915892b965b345db80d25fed25b8ef3a52f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/users.cpp b/src/users.cpp index 80515ffb8..108ce1385 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -191,7 +191,7 @@ User::User(InspIRCd* Instance, const std::string &uid) : ServerInstance(Instance Penalty = 0; lines_in = lastping = signon = idle_lastmsg = nping = registered = 0; ChannelCount = timeout = bytes_in = bytes_out = cmds_in = cmds_out = 0; - is4in6 = quietquit = OverPenalty = ExemptFromPenalty = quitting = exempt = haspassed = dns_done = false; + quietquit = OverPenalty = ExemptFromPenalty = quitting = exempt = haspassed = dns_done = false; fd = -1; recvq.clear(); sendq.clear(); @@ -859,6 +859,25 @@ void User::CheckClass() this->MaxChans = a->GetMaxChans(); } +void User::CheckLines() +{ + const char* check[] = { "G" , "K", NULL }; + + if (!this->exempt) + { + for (int n = 0; check[n]; ++n) + { + XLine *r = ServerInstance->XLines->MatchesLine(check[n], this); + + if (r) + { + r->Apply(this); + return; + } + } + } +} + void User::FullConnect() { ServerInstance->stats->statsConnects++; @@ -881,24 +900,7 @@ void User::FullConnect() return; } - if (!this->exempt) - { - GLine *r = (GLine *)ServerInstance->XLines->MatchesLine("G", this); - - if (r) - { - r->Apply(this); - return; - } - - KLine *n = (KLine *)ServerInstance->XLines->MatchesLine("K", this); - - if (n) - { - n->Apply(this); - return; - } - } + CheckLines(); this->WriteServ("NOTICE Auth :Welcome to \002%s\002!",ServerInstance->Config->Network); this->WriteNumeric(001, "%s :Welcome to the %s IRC Network %s!%s@%s",this->nick, ServerInstance->Config->Network, this->nick, this->ident, this->host); @@ -1030,8 +1032,6 @@ void User::SetSockAddr(int protocol_family, const char* sip, int port) ServerInstance->Logs->Log("USERS",DEBUG,"Uh oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick); break; } - - is4in6 = !strncmp(GetIPString(), "0::ffff:", 8); } int User::GetPort() @@ -1098,7 +1098,7 @@ const char* User::GetIPString(bool translate4in6) { strlcpy(&temp[1], buf, sizeof(temp) - 1); *temp = '0'; - if (translate4in6 && is4in6) + if (translate4in6 && !strncmp(temp, "0::ffff:", 8)) { this->cachedip = temp + 8; return temp + 8;