X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fusermanager.cpp;h=bc058a4621d19fc80c53bcf265d8ceb42f54c330;hb=d221de88276b9e33a108281a9cd0a58875032fc6;hp=023e2aa5a674b520b6ac3ecdcb60fb2184c234e2;hpb=4a64082e31c3c3dfa97a1edfb8a3c97fe8d32ea7;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 023e2aa5a..bc058a462 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -18,15 +18,15 @@ #include "bancache.h" /* add a client connection to the sockets list */ -void UserManager::AddUser(int socket, ClientListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) +void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) { /* NOTE: Calling this one parameter constructor for User automatically * allocates a new UUID and places it in the hash_map. */ - User* New = NULL; + LocalUser* New = NULL; try { - New = new User(); + New = new LocalUser(); } catch (...) { @@ -63,7 +63,7 @@ void UserManager::AddUser(int socket, ClientListenSocket* via, irc::sockets::soc /* The users default nick is their UUID */ New->nick.assign(New->uuid, 0, ServerInstance->Config->Limits.NickMax); - New->server = ServerInstance->FindServerNamePtr(ServerInstance->Config->ServerName); + New->server = ServerInstance->Config->ServerName; New->ident.assign("unknown"); New->registered = REG_NONE; @@ -81,13 +81,7 @@ void UserManager::AddUser(int socket, ClientListenSocket* via, irc::sockets::soc * First class check. We do this again in FullConnect after DNS is done, and NICK/USER is recieved. * See my note down there for why this is required. DO NOT REMOVE. :) -- w00t */ - ConnectClass* i = New->SetClass(); - - if (!i) - { - this->QuitUser(New, "Access denied by configuration"); - return; - } + New->SetClass(); /* * Check connect class settings and initialise settings into User. @@ -117,8 +111,8 @@ void UserManager::AddUser(int socket, ClientListenSocket* via, irc::sockets::soc { /* user banned */ ServerInstance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Positive hit for ") + New->GetIPString()); - if (*ServerInstance->Config->MoronBanner) - New->WriteServ("NOTICE %s :*** %s", New->nick.c_str(), ServerInstance->Config->MoronBanner); + if (!ServerInstance->Config->MoronBanner.empty()) + New->WriteServ("NOTICE %s :*** %s", New->nick.c_str(), ServerInstance->Config->MoronBanner.c_str()); this->QuitUser(New, b->Reason); return; } @@ -198,14 +192,13 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char user->WriteCommonQuit(reason, oper_reason); } - FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(user)); - if (user->registered != REG_ALL) if (ServerInstance->Users->unregistered_count) ServerInstance->Users->unregistered_count--; if (IS_LOCAL(user)) { + FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(IS_LOCAL(user))); user->DoWrite(); if (user->GetIOHook()) { @@ -244,7 +237,7 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char if ((!ServerInstance->SilentULine(user->server)) && (!user->quietquit)) { ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s!%s@%s [%s]", - user->server, user->nick.c_str(), user->ident.c_str(), user->host.c_str(), oper_reason.c_str()); + user->server.c_str(), user->nick.c_str(), user->ident.c_str(), user->host.c_str(), oper_reason.c_str()); } } user->AddToWhoWas(); @@ -421,9 +414,9 @@ void UserManager::ServerNoticeAll(const char* text, ...) vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); - snprintf(formatbuffer,MAXBUF,"NOTICE $%s :%s", ServerInstance->Config->ServerName, textbuffer); + snprintf(formatbuffer,MAXBUF,"NOTICE $%s :%s", ServerInstance->Config->ServerName.c_str(), textbuffer); - for (std::vector::const_iterator i = local_users.begin(); i != local_users.end(); i++) + for (std::vector::const_iterator i = local_users.begin(); i != local_users.end(); i++) { User* t = *i; t->WriteServ(std::string(formatbuffer)); @@ -442,9 +435,9 @@ void UserManager::ServerPrivmsgAll(const char* text, ...) vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); - snprintf(formatbuffer,MAXBUF,"PRIVMSG $%s :%s", ServerInstance->Config->ServerName, textbuffer); + snprintf(formatbuffer,MAXBUF,"PRIVMSG $%s :%s", ServerInstance->Config->ServerName.c_str(), textbuffer); - for (std::vector::const_iterator i = local_users.begin(); i != local_users.end(); i++) + for (std::vector::const_iterator i = local_users.begin(); i != local_users.end(); i++) { User* t = *i; t->WriteServ(std::string(formatbuffer)); @@ -470,7 +463,7 @@ void UserManager::WriteMode(const char* modes, int flags, const char* text, ...) if (flags == WM_AND) { - for (std::vector::const_iterator i = local_users.begin(); i != local_users.end(); i++) + for (std::vector::const_iterator i = local_users.begin(); i != local_users.end(); i++) { User* t = *i; bool send_to_user = true; @@ -491,7 +484,7 @@ void UserManager::WriteMode(const char* modes, int flags, const char* text, ...) } else if (flags == WM_OR) { - for (std::vector::const_iterator i = local_users.begin(); i != local_users.end(); i++) + for (std::vector::const_iterator i = local_users.begin(); i != local_users.end(); i++) { User* t = *i; bool send_to_user = false;