matrix

package
v0.35.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, cfg *config.Config, cred bridge.Credentials, eventChan chan *bridge.Event, onConnect func()) (bridge.Bridger, *matrixclient.Client, error)

Types

type Matrix

type Matrix struct {
	// contains filtered or unexported fields
}

func (*Matrix) AddReaction

func (m *Matrix) AddReaction(ctx context.Context, msgID, emoji string) error

func (*Matrix) BridgeConfig

func (m *Matrix) BridgeConfig() *config.BridgeConfig

func (*Matrix) Config

func (m *Matrix) Config() any

func (*Matrix) Connected

func (m *Matrix) Connected() bool

func (*Matrix) CreateChannel

func (m *Matrix) CreateChannel(ctx context.Context, channelName string, channelType string) (*bridge.ChannelInfo, error)

func (*Matrix) DeviceInfo

func (m *Matrix) DeviceInfo() (string, string)

DeviceInfo returns the device ID and Ed25519 fingerprint to verify this session manually from another client.

func (*Matrix) DeviceVerified

func (m *Matrix) DeviceVerified() (bool, error)

DeviceVerified reports whether this session is verified or cross-signed. A non-nil error means the state could not be determined.

func (*Matrix) EncryptionEnabled

func (m *Matrix) EncryptionEnabled() bool

EncryptionEnabled reports whether this session can use encrypted rooms.

func (*Matrix) FormatterConfig

func (m *Matrix) FormatterConfig() *config.FormatterConfig

func (*Matrix) GetChannel

func (m *Matrix) GetChannel(ctx context.Context, channelID string) (*bridge.ChannelInfo, error)

func (*Matrix) GetChannelCount

func (m *Matrix) GetChannelCount() int

func (*Matrix) GetChannelID

func (m *Matrix) GetChannelID(ctx context.Context, name, teamID string) string

func (*Matrix) GetChannelName

func (m *Matrix) GetChannelName(ctx context.Context, channelID string) string

func (*Matrix) GetChannelUsers

func (m *Matrix) GetChannelUsers(ctx context.Context, channelID string) ([]*bridge.UserInfo, error)

func (*Matrix) GetChannels

func (m *Matrix) GetChannels() []*bridge.ChannelInfo

func (*Matrix) GetDMChannelID

func (m *Matrix) GetDMChannelID(ctx context.Context, userID string) string

func (*Matrix) GetDMChannelName

func (m *Matrix) GetDMChannelName(userID1 string, userID2 string) string

GetDMChannelName returns the room ID, which GetChannelID resolves again.

func (*Matrix) GetDMOtherUserID

func (m *Matrix) GetDMOtherUserID(channelName, myUserID string) (string, bool)

func (*Matrix) GetDMUser

func (m *Matrix) GetDMUser(ctx context.Context, channelName string) *bridge.UserInfo

func (*Matrix) GetDMUserIDs

func (m *Matrix) GetDMUserIDs(channelName string) (string, string, bool)

func (*Matrix) GetFilesInfo

func (m *Matrix) GetFilesInfo(ctx context.Context, fileIDs []string) []*bridge.File

GetFilesInfo takes mxc:// URIs as file IDs.

func (*Matrix) GetLastSentMsgs

func (m *Matrix) GetLastSentMsgs() []string

func (*Matrix) GetLastViewedAt

func (m *Matrix) GetLastViewedAt(ctx context.Context, channelID string) int64

GetLastViewedAt returns the time of the event our read marker points to, 0 if unknown.

func (*Matrix) GetMe

func (m *Matrix) GetMe() *bridge.UserInfo

func (*Matrix) GetPostChannelID

func (m *Matrix) GetPostChannelID(ctx context.Context, postID string) string

func (*Matrix) GetPostSizeLimit

func (m *Matrix) GetPostSizeLimit() int

func (*Matrix) GetPostThread

func (m *Matrix) GetPostThread(ctx context.Context, postID string) []*bridge.Event

func (*Matrix) GetPosts

func (m *Matrix) GetPosts(ctx context.Context, channelID string, limit int) []*bridge.Event

func (*Matrix) GetPostsSince

func (m *Matrix) GetPostsSince(ctx context.Context, channelID string, since int64) []*bridge.Event

func (*Matrix) GetReplayEvents

func (m *Matrix) GetReplayEvents(ctx context.Context, channelID string, since int64) []*bridge.Event

func (*Matrix) GetSyncReplayEvents

func (m *Matrix) GetSyncReplayEvents(ctx context.Context, channelID string, since int64, reconnect bool) []*bridge.Event

GetSyncReplayEvents returns history for startup or reconnect channel sync. On reconnect, Matrix /sync already delivers missed events unless a room's timeline was truncated, so only truncated rooms fetch older history (from their prev_batch token), and events already queued via /sync are skipped.

func (*Matrix) GetTeamName

func (m *Matrix) GetTeamName(ctx context.Context, teamID string) string

func (*Matrix) GetUser

func (m *Matrix) GetUser(ctx context.Context, userID string) *bridge.UserInfo

func (*Matrix) GetUserByUsername

func (m *Matrix) GetUserByUsername(ctx context.Context, username string) *bridge.UserInfo

func (*Matrix) GetUserChannels

func (m *Matrix) GetUserChannels(ctx context.Context, userID string) ([]string, error)

func (*Matrix) GetUserCount

func (m *Matrix) GetUserCount() int

func (*Matrix) GetUsers

func (m *Matrix) GetUsers() []*bridge.UserInfo

func (*Matrix) HasCustomStatus

func (m *Matrix) HasCustomStatus(userID string) bool

func (*Matrix) Invite

func (m *Matrix) Invite(ctx context.Context, channelID, username string) error

func (*Matrix) IsChannelMember

func (m *Matrix) IsChannelMember(channelID string) bool

func (*Matrix) IsDMChannelName

func (m *Matrix) IsDMChannelName(channelName string) bool

func (*Matrix) IsOnline

func (m *Matrix) IsOnline(status string) bool

func (*Matrix) Join

func (m *Matrix) Join(ctx context.Context, channelName string) (string, string, error)

func (*Matrix) Kick

func (m *Matrix) Kick(ctx context.Context, channelID, username string) error

func (*Matrix) List

func (m *Matrix) List(ctx context.Context) (map[string]string, error)

func (*Matrix) Logout

func (m *Matrix) Logout(ctx context.Context) error

func (*Matrix) ModifyPost

func (m *Matrix) ModifyPost(ctx context.Context, msgID, text string) error

func (*Matrix) MsgChannel

func (m *Matrix) MsgChannel(ctx context.Context, channelID, text string) (string, error)

func (*Matrix) MsgChannelThread

func (m *Matrix) MsgChannelThread(ctx context.Context, channelID, parentID, text string) (string, error)

func (*Matrix) MsgUser

func (m *Matrix) MsgUser(ctx context.Context, userID, text string) (string, error)

func (*Matrix) MsgUserThread

func (m *Matrix) MsgUserThread(ctx context.Context, userID, parentID, text string) (string, error)

func (*Matrix) Nick

func (m *Matrix) Nick(ctx context.Context, name string) error

func (*Matrix) NickAllowsColon

func (m *Matrix) NickAllowsColon() bool

NickAllowsColon reports whether nicks may contain ':', so sanitizeNick must keep it.

func (*Matrix) NormalizePostID

func (m *Matrix) NormalizePostID(msgID string) string

func (*Matrix) OnEdit

func (m *Matrix) OnEdit(e *matrixclient.Edit)

OnEdit implements matrixclient.EditHandler.

func (*Matrix) OnInvite

func (m *Matrix) OnInvite(invite *matrixclient.Invitation)

OnInvite implements matrixclient.InviteHandler.

func (*Matrix) OnMember

func (m *Matrix) OnMember(c *matrixclient.MemberChange)

OnMember implements matrixclient.MemberHandler.

func (*Matrix) OnMessage

func (m *Matrix) OnMessage(msg *matrixclient.Message)

OnMessage implements matrixclient.Handler.

func (*Matrix) OnPin

func (m *Matrix) OnPin(p *matrixclient.PinChange)

OnPin implements matrixclient.PinHandler.

func (*Matrix) OnPresence

func (m *Matrix) OnPresence(p *matrixclient.PresenceChange)

OnPresence implements matrixclient.PresenceHandler.

func (*Matrix) OnReaction

func (m *Matrix) OnReaction(r *matrixclient.Reaction)

OnReaction implements matrixclient.Handler.

func (*Matrix) OnReconnect

func (m *Matrix) OnReconnect(downtime time.Duration)

OnReconnect implements matrixclient.ReconnectHandler.

func (*Matrix) OnReconnectInfo

func (m *Matrix) OnReconnectInfo(info matrixclient.ReconnectInfo)

OnReconnectInfo implements matrixclient.ReconnectInfoHandler.

func (*Matrix) OnRedaction

func (m *Matrix) OnRedaction(r *matrixclient.Redaction)

OnRedaction implements matrixclient.RedactionHandler.

func (*Matrix) OnRoomName

func (m *Matrix) OnRoomName(r *matrixclient.RoomRename)

OnRoomName implements matrixclient.RoomNameHandler.

func (*Matrix) OnTopic

func (m *Matrix) OnTopic(t *matrixclient.TopicChange)

OnTopic implements matrixclient.TopicHandler.

func (*Matrix) OnTyping

func (m *Matrix) OnTyping(t *matrixclient.Typing)

OnTyping implements matrixclient.TypingHandler.

func (*Matrix) OnVerification

func (m *Matrix) OnVerification(v *matrixclient.Verification)

OnVerification implements matrixclient.VerificationHandler. It must not block or call verification methods, as the engine may hold its transaction lock.

func (*Matrix) Part

func (m *Matrix) Part(ctx context.Context, channelID string) error

func (*Matrix) Ping

func (m *Matrix) Ping(ctx context.Context, proto ...string) error

func (*Matrix) Protocol

func (m *Matrix) Protocol() string

func (*Matrix) Ready

func (m *Matrix) Ready()

Ready implements matrixclient.Handler.

func (*Matrix) RemoveReaction

func (m *Matrix) RemoveReaction(ctx context.Context, msgID, emoji string) error

func (*Matrix) ReplayHidesHistory

func (m *Matrix) ReplayHidesHistory(channelID string) bool

ReplayHidesHistory reports whether replay can't show the history of a room: encrypted events aren't fetched, so marking the room read afterwards would acknowledge unseen messages.

func (*Matrix) SearchPosts

func (m *Matrix) SearchPosts(ctx context.Context, search string) []*bridge.Event

func (*Matrix) SearchUsers

func (m *Matrix) SearchUsers(ctx context.Context, query string) ([]*bridge.UserInfo, error)

func (*Matrix) SendTyping

func (m *Matrix) SendTyping(ctx context.Context, channelName string)

func (*Matrix) SetStatus

func (m *Matrix) SetStatus(ctx context.Context, status string) error

func (*Matrix) SetTopic

func (m *Matrix) SetTopic(ctx context.Context, channelID, text string) error

func (*Matrix) StatusUser

func (m *Matrix) StatusUser(ctx context.Context, userID string) (string, error)

func (*Matrix) StatusUsers

func (m *Matrix) StatusUsers(ctx context.Context) (map[string]string, error)

func (*Matrix) Topic

func (m *Matrix) Topic(ctx context.Context, channelID string) string

func (*Matrix) UpdateChannels

func (m *Matrix) UpdateChannels(ctx context.Context) error

func (*Matrix) UpdateLastViewed

func (m *Matrix) UpdateLastViewed(ctx context.Context, channelID string)

func (*Matrix) UpdateLastViewedUser

func (m *Matrix) UpdateLastViewedUser(ctx context.Context, userID string) error

func (*Matrix) UserDetails

func (m *Matrix) UserDetails(ctx context.Context, userID string) (string, bool)

UserDetails returns the avatar URL and whether the user is verified, for WHOIS.

func (*Matrix) Verify

func (m *Matrix) Verify(ctx context.Context, action, user string) (string, error)

Verify runs one verification step: start, accept, sas, confirm, mismatch or cancel. For start, a non-empty user verifies that user in a direct message room instead of this session. Progress and completion are reported as notices from OnVerification, not by the return value.

func (*Matrix) WaitReady

func (m *Matrix) WaitReady(ctx context.Context) bool

WaitReady blocks until the initial sync was processed, so the crypto store is up to date. It reports false when ctx or the bridge ends first.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL