diff options
-rw-r--r-- | include/helperfuncs.h | 1 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/helperfuncs.h b/include/helperfuncs.h index 73e791c9d..15a11e531 100644 --- a/include/helperfuncs.h +++ b/include/helperfuncs.h @@ -61,6 +61,7 @@ void ServerPrivmsgAll(char* text, ...); void WriteWallOps(userrec *source, bool local_only, char* text, ...); void strlower(char *n); userrec* Find(std::string &nick); +userrec* Find(const char* nick); chanrec* FindChan(const char* chan); long GetMaxBans(char* name); void purge_empty_chans(userrec* u); diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 4f9814cda..6e90c023c 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -1024,6 +1024,18 @@ userrec* Find(std::string &nick) return iter->second; } +userrec* Find(const char* nick) +{ + if (!nick) + return NULL; + user_hash::iterator iter = clientlist.find(nick); + + if (iter == clientlist.end()) + return NULL; + + return iter->second; +} + /* find a channel record by channel name and return a pointer to it */ chanrec* FindChan(const char* chan) |