Skip to main content

check_rules

Function check_rules 

Source
pub fn check_rules(
    pdu: &CanonicalJsonObject,
    rules: &EventFormatRules,
) -> Result
Expand description

Check that the given canonicalized PDU respects the event format of the room version and the size limits from the Matrix specification.

This is part of the checks performed on receipt of a PDU.

This checks the following and enforces their size limits:

  • Full PDU
  • sender
  • room_id
  • type
  • event_id
  • state_key
  • prev_events
  • auth_events
  • depth

Returns an Err(_) if the JSON is malformed or if the PDU doesn’t pass the checks.