diff --git a/CommandList.cpp b/CommandList.cpp index 9ec1e2e..0bffe34 100644 --- a/CommandList.cpp +++ b/CommandList.cpp @@ -8,6 +8,23 @@ namespace core { CommandList::CommandList(std::string delimiter, int depth) : delimiter(delimiter), depth(depth) {} void CommandList::add(Command &command, std::string name) { + // processRequest() below upper-cases the incoming keyword before + // looking it up, but this previously stored whatever case the + // caller passed in verbatim - any registration that wasn't + // already uppercase (nearly everything outside SMTP/POP3/IMAP's + // own RFC-driven uppercase convention) could then NEVER be + // matched by any input, since upper-casing a non-uppercase string + // can't produce a match against a non-uppercase key. Confirmed: + // this alone made every Zephora game command unreachable, along + // with this class's own base-level "publish"/"subscribe"/"event"/ + // etc. registrations (TCPServer's constructor). Folding the same + // way here keeps registration and lookup permanently in sync + // regardless of what case any given add() call happens to use - + // already-uppercase callers (SMTP, the BARANTMail admin console) + // are unaffected, since upper-casing an uppercase string is a + // no-op. + std::transform(name.begin(), name.end(), name.begin(), + [](unsigned char c) { return std::toupper(c); }); commands.insert(std::make_pair(name, &command)); }