Protocol: normalize query rows and identity points
This commit is contained in:
1 parent
cb43116da6
commit
5c0c0c525f
3 files changed
+41
-13
No files matched your search
+7
-3
@@ -142,12 +142,16 @@ ParsedCommand parseCommand(const std::string &raw) {
|
||||
ParsedCommand out;
|
||||
std::string first{Void::Str::trim(parts[0])};
|
||||
|
||||
// The command name is the first whitespace-delimited token.
|
||||
// Notifications and protocol commands start with a command name, while
|
||||
// ServerQuery-style data replies are bare key=value records. Preserve the
|
||||
// first field of those replies instead of mistaking it for a command name.
|
||||
std::string body;
|
||||
auto sp = first.find(' ');
|
||||
if (sp == std::string::npos) {
|
||||
const auto firstToken = first.substr(0, sp);
|
||||
if (firstToken.find('=') != std::string::npos) {
|
||||
body = first;
|
||||
} else if (sp == std::string::npos) {
|
||||
out.name = tsUnescape(first);
|
||||
body = "";
|
||||
} else {
|
||||
out.name = tsUnescape(first.substr(0, sp));
|
||||
body = first.substr(sp + 1);
|
||||
|
||||
Reference in new issue
Block a user