eventutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildEvent

BuildEvent builds a Matrix event from the builder and QueryLatestEventsAndStateResponse provided.

func InitialPowerLevelsContent

func InitialPowerLevelsContent(roomCreator string) (c gomatrixserverlib.PowerLevelContent)

InitialPowerLevelsContent returns the initial values for m.room.power_levels on room creation if they have not been specified. http://matrix.org/docs/spec/client_server/r0.2.0.html#m-room-power-levels https://github.com/matrix-org/synapse/blob/v0.19.2/synapse/handlers/room.py#L294

func QueryAndBuildEvent

QueryAndBuildEvent builds a Matrix event using the event builder and roomserver query API client provided. If also fills roomserver query API response (if provided) in case the function calling FillBuilder needs to use it. Returns ErrRoomNoExists if the state of the room could not be retrieved because the room doesn't exist Returns an error if something else went wrong

func RedactEvent

func RedactEvent(ctx context.Context, redactionEvent, redactedEvent gomatrixserverlib.PDU, querier api.QuerySenderIDAPI) error

RedactEvent redacts the given event and sets the unsigned field appropriately. This should be used by downstream components to the roomserver when an OutputTypeRedactedEvent occurs.

Types

type AccountData

type AccountData struct {
	RoomID       string              `json:"room_id"`
	Type         string              `json:"type"`
	ReadMarker   *ReadMarkerJSON     `json:"read_marker,omitempty"`   // optional
	IgnoredUsers *types.IgnoredUsers `json:"ignored_users,omitempty"` // optional
}

AccountData represents account data sent from the client API server to the sync API server

type AliasesContent

type AliasesContent struct {
	Aliases []string `json:"aliases"`
}

AliasesContent is the event content for http://matrix.org/docs/spec/client_server/r0.2.0.html#m-room-aliases

type AvatarContent

type AvatarContent struct {
	Info          ImageInfo `json:"info,omitempty"`
	URL           string    `json:"url"`
	ThumbnailURL  string    `json:"thumbnail_url,omitempty"`
	ThumbnailInfo ImageInfo `json:"thumbnail_info,omitempty"`
}

AvatarContent is the event content for http://matrix.org/docs/spec/client_server/r0.2.0.html#m-room-avatar

type CanonicalAlias

type CanonicalAlias struct {
	Alias string `json:"alias"`
}

CanonicalAlias is the event content for https://matrix.org/docs/spec/client_server/r0.6.0#m-room-canonical-alias

type CanonicalAliasContent

type CanonicalAliasContent struct {
	Alias string `json:"alias"`
}

CanonicalAliasContent is the event content for http://matrix.org/docs/spec/client_server/r0.2.0.html#m-room-canonical-alias

type ErrRoomNoExists

type ErrRoomNoExists struct{}

func (ErrRoomNoExists) Error

func (e ErrRoomNoExists) Error() string

func (ErrRoomNoExists) Unwrap

func (e ErrRoomNoExists) Unwrap() error

type GuestAccessContent

type GuestAccessContent struct {
	GuestAccess string `json:"guest_access"`
}

GuestAccessContent is the event content for https://matrix.org/docs/spec/client_server/r0.2.0.html#m-room-guest-access

type HistoryVisibilityContent

type HistoryVisibilityContent struct {
	HistoryVisibility string `json:"history_visibility"`
}

HistoryVisibilityContent is the event content for http://matrix.org/docs/spec/client_server/r0.2.0.html#m-room-history-visibility

type ImageInfo

type ImageInfo struct {
	Mimetype string `json:"mimetype"`
	Height   int64  `json:"h"`
	Width    int64  `json:"w"`
	Size     int64  `json:"size"`
}

ImageInfo implements the ImageInfo structure from http://matrix.org/docs/spec/client_server/r0.2.0.html#m-room-avatar

type NameContent

type NameContent struct {
	Name string `json:"name"`
}

NameContent is the event content for https://matrix.org/docs/spec/client_server/r0.2.0.html#m-room-name

type NotificationData

type NotificationData struct {
	// RoomID identifies the scope of the statistics, together with
	// MXID (which is encoded in the Kafka key).
	RoomID string `json:"room_id"`

	// HighlightCount is the number of unread notifications with the
	// highlight tweak.
	UnreadHighlightCount int `json:"unread_highlight_count"`

	// UnreadNotificationCount is the total number of unread
	// notifications.
	UnreadNotificationCount int `json:"unread_notification_count"`
}

NotificationData contains statistics about notifications, sent from the Push Server to the Sync API server.

type ReadMarkerJSON

type ReadMarkerJSON struct {
	FullyRead   string `json:"m.fully_read"`
	Read        string `json:"m.read"`
	ReadPrivate string `json:"m.read.private"`
}

type TopicContent

type TopicContent struct {
	Topic string `json:"topic"`
}

TopicContent is the event content for https://matrix.org/docs/spec/client_server/r0.2.0.html#m-room-topic

type UserProfile

type UserProfile struct {
	AvatarURL   string `json:"avatar_url,omitempty"`
	DisplayName string `json:"displayname,omitempty"`
}

UserProfile is a struct containing all known user profile data

type WeakBoolean

type WeakBoolean bool

WeakBoolean is a type that will Unmarshal to true or false even if the encoded representation is "true"/1 or "false"/0, as well as whatever other forms are recognised by strconv.ParseBool

func (*WeakBoolean) UnmarshalJSON

func (b *WeakBoolean) UnmarshalJSON(data []byte) error

UnmarshalJSON is overridden here to allow strings vaguely representing a true or false boolean to be set as their closest counterpart

Jump to

Keyboard shortcuts

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