noordstar/elm-matrix-sdk-beta/3.6.0

NOTE: the latest version is 3.6.1

Matrix.Invite

Invites

Sometimes, your user will be invited to a new room! This module offers you a few simple handles to deal with such invites - you can accept them, reject them or inspect them for further information.

Invitations

type alias Invite =
Invite

Invitation to a given room. This type represents contains all available information about the room.

{ invite : Invite
, reason : Maybe String
, toMsg : VaultUpdate -> msg
}
-> Cmd msg

Accept the invite. As a result, the user joins the room.

{ invite : Invite
, reason : Maybe String
, toMsg : VaultUpdate -> msg
}
-> Cmd msg

Reject the invite. As a result, the room is informed that the user has decided not to join. If the room is private, the user can no longer join until they receive a new invite.

Exploring invitations

Sometimes, you may want to display information about the room.

Be careful though, anyone can invite you to any room! This means that room invites may contain offensive, shocking or other unwanted content that the user may not want to see.

roomId : Invite -> String

Get the room id of the room that the user is invited to.

type alias InviteEvent =
InviteEvent

An InviteEvent is a state event that indicates the room's state.

This InviteEvent is more limited than the standard Event. It exclusively provides the information that is considered relevant for the invitation.

get :
{ eventType : String
, invite : Invite
, stateKey : String
}
-> Maybe InviteEvent

Get a specific state event. This allows you to generate a previes of the room. Do keep in mind that most servers do not give ALL state events, so you might not have access to some state events.

events : Invite -> List InviteEvent

Get a list of all shared state events in the invite.

Once you have the event you want, you can explore it with the following functions.

sender : InviteEvent -> User

Determines the user that has originally sent this event.

stateKey : InviteEvent -> String

Determines the state key of a state event.

eventType : InviteEvent -> String

Determines the content of a state event.

content : InviteEvent -> Value

Determines the content of an event.