From b8b1fccfad11b6eee9298cef6c81607da8d0f58c Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 1 May 2005 22:11:29 +0000 Subject: Added FindDescriptor git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1273 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/modules.h | 4 ++++ src/modules.cpp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/include/modules.h b/include/modules.h index 757c8c745..fc6464717 100644 --- a/include/modules.h +++ b/include/modules.h @@ -784,6 +784,10 @@ class Server : public classbase * This function will return NULL if the nick does not exist. */ virtual userrec* FindNick(std::string nick); + /** Attempts to look up a nick using the file descriptor associated with that nick. + * This function will return NULL if the file descriptor is not associated with a valid user. + */ + virtual userrec* FindDescriptor(int socket); /** Attempts to look up a channel and return a pointer to it. * This function will return NULL if the channel does not exist. */ diff --git a/src/modules.cpp b/src/modules.cpp index 8b7f27731..95e2aa77c 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -107,6 +107,7 @@ extern serverrec* me[32]; extern FILE *log_file; +extern userrec* fd_ref_table[65536]; namespace nspace { @@ -589,6 +590,11 @@ userrec* Server::FindNick(std::string nick) return Find(nick); } +userrec* Server::FindDescriptor(int socket) +{ + return (socket < 65536 ? fd_ref_table[socket] : NULL); +} + chanrec* Server::FindChannel(std::string channel) { return FindChan(channel.c_str()); -- cgit v1.2.3