Net::Async::Matrix::Room::State - represents the state events in a matrix room
Net::Async::Matrix::Room::State
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.
m.room.member
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.
name
m.room.name
$join_rule = $state->join_rule
Returns the join_rule field of the m.room.join_rules event, if it exists.
join_rule
m.room.join_rules
$topic = $state->topic
Returns the topic field of the m.room.topic event, if it exists.
topic
m.room.topic
@aliases = $state->aliases
Returns a list of the room alias from all the m.room.aliases events, in no particular order.
m.room.aliases
@members = $state->members
Returns a list of Member instances representing all of the members of the room from the m.room.member events.
$member = $state->member( $user_id )
Returns a Member instance representing a room member of the given user ID, or undef if none exists.
undef
$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.
m.room.power_levels
users_default
Paul Evans <leonerd@leonerd.org.uk>
To install Net::Async::Matrix, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Async::Matrix
CPAN shell
perl -MCPAN -e shell install Net::Async::Matrix
For more information on module installation, please visit the detailed CPAN module installation guide.