msgconv

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownMsgType       = errors.New("unknown msgtype")
	ErrMediaDownloadFailed  = errors.New("failed to download media")
	ErrMediaUploadFailed    = errors.New("failed to reupload media")
	ErrMediaConvertFailed   = errors.New("failed to re-encode media")
	ErrMediaOnlyEditCaption = errors.New("only media message caption can be edited")
)

Functions

This section is empty.

Types

type ConvertedSlackMessage

type ConvertedSlackMessage struct {
	SendReq    slack.MsgOption
	FileUpload *slack.UploadFileV2Parameters
	FileShare  *slack.ShareFileParams
}

type MessageConverter

type MessageConverter struct {
	Bridge *bridgev2.Bridge
	HTTP   http.Client

	MatrixHTMLParser  *matrixfmt.HTMLParser
	SlackMrkdwnParser *mrkdwn.SlackMrkdwnParser

	ServerName  string
	MaxFileSize int
}

func New

func (*MessageConverter) EditToMatrix

func (mc *MessageConverter) EditToMatrix(
	ctx context.Context,
	portal *bridgev2.Portal,
	intent bridgev2.MatrixAPI,
	source *bridgev2.UserLogin,
	msg *slack.Msg,
	origMsg *slack.Msg,
	existing []*database.Message,
) *bridgev2.ConvertedEdit

func (*MessageConverter) GetMentionedRoomInfo

func (mc *MessageConverter) GetMentionedRoomInfo(ctx context.Context, channelID string) (mxid id.RoomID, alias id.RoomAlias, name string)

func (*MessageConverter) GetMentionedUserInfo

func (mc *MessageConverter) GetMentionedUserInfo(ctx context.Context, userID string) (mxid id.UserID, name string)

func (*MessageConverter) ToMatrix

func (mc *MessageConverter) ToMatrix(
	ctx context.Context,
	portal *bridgev2.Portal,
	intent bridgev2.MatrixAPI,
	source *bridgev2.UserLogin,
	msg *slack.Msg,
) *bridgev2.ConvertedMessage

func (*MessageConverter) ToSlack

func (mc *MessageConverter) ToSlack(
	ctx context.Context,
	client *slack.Client,
	portal *bridgev2.Portal,
	content *event.MessageEventContent,
	evt *event.Event,
	threadRoot *database.Message,
	editTarget *database.Message,
	origSender *bridgev2.OrigSender,
	isRealUser bool,
) (conv *ConvertedSlackMessage, err error)

type SlackClientProvider

type SlackClientProvider interface {
	GetClient() *slack.Client
	GetEmoji(context.Context, string) (string, bool)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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