Add InspIRCd::FindUUID() methods. Currently, these work off an iteration around the whole client list. This sucks, and will be changed to a map the same as FindNick(). Also update FindNick's docs a little out of anal habit: it returns a user, not a nick. :)

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7855 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
w00t 2007-08-27 01:01:20 +00:00
parent 7936e1b8ba
commit 0c9434cde9
2 changed files with 32 additions and 2 deletions

View File

@ -399,6 +399,18 @@ class CoreExport InspIRCd : public classbase
*/ */
std::string GetUID(); std::string GetUID();
/** Find a user in the UUID hash
* @param nick The nickname to find
* @return A pointer to the user, or NULL if the user does not exist
*/
userrec *FindUUID(const std::string &);
/** Find a user in the UUID hash
* @param nick The nickname to find
* @return A pointer to the user, or NULL if the user does not exist
*/
userrec *FindUUID(const char *);
/** Build the ISUPPORT string by triggering all modules On005Numeric events /** Build the ISUPPORT string by triggering all modules On005Numeric events
*/ */
void BuildISupport(); void BuildISupport();
@ -608,13 +620,13 @@ class CoreExport InspIRCd : public classbase
*/ */
void WriteOpers(const std::string &text); void WriteOpers(const std::string &text);
/** Find a nickname in the nick hash /** Find a user in the nick hash
* @param nick The nickname to find * @param nick The nickname to find
* @return A pointer to the user, or NULL if the user does not exist * @return A pointer to the user, or NULL if the user does not exist
*/ */
userrec* FindNick(const std::string &nick); userrec* FindNick(const std::string &nick);
/** Find a nickname in the nick hash /** Find a user in the nick hash
* @param nick The nickname to find * @param nick The nickname to find
* @return A pointer to the user, or NULL if the user does not exist * @return A pointer to the user, or NULL if the user does not exist
*/ */

View File

@ -255,6 +255,24 @@ userrec* InspIRCd::FindNick(const char* nick)
return iter->second; return iter->second;
} }
userrec *InspIRCd::FindUUID(const std::string &uid)
{
return InspIRCd::FindUID(uid.c_str());
}
userrec *InspIRCd::FindUUID(const char *uid)
{
for (user_hash::const_iterator a = ServerInstance->clientlist->begin(); a != ServerInstance->clientlist->end(); a++)
{
userrec *u = a->second;
if (strcmp(u->uuid, uid) == 0
{
return u;
}
}
}
/* find a channel record by channel name and return a pointer to it */ /* find a channel record by channel name and return a pointer to it */
chanrec* InspIRCd::FindChan(const char* chan) chanrec* InspIRCd::FindChan(const char* chan)
{ {