|
Radix Relay
Hybrid mesh communications with Signal Protocol encryption
|
Chain of Responsibility command parser. More...
#include <command_parser.hpp>
Public Types | |
| using | command_variant_t = std::variant< events::help, events::peers, events::status, events::sessions, events::identities, events::scan, events::version, events::mode, events::send, events::broadcast, events::connect, events::disconnect, events::publish_identity, events::unpublish_identity, events::trust, events::verify, events::chat, events::leave, events::unknown_command > |
| using | parse_result_t = std::optional< command_variant_t > |
| using | handler_t = std::function< parse_result_t(const std::string &)> |
Public Member Functions | |
| command_parser (std::shared_ptr< Bridge > bridge) | |
| auto | parse (const std::string &input) const -> command_variant_t |
| Parses a raw command string into a typed command event. | |
| auto | enter_chat_mode (const std::string &rdx_fingerprint) const -> void |
| Enters chat mode with the specified contact. | |
| auto | exit_chat_mode () const -> void |
| Exits chat mode. | |
| auto | in_chat_mode () const -> bool |
| Checks if currently in chat mode. | |
Chain of Responsibility command parser.
Parses raw command strings into strongly-typed command events. Defines its own variant type as a type trait so types and parsing always match. Uses unknown_command as fallback when no command matches. Manages chat mode state for preprocessing plain text as send commands.
| Bridge | Type satisfying the signal_bridge concept (for contact lookup) |
Definition at line 25 of file command_parser.hpp.
| using radix_relay::core::command_parser< Bridge >::command_variant_t = std::variant<events::help, events::peers, events::status, events::sessions, events::identities, events::scan, events::version, events::mode, events::send, events::broadcast, events::connect, events::disconnect, events::publish_identity, events::unpublish_identity, events::trust, events::verify, events::chat, events::leave, events::unknown_command> |
Definition at line 27 of file command_parser.hpp.
| using radix_relay::core::command_parser< Bridge >::handler_t = std::function<parse_result_t(const std::string &)> |
Definition at line 48 of file command_parser.hpp.
| using radix_relay::core::command_parser< Bridge >::parse_result_t = std::optional<command_variant_t> |
Definition at line 47 of file command_parser.hpp.
|
inlineexplicit |
Definition at line 50 of file command_parser.hpp.
|
inline |
Enters chat mode with the specified contact.
| rdx_fingerprint | The RDX fingerprint of the contact to chat with |
Definition at line 82 of file command_parser.hpp.
|
inline |
Exits chat mode.
Definition at line 87 of file command_parser.hpp.
|
inline |
Checks if currently in chat mode.
Definition at line 94 of file command_parser.hpp.
|
inline |
Parses a raw command string into a typed command event.
When in chat mode, plain text (not starting with /) is converted to a send command. The /leave command exits chat mode.
| input | Raw command string |
Definition at line 61 of file command_parser.hpp.
References radix_relay::core::events::unknown_command::input.