X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fusermanager.cpp;h=73096d4a84e477c04cdd15aac06c1bbde3c8c1e6;hb=e3e748b78683ac005b4c85360806ea6ec27d40c9;hp=985e0e289b5f8dedce1cb0cc15e744ab1acbe665;hpb=4b856bda135a08e800b96c970a10b0b6a34d433a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 985e0e289..73096d4a8 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -63,17 +63,14 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, int port, bool iscache Instance->Logs->Log("USERS", DEBUG,"New user fd: %d", socket); - int j = 0; - this->unregistered_count++; (*(this->clientlist))[New->uuid] = New; /* The users default nick is their UUID */ - New->nick.assign(New->uuid, 0, NICKMAX - 1); + New->nick.assign(New->uuid, 0, ServerInstance->Config->Limits.NickMax); New->server = Instance->FindServerNamePtr(Instance->Config->ServerName); - /* We don't need range checking here, we KNOW 'unknown\0' will fit into the ident field. */ New->ident.assign("unknown"); New->registered = REG_NONE; @@ -81,9 +78,8 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, int port, bool iscache New->lastping = 1; /* Smarter than your average bear^H^H^H^Hset of strlcpys. */ - for (const char* temp = New->GetIPString(); *temp && j < 64; temp++, j++) - New->dhost[j] = New->host[j] = *temp; - New->dhost[j] = New->host[j] = 0; + New->dhost.assign(New->GetIPString(), 0, 64); + New->host.assign(New->GetIPString(), 0, 64); Instance->Users->AddLocalClone(New); Instance->Users->AddGlobalClone(New); @@ -193,7 +189,7 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, int port, bool iscache void UserManager::QuitUser(User *user, const std::string &quitreason, const char* operreason) { ServerInstance->Logs->Log("USERS", DEBUG,"QuitUser: %s '%s'", user->nick.c_str(), quitreason.c_str()); - user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident.c_str(), user->host, *operreason ? operreason : quitreason.c_str()); + user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident.c_str(), user->host.c_str(), *operreason ? operreason : quitreason.c_str()); user->quietquit = false; user->quitmsg = quitreason;