diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-24 15:13:17 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-24 15:13:17 +0000 |
commit | 343f12b9b2d4e519b09877f76a00f6a0714509f2 (patch) | |
tree | b51aee0ca78a19fd356cdc2788cab4530c7928c1 /src/usermanager.cpp | |
parent | 638381c529a2f19c699718234d689e54ad459c97 (diff) |
Add stuff so that modules can hook users by altering a pointer in the User class. Note that ssl modules still bind by port, but the idea of doing this change is so we can remove that logic next
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9187 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/usermanager.cpp')
-rw-r--r-- | src/usermanager.cpp | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 6145c887b..b518685fa 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -35,19 +35,35 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac return; } - Instance->Logs->Log("USERS", DEBUG,"New user fd: %d", socket); - - int j = 0; - - this->unregistered_count++; - char ipaddr[MAXBUF]; #ifdef IPV6 if (socketfamily == AF_INET6) inet_ntop(AF_INET6, &((const sockaddr_in6*)ip)->sin6_addr, ipaddr, sizeof(ipaddr)); else #endif - inet_ntop(AF_INET, &((const sockaddr_in*)ip)->sin_addr, ipaddr, sizeof(ipaddr)); + inet_ntop(AF_INET, &((const sockaddr_in*)ip)->sin_addr, ipaddr, sizeof(ipaddr)); + + + /* Give each of the modules an attempt to hook the user for I/O */ + FOREACH_MOD_I(Instance, I_OnHookUserIO, OnHookUserIO(New)); + + if (New->io) + { + try + { + New->io->OnRawSocketAccept(socket, ipaddr, port); + } + catch (CoreException& modexcept) + { + ServerInstance->Logs->Log("SOCKET", DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + } + } + + Instance->Logs->Log("USERS", DEBUG,"New user fd: %d", socket); + + int j = 0; + + this->unregistered_count++; (*(this->clientlist))[New->uuid] = New; |