Net::Async::Matrix::Room::State - represents the state events in a matrix room
Instances of this class represent all of the known state events in a Net::Async::Matrix::Room at some instant in time. These objects are mutable so a "live" state object obtained from a room will change to keep track of newly received state events.
$event = $state->get_event( $type, $state_key )
Returns a HASH reference containing the raw event stored for the given type name and optional state key.
$events = $state->get_events( $type )
Returns a multi-level HASH reference mapping all of the known state keys for a given event type name to their raw stored events. Typically this is useful for m.room.member events as the state keys will be user IDs.
The following accessors all fetch single values out of certain events, as they are commonly used.
$name = $state->name
Returns the name field of the m.room.name event, if it exists.
$join_rule = $state->join_rule
Returns the join_rule field of the m.room.join_rules event, if it exists.
$topic = $state->topic
Returns the topic field of the m.room.topic event, if it exists.
@aliases = $state->aliases
Returns a list of the room alias from all the m.room.aliases events, in no particular order.
@members = $state->members
Returns a list of Member instances representing all of the members of the room from the m.room.member events whose membership state is not leave.
Similar to "members" but even includes members in leave state. This is not normally what you want.
$member = $state->member( $user_id )
Returns a Member instance representing a room member of the given user ID, or undef if none exists.
$level = $state->member_level( $user_id )
Returns a number indicating the power level that the given user ID would have according to room state, taken from the m.room.power_levels event. This takes into account the users_default field, if no specific level exists for the given user ID.
Paul Evans <email@example.com>
To install Net::Async::Matrix, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.