#pragma once // TS3 command wire format: "commandname key=value key=value|key=value". // Ported from ts6-manager tslib/commands.ts. #include #include #include namespace Echoion::Protocol { // Escape / unescape a single token per the TS3 rules // (\\ \/ \s \p \f \n \r \t \v). std::string tsEscape(const std::string& str); std::string tsUnescape(const std::string& str); // Ordered key/value params for a command. std::map keeps a stable order so // serialization is deterministic (helpful for tests); the server does not // care about ordering. using CommandParams = std::map; struct ParsedCommand { std::string name; CommandParams params; // first group std::vector groups; // all '|'-separated groups }; // Serialize "name k=v k=v". Empty values are emitted as "k=". std::string buildCommand(const std::string& name, const CommandParams& params); // Parse a raw command / notify line into name + params (+ pipe groups). ParsedCommand parseCommand(const std::string& raw); } // namespace Echoion::Protocol