send_targets.py 513 B

123456789101112
  1. """send_message declarations for the Matrix ``PlatformEntry`` (kept out of the adapter module)."""
  2. def _parse_send_target(ref):
  3. # "<room>:$<event_id>" addresses a thread (rfind: room ids contain ':'). Bare "!room" /
  4. # "@user" go via the generic rule so the numeric check keeps precedence.
  5. trimmed = ref.strip()
  6. split_idx = trimmed.rfind(":$")
  7. return (trimmed[:split_idx], trimmed[split_idx + 1:]) if split_idx > 0 else None
  8. SEND_ENTRY_KWARGS = {"target_ref_syntax_fn": _parse_send_target}