-
-
04 Apr 2017 15:31:03 UTC
- Distribution: Net-Async-Matrix
- Module version: 0.19
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (1)
- Testers (1005 / 0 / 0)
- Kwalitee
Bus factor: 1- 60.93% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (46.73KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Data::Dump
- Future::Utils
- IO::Async::Notifier
- JSON::MaybeXS
- List::Util
- Net::Async::HTTP
- POSIX
- String::Tagged
- Struct::Dumb
- URI
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Net::Async::Matrix::Room::State
- represents the state events in a matrix roomDESCRIPTION
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.
METHODS
get_event
$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.
get_events
$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.CONVENIENCE ACCESSORS
The following accessors all fetch single values out of certain events, as they are commonly used.
name
$name = $state->name
Returns the
name
field of them.room.name
event, if it exists.join_rule
$join_rule = $state->join_rule
Returns the
join_rule
field of them.room.join_rules
event, if it exists.topic
$topic = $state->topic
Returns the
topic
field of them.room.topic
event, if it exists.aliases
@aliases = $state->aliases
Returns a list of the room alias from all the
m.room.aliases
events, in no particular order.members
@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 notleave
.all_members
@members = $state->members
Similar to "members" but even includes members in
leave
state. This is not normally what you want.member
$member = $state->member( $user_id )
Returns a Member instance representing a room member of the given user ID, or
undef
if none exists.member_level
$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 theusers_default
field, if no specific level exists for the given user ID.AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
Module Install Instructions
To install Net::Async::Matrix, copy and paste the appropriate command in to your terminal.
cpanm Net::Async::Matrix
perl -MCPAN -e shell install Net::Async::Matrix
For more information on module installation, please visit the detailed CPAN module installation guide.