MCPcopy Create free account
hub / github.com/EQEmu/EQEmu / CheckNameFilter

Method CheckNameFilter

common/database.cpp:854–900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

852}
853
854bool Database::CheckNameFilter(const std::string& name, bool surname)
855{
856 // the minimum 4 is enforced by the client too
857 if (name.empty() || name.size() < 4) {
858 return false;
859 }
860
861 // Given name length is enforced by the client too
862 if (!surname && name.size() > 15) {
863 return false;
864 }
865
866 for (size_t i = 0; i < name.size(); i++) {
867 if (!isalpha(name[i])) {
868 return false;
869 }
870 }
871
872 char c = '\0';
873 uint8 num_c = 0;
874 for (size_t x = 0; x < name.size(); ++x) {
875 if (name[x] == c) {
876 num_c++;
877 } else {
878 num_c = 1;
879 c = name[x];
880 }
881
882 if (num_c > 2) {
883 return false;
884 }
885 }
886
887 const auto& l = NameFilterRepository::All(*this);
888
889 if (l.empty()) {
890 return true;
891 }
892
893 for (const auto& e : l) {
894 if (Strings::Contains(Strings::ToLower(name), Strings::ToLower(e.name))) {
895 return false;
896 }
897 }
898
899 return true;
900}
901
902bool Database::AddToNameFilter(const std::string& name)
903{

Callers 9

lua_check_name_filterFunction · 0.80
Perl__checknamefilterFunction · 0.80
ChangeFirstNameMethod · 0.80
ChangePetNameMethod · 0.80
QueryNameAvailabilityMethod · 0.80
GetRandomNameMethod · 0.80
Handle_OP_SurnameMethod · 0.80

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected