The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Async::Matrix::Room - a single Matrix room

DESCRIPTION

An instances in this class are used by Net::Async::Matrix to represent a single Matrix room.

EVENTS

The following events are invoked, either using subclass methods or CODE references in parameters:

on_message $member, $content

Invoked on receipt of a new message from the given member.

on_member $member, %changes

Invoked when a member of the room changes state somehow. The $member object will already be in the new state. %changes will be a key/value list of state fields names that were changed, and references to 2-element ARRAYs containing the old and new values for this field.

METHODS

$id = $room->room_id

Returns the opaque room ID string for the room. Usually this would not be required, except for long-term persistence uniqueness purposes, or for inclusion in direct protocol URLs.

@members = $room->members

Returns a list of member structs containing the currently known members of the room, in no particular order.

$room->send_message( %args )->get

Sends a new message to the room. Requires a type named argument giving the message type. Depending on the type, further keys will be required that specify the message contents:

text, emote

Require body

image, audio, video

Require url

location

Require geo_uri

$room->send_message( $text )->get

A convenient shortcut to sending an text message with a body string and no additional content.

MEMBERSHIP STRUCTURES

Parameters documented as $member receive a membership struct, which supports the following methods:

$user = $member->user

User object of the member.

$displayname = $member->displayname

Profile displayname of the user.

$membership = $member->membership

Membership state. One of invite or join.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>