msgconv

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: AGPL-3.0 Imports: 55 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 DirectMediaMeta added in v0.5.0

type DirectMediaMeta struct {
	MimeType string `json:"mime_type"`
	URL      string `json:"url"`
}

type DirectMediaWhatsApp added in v0.5.0

type DirectMediaWhatsApp struct {
	Key        []byte              `json:"key"`
	Type       whatsmeow.MediaType `json:"type"`
	SHA256     []byte              `json:"sha256"`
	EncSHA256  []byte              `json:"enc_sha256"`
	DirectPath string              `json:"direct_path"`
}

func (*DirectMediaWhatsApp) GetDirectPath added in v0.5.0

func (f *DirectMediaWhatsApp) GetDirectPath() string

func (*DirectMediaWhatsApp) GetFileEncSHA256 added in v0.5.0

func (f *DirectMediaWhatsApp) GetFileEncSHA256() []byte

func (*DirectMediaWhatsApp) GetFileSHA256 added in v0.5.0

func (f *DirectMediaWhatsApp) GetFileSHA256() []byte

func (*DirectMediaWhatsApp) GetMediaKey added in v0.5.0

func (f *DirectMediaWhatsApp) GetMediaKey() []byte

func (*DirectMediaWhatsApp) GetMediaType added in v0.5.0

func (f *DirectMediaWhatsApp) GetMediaType() whatsmeow.MediaType

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
	DirectMedia bool
}

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,
	messageID networkid.MessageID,
	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,
	otid int64,
	relaybotFormatted bool,
	portal *bridgev2.Portal,
) ([]socket.Task, 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,
	messageID networkid.MessageID,
	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