eventutil

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProfileNoExists = errors.New("no known profile for given user ID")

ErrProfileNoExists is returned when trying to lookup a user's profile that doesn't exist locally.

View Source
var ErrRoomNoExists = errors.New("room does not exist")

ErrRoomNoExists is returned when trying to lookup the state of a room that doesn't exist

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(redactionEvent, redactedEvent *gomatrixserverlib.Event) 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 AvatarURL

type AvatarURL struct {
	AvatarURL string `json:"avatar_url"`
}

AvatarURL is a struct containing only the URL to a user's 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 DisplayName

type DisplayName struct {
	DisplayName string `json:"displayname"`
}

DisplayName is a struct containing only a user's display name

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 added in v0.6.5

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 ProfileResponse

type ProfileResponse struct {
	AvatarURL   string `json:"avatar_url"`
	DisplayName string `json:"displayname"`
}

ProfileResponse is a struct containing all known user profile data

type ReadMarkerJSON added in v0.6.5

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

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 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