[Turn off line numbering]1: arg name; 2: var word, sname, matched_obj, m; 3: 4: // returns 1 if the name is valid 5: /// if (!.has_flag('variables,sender())) 6: // throw(~perm, "Database is not readable by sender."); 7: (> .perms(caller(), 'trusts) <); 8: 9: // check name itself first 10: sname = .strip_key(name); 11: if (max_word_len && listlen(name.explode()) > max_word_len) 12: throw(~invname, "Names can only be " + max_word_len + " words long."); 13: if (min_char_len && strlen(sname) < min_char_len) 14: throw(~invname, "Names must have at least " + min_char_len + " alpha-numeric characters in them"); 15: if (max_char_len && name.length() > max_char_len) 16: throw(~invname, "Names can only be " + max_char_len + " characters long."); 17: 18: // see if it already exists 19: if ((| (matched_obj = .exact_match(name)) |)) { 20: if (matched_obj != sender()) 21: throw(~invname, "The name \"" + name + "\" conflicts with the existing user \"" + matched_obj.name() + "\""); 22: } 23: 24: // check reserved and invalid names 25: if (sname in .reserved_names()) 26: throw(~invname, "`" + name + "' is a reserved name."); 27: if (invalid_names && (m = regexp(sname, invalid_names))) 28: throw(~invname, "`" + m[2] + "' is not allowed as part of a name.");
// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit