X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_ident.cpp;h=8f251cb467253d3ede7fee8734bcb1eda2ce5dc2;hb=8e89fe75f9467969bce1dc6930befc6ef273edf6;hp=ee0c3e83b4ad1fd3b63669a2d71c1edc07041c27;hpb=ab9a1cd1ffafb4c535f4f9ed09bce20065860437;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index ee0c3e83b..8f251cb46 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * InspIRCd: (C) 2002-2008 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -180,7 +180,7 @@ class IdentRequestSocket : public EventHandler virtual void OnConnected() { - ServerInstance->Log(DEBUG,"OnConnected()"); + ServerInstance->Logs->Log("m_ident",DEBUG,"OnConnected()"); /* Both sockaddr_in and sockaddr_in6 can be safely casted to sockaddr, especially since the * only members we use are in a part of the struct that should always be identical (at the @@ -230,7 +230,7 @@ class IdentRequestSocket : public EventHandler break; case EVENT_ERROR: /* fd error event, ohshi- */ - ServerInstance->Log(DEBUG,"EVENT_ERROR"); + ServerInstance->Logs->Log("m_ident",DEBUG,"EVENT_ERROR"); /* We *must* Close() here immediately or we get a * huge storm of EVENT_ERROR events! */ @@ -247,7 +247,7 @@ class IdentRequestSocket : public EventHandler */ if (GetFd() > -1) { - ServerInstance->Log(DEBUG,"Close ident socket %d", GetFd()); + ServerInstance->Logs->Log("m_ident",DEBUG,"Close ident socket %d", GetFd()); ServerInstance->SE->DelFd(this); ServerInstance->SE->Close(GetFd()); ServerInstance->SE->Shutdown(GetFd(), SHUT_WR); @@ -286,7 +286,7 @@ class IdentRequestSocket : public EventHandler return; } - ServerInstance->Log(DEBUG,"ReadResponse()"); + ServerInstance->Logs->Log("m_ident",DEBUG,"ReadResponse()"); irc::sepstream sep(ibuf, ':'); std::string token; @@ -344,17 +344,15 @@ class ModuleIdent : public Module : Module(Me) { OnRehash(NULL, ""); + Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCheckReady, I_OnCleanup, I_OnUserDisconnect }; + ServerInstance->Modules->Attach(eventlist, this, 5); } virtual Version GetVersion() { - return Version(1, 1, 1, 0, VF_VENDOR, API_VERSION); + return Version(1, 2, 1, 0, VF_VENDOR, API_VERSION); } - virtual void Implements(char *List) - { - List[I_OnRehash] = List[I_OnUserRegister] = List[I_OnCheckReady] = List[I_OnCleanup] = List[I_OnUserDisconnect] = 1; - } virtual void OnRehash(User *user, const std::string ¶m) { @@ -404,7 +402,7 @@ class ModuleIdent : public Module } catch (ModuleException &e) { - ServerInstance->Log(DEBUG,"Ident exception: %s", e.GetReason()); + ServerInstance->Logs->Log("m_ident",DEBUG,"Ident exception: %s", e.GetReason()); return 0; } @@ -418,27 +416,27 @@ class ModuleIdent : public Module */ virtual bool OnCheckReady(User *user) { - ServerInstance->Log(DEBUG,"OnCheckReady %s", user->nick); + ServerInstance->Logs->Log("m_ident",DEBUG,"OnCheckReady %s", user->nick); /* Does user have an ident socket attached at all? */ IdentRequestSocket *isock = NULL; if (!user->GetExt("ident_socket", isock)) { - ServerInstance->Log(DEBUG, "No ident socket :("); + ServerInstance->Logs->Log("m_ident",DEBUG, "No ident socket :("); return true; } - ServerInstance->Log(DEBUG, "Has ident_socket"); + ServerInstance->Logs->Log("m_ident",DEBUG, "Has ident_socket"); time_t compare = isock->age; compare += RequestTimeout; /* Check for timeout of the socket */ - if (ServerInstance->Time() >= RequestTimeout) + if (ServerInstance->Time() >= compare) { /* Ident timeout */ user->WriteServ("NOTICE Auth :*** Ident request timed out."); - ServerInstance->Log(DEBUG, "Timeout"); + ServerInstance->Logs->Log("m_ident",DEBUG, "Timeout"); /* The user isnt actually disconnecting, * we call this to clean up the user */ @@ -449,11 +447,11 @@ class ModuleIdent : public Module /* Got a result yet? */ if (!isock->HasResult()) { - ServerInstance->Log(DEBUG, "No result yet"); + ServerInstance->Logs->Log("m_ident",DEBUG, "No result yet"); return false; } - ServerInstance->Log(DEBUG, "Yay, result!"); + ServerInstance->Logs->Log("m_ident",DEBUG, "Yay, result!"); /* wooo, got a result (it will be good, or bad) */ if (*(isock->GetResult()) != '~') @@ -485,10 +483,10 @@ class ModuleIdent : public Module isock->Close(); delete isock; user->Shrink("ident_socket"); - ServerInstance->Log(DEBUG, "Removed ident socket from %s", user->nick); + ServerInstance->Logs->Log("m_ident",DEBUG, "Removed ident socket from %s", user->nick); } } }; -MODULE_INIT(ModuleIdent); +MODULE_INIT(ModuleIdent)