LobbyClient* ChatCommandParser::GetClientByName(const GUIString &theName, MatchResult *theResult) { MatchResult aResult = MatchResult_NotFound; LobbyClient *aMatchClient = NULL; if(mClientList!=NULL) { const LobbyClientMap &aMap = mClientList->GetClientMap(); LobbyClientMap::const_iterator anItr = aMap.begin(); for(; anItr!=aMap.end(); ++anItr) { LobbyClient *aClient = anItr->second; bool partialMatch = false; bool exactMatch = false; exactMatch = Compare(theName,aClient->GetName(),partialMatch); if(exactMatch) { if(aResult==MatchResult_Exact) { aResult = MatchResult_Ambiguous; break; } aResult = MatchResult_Exact; aMatchClient = aClient; } else if(partialMatch) { if(aResult==MatchResult_NotFound) { aResult = MatchResult_Partial; aMatchClient = anItr->second; } else if(aResult==MatchResult_Partial) { aResult = MatchResult_Ambiguous; break; } } } } if(aResult==MatchResult_NotFound || aResult==MatchResult_Ambiguous) aMatchClient = NULL; if(theResult!=NULL) *theResult = aResult; return aMatchClient; }