connector

package
v0.2.0 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: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LoginStepIDCookies  = "fi.mau.twitter.login.enter_cookies"
	LoginStepIDComplete = "fi.mau.twitter.login.complete"
)
View Source
var ExampleConfig string

Functions

func RemoveEntityLinkFromText

func RemoveEntityLinkFromText(msgPart *bridgev2.ConvertedMessagePart, indices []int)

func XMDFromEventMessage

func XMDFromEventMessage(eventMessage *event.XEventMessage) *types.MessageData

Types

type Config

type Config struct {
	Proxy       string `yaml:"proxy"`
	GetProxyURL string `yaml:"get_proxy_url"`

	DisplaynameTemplate string `yaml:"displayname_template"`

	ConversationSyncLimit int `yaml:"conversation_sync_limit"`
	// contains filtered or unexported fields
}

func (*Config) FormatDisplayname

func (c *Config) FormatDisplayname(username string, displayname string) string

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(node *yaml.Node) error

type DisplaynameParams

type DisplaynameParams struct {
	Username    string
	DisplayName string
}

type PushKeys

type PushKeys struct {
	P256DH  []byte `json:"p256dh"`
	Auth    []byte `json:"auth"`
	Private []byte `json:"private"`
}

type TwitterClient

type TwitterClient struct {
	// contains filtered or unexported fields
}

func NewTwitterClient

func NewTwitterClient(ctx context.Context, tc *TwitterConnector, login *bridgev2.UserLogin) *TwitterClient

func (*TwitterClient) Connect

func (tc *TwitterClient) Connect(ctx context.Context)

func (*TwitterClient) ConversationToChatInfo

func (tc *TwitterClient) ConversationToChatInfo(conv *types.Conversation) *bridgev2.ChatInfo

func (*TwitterClient) ConversationTypeToRoomType

func (tc *TwitterClient) ConversationTypeToRoomType(convType types.ConversationType) *database.RoomType

func (*TwitterClient) Disconnect

func (tc *TwitterClient) Disconnect()

func (*TwitterClient) FetchMessages

func (*TwitterClient) GetCapabilities

func (*TwitterClient) GetChatInfo

func (tc *TwitterClient) GetChatInfo(_ context.Context, portal *bridgev2.Portal) (*bridgev2.ChatInfo, error)

func (*TwitterClient) GetCurrentUser

func (tc *TwitterClient) GetCurrentUser() (user *types.User, err error)

func (*TwitterClient) GetPushConfigs

func (tc *TwitterClient) GetPushConfigs() *bridgev2.PushConfig

func (*TwitterClient) GetUserInfo

func (tc *TwitterClient) GetUserInfo(_ context.Context, ghost *bridgev2.Ghost) (*bridgev2.UserInfo, error)

func (*TwitterClient) GetUserInfoBridge

func (tc *TwitterClient) GetUserInfoBridge(userID string) *bridgev2.UserInfo

func (*TwitterClient) HandleMatrixEdit

func (tc *TwitterClient) HandleMatrixEdit(_ context.Context, edit *bridgev2.MatrixEdit) error

func (*TwitterClient) HandleMatrixMessage

func (tc *TwitterClient) HandleMatrixMessage(ctx context.Context, msg *bridgev2.MatrixMessage) (message *bridgev2.MatrixMessageResponse, err error)

func (*TwitterClient) HandleMatrixReaction

func (tc *TwitterClient) HandleMatrixReaction(_ context.Context, msg *bridgev2.MatrixReaction) (reaction *database.Reaction, err error)

func (*TwitterClient) HandleMatrixReactionRemove

func (tc *TwitterClient) HandleMatrixReactionRemove(_ context.Context, msg *bridgev2.MatrixReactionRemove) error

func (*TwitterClient) HandleMatrixReadReceipt

func (tc *TwitterClient) HandleMatrixReadReceipt(ctx context.Context, msg *bridgev2.MatrixReadReceipt) error

func (*TwitterClient) HandleMatrixTyping

func (tc *TwitterClient) HandleMatrixTyping(_ context.Context, msg *bridgev2.MatrixTyping) error

func (*TwitterClient) HandleTwitterEvent

func (tc *TwitterClient) HandleTwitterEvent(rawEvt any)

func (*TwitterClient) IsLoggedIn

func (tc *TwitterClient) IsLoggedIn() bool

func (*TwitterClient) IsThisUser

func (tc *TwitterClient) IsThisUser(_ context.Context, userID networkid.UserID) bool

func (*TwitterClient) LogoutRemote

func (tc *TwitterClient) LogoutRemote(ctx context.Context)

func (*TwitterClient) MakeAvatar

func (tc *TwitterClient) MakeAvatar(avatarURL string) *bridgev2.Avatar

func (*TwitterClient) MakePortalKey

func (tc *TwitterClient) MakePortalKey(conv types.Conversation) networkid.PortalKey

func (*TwitterClient) MakePortalKeyFromID

func (tc *TwitterClient) MakePortalKeyFromID(conversationID string) networkid.PortalKey

func (*TwitterClient) ParticipantToChatMember

func (tc *TwitterClient) ParticipantToChatMember(participant types.Participant, isFromMe bool) bridgev2.ChatMember

func (*TwitterClient) ParticipantsToMemberList

func (tc *TwitterClient) ParticipantsToMemberList(participants []types.Participant) *bridgev2.ChatMemberList

func (*TwitterClient) PreHandleMatrixReaction

func (*TwitterClient) RegisterPushNotifications

func (tc *TwitterClient) RegisterPushNotifications(ctx context.Context, pushType bridgev2.PushType, token string) error

func (*TwitterClient) ResolveIdentifier

func (tc *TwitterClient) ResolveIdentifier(ctx context.Context, identifier string, startChat bool) (*bridgev2.ResolveIdentifierResponse, error)

func (*TwitterClient) TwitterAttachmentToMatrix

func (tc *TwitterClient) TwitterAttachmentToMatrix(ctx context.Context, portal *bridgev2.Portal, intent bridgev2.MatrixAPI, attachment *types.Attachment) (*bridgev2.ConvertedMessagePart, []int, error)

func (*TwitterClient) UserToChatMember

func (tc *TwitterClient) UserToChatMember(user types.User, isFromMe bool) bridgev2.ChatMember

func (*TwitterClient) UsersToMemberList

func (tc *TwitterClient) UsersToMemberList(users []types.User) *bridgev2.ChatMemberList

type TwitterConnector

type TwitterConnector struct {
	Config Config
	// contains filtered or unexported fields
}

func (*TwitterConnector) CreateLogin

func (tc *TwitterConnector) CreateLogin(_ context.Context, user *bridgev2.User, flowID string) (bridgev2.LoginProcess, error)

func (*TwitterConnector) GetCapabilities

func (tc *TwitterConnector) GetCapabilities() *bridgev2.NetworkGeneralCapabilities

func (*TwitterConnector) GetConfig

func (tc *TwitterConnector) GetConfig() (string, any, up.Upgrader)

func (*TwitterConnector) GetDBMetaTypes

func (tc *TwitterConnector) GetDBMetaTypes() database.MetaTypes

func (*TwitterConnector) GetLoginFlows

func (tc *TwitterConnector) GetLoginFlows() []bridgev2.LoginFlow

func (*TwitterConnector) GetName

func (tc *TwitterConnector) GetName() bridgev2.BridgeName

func (*TwitterConnector) Init

func (tc *TwitterConnector) Init(bridge *bridgev2.Bridge)

func (*TwitterConnector) LoadUserLogin

func (tc *TwitterConnector) LoadUserLogin(ctx context.Context, login *bridgev2.UserLogin) error

func (*TwitterConnector) Start

func (tc *TwitterConnector) Start(_ context.Context) error

type TwitterLogin

type TwitterLogin struct {
	User    *bridgev2.User
	Cookies string
	// contains filtered or unexported fields
}

func (*TwitterLogin) Cancel

func (t *TwitterLogin) Cancel()

func (*TwitterLogin) Start

func (*TwitterLogin) SubmitCookies

func (t *TwitterLogin) SubmitCookies(ctx context.Context, cookies map[string]string) (*bridgev2.LoginStep, error)

type UserLoginMetadata

type UserLoginMetadata struct {
	Cookies  string    `json:"cookies"`
	PushKeys *PushKeys `json:"push_keys,omitempty"`
}

func (*UserLoginMetadata) GeneratePushKeys

func (m *UserLoginMetadata) GeneratePushKeys()

Jump to

Keyboard shortcuts

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