Skip to main content

cmd_dm

Function cmd_dm 

Source
pub async fn cmd_dm(
    recipient: &str,
    token: &str,
    content: &str,
    socket: Option<&Path>,
) -> Result<()>
Expand description

One-shot DM subcommand: compute canonical DM room ID, send message, exit.

Resolves the caller’s username from the token file, then computes the deterministic DM room ID (dm-<sorted_a>-<sorted_b>). Sends the message to that room’s broker socket. The DM room must already exist (room creation will be handled by E1-6 dynamic room creation).

Returns an error if the caller tries to DM themselves or if the DM room broker is not running.

socket overrides the default socket path (auto-discovered if None).