/* Find a user record by nickname and return a pointer to it */
userrec* InspIRCd::FindNick(const std::string &nick)
{
+ if (!nick.empty() && isdigit(*nick.begin()))
+ return FindUUID(nick);
+
user_hash::iterator iter = clientlist->find(nick);
if (iter == clientlist->end())
userrec* InspIRCd::FindNick(const char* nick)
{
+ if (isdigit(*nick))
+ return FindUUID(nick);
+
user_hash::iterator iter = clientlist->find(nick);
if (iter == clientlist->end())
userrec *InspIRCd::FindUUID(const char *uid)
{
- for (user_hash::const_iterator a = this->clientlist->begin(); a != this->clientlist->end(); a++)
- {
- userrec *u = a->second;
+ user_hash::iterator finduuid = uuidlist->find(uid);
- if (strcmp(u->uuid, uid) == 0)
- {
- return u;
- }
- }
+ if (finduuid == uuidlist->end())
+ return NULL;
- return NULL;
+ return finduuid->second;
}
/* find a channel record by channel name and return a pointer to it */