msgconv

package
v0.4.3 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: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BypassOnionForMedia bool
View Source
var ErrTooLargeFile = bridgev2.WrapErrorInStatus(errors.New("too large file")).
	WithErrorAsMessage().WithSendNotice(true).WithErrorReason(event.MessageStatusUnsupported)
View Source
var ErrURLNotFound = errors.New("url not found")

Functions

func DownloadAvatar

func DownloadAvatar(ctx context.Context, url string) ([]byte, error)

func DownloadMedia

func DownloadMedia(ctx context.Context, mime, url string, maxSize int64) (int64, io.ReadCloser, error)

func SetProxy added in v0.4.1

func SetProxy(proxy string)

Types

type AttachmentMessage

type AttachmentMessage[Integral MediaTransportContainer, Ancillary any, Transport AttachmentTransport[Integral, Ancillary]] interface {
	Decode() (Transport, error)
}

type AttachmentMessageWithCaption

type AttachmentMessageWithCaption[Integral MediaTransportContainer, Ancillary any, Transport AttachmentTransport[Integral, Ancillary]] interface {
	GetCaption() *waCommon.MessageText
}

type AttachmentTransport

type AttachmentTransport[Integral MediaTransportContainer, Ancillary any] interface {
	GetIntegral() Integral
	GetAncillary() Ancillary
}

type MediaTransportContainer

type MediaTransportContainer interface {
	GetTransport() *waMediaTransport.WAMediaTransport
}

type MessageConverter

type MessageConverter struct {
	Bridge      *bridgev2.Bridge
	MaxFileSize int64
	AsyncFiles  bool
	BridgeMode  types.Platform
	HTMLParser  *format.HTMLParser
	DB          *metadb.MetaDB
}

func New

func (*MessageConverter) MetaToMatrixText

func (mc *MessageConverter) MetaToMatrixText(ctx context.Context, text string, rawMentions *socket.MentionData, portal *bridgev2.Portal) (content *event.MessageEventContent)

func (*MessageConverter) ShouldFetchXMA

func (mc *MessageConverter) ShouldFetchXMA(ctx context.Context) bool

func (*MessageConverter) TextToWhatsApp

func (mc *MessageConverter) TextToWhatsApp(content *event.MessageEventContent) *waCommon.MessageText

func (*MessageConverter) ToMatrix

func (mc *MessageConverter) ToMatrix(
	ctx context.Context,
	portal *bridgev2.Portal,
	client *messagix.Client,
	intent bridgev2.MatrixAPI,
	msg *table.WrappedMessage,
	disableXMA bool,
) *bridgev2.ConvertedMessage

func (*MessageConverter) ToMeta

func (mc *MessageConverter) ToMeta(
	ctx context.Context,
	client *messagix.Client,
	evt *event.Event,
	content *event.MessageEventContent,
	replyTo *database.Message,
	threadRoot *database.Message,
	relaybotFormatted bool,
	portal *bridgev2.Portal,
) ([]socket.Task, int64, error)

func (*MessageConverter) ToWhatsApp

func (*MessageConverter) WhatsAppTextToMatrix

func (mc *MessageConverter) WhatsAppTextToMatrix(ctx context.Context, text *waCommon.MessageText) *bridgev2.ConvertedMessagePart

func (*MessageConverter) WhatsAppToMatrix

func (mc *MessageConverter) WhatsAppToMatrix(ctx context.Context, portal *bridgev2.Portal, client *whatsmeow.Client, intent bridgev2.MatrixAPI, evt *events.FBMessage) *bridgev2.ConvertedMessage

type MetaMention

type MetaMention struct {
	Locator string
	Name    string
	UserID  int64
}

func NewMetaMention

func NewMetaMention(userID int64, name string) *MetaMention

type UTF16String

type UTF16String []uint16

func NewUTF16String

func NewUTF16String(s string) UTF16String

func (UTF16String) String

func (u UTF16String) String() string

Jump to

Keyboard shortcuts

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