Documentation ¶
Index ¶
- Constants
- Variables
- func GetBytes(url string) ([]byte, error)
- func HTTPGetReadCloser(url string) (io.ReadCloser, error)
- func NewGzipReadCloser(reader io.ReadCloser) (io.ReadCloser, error)
- func RandomString(len int) string
- func RandomStringRange(length int, str string) string
- type BridgeStatus
- type ConvertedMessage
- type Formatter
- type PingData
- type Portal
- func (p *Portal) ChangeAdminStatus(uids []types.UID, setAdmin bool) id.EventID
- func (p *Portal) Cleanup(puppetsOnly bool)
- func (p *Portal) CleanupIfEmpty()
- func (p *Portal) CreateMatrixRoom(user *User, groupInfo *client.GroupInfo, isFullInfo bool) error
- func (p *Portal) Delete()
- func (p *Portal) GetBasePowerLevels() *event.PowerLevelsEventContent
- func (p *Portal) GetEncryptionEventContent() (evt *event.EncryptionEventContent)
- func (p *Portal) GetMatrixUsers() ([]id.UserID, error)
- func (p *Portal) GetUsers() []*User
- func (p *Portal) HandleMatrixInvite(brSender bridge.User, brTarget bridge.Ghost)
- func (p *Portal) HandleMatrixKick(brSender bridge.User, brTarget bridge.Ghost)
- func (p *Portal) HandleMatrixLeave(brSender bridge.User)
- func (p *Portal) HandleMatrixMessage(sender *User, evt *event.Event)
- func (p *Portal) HandleMatrixMeta(brSender bridge.User, evt *event.Event)
- func (p *Portal) HandleMatrixReaction(sender *User, evt *event.Event)
- func (p *Portal) HandleMatrixRedaction(sender *User, evt *event.Event)
- func (p *Portal) HandleQQGroupMemberInvite(source *User, senderUID types.UID, targetUID types.UID)
- func (p *Portal) HandleQQGroupMemberKick(source *User, senderUID types.UID, targetUID types.UID)
- func (p *Portal) HandleQQMessageRevoke(source *User, msgSeq int32, ts int64, operator int64)
- func (p *Portal) IsEncrypted() bool
- func (p *Portal) IsGroupChat() bool
- func (p *Portal) IsPrivateChat() bool
- func (p *Portal) MainIntent() *appservice.IntentAPI
- func (p *Portal) MarkEncrypted()
- func (p *Portal) ReceiveMatrixEvent(user bridge.User, evt *event.Event)
- func (p *Portal) RestrictMessageSending(restrict bool) id.EventID
- func (p *Portal) RestrictMetadataChanges(restrict bool) id.EventID
- func (p *Portal) SetReply(content *event.MessageEventContent, replyTo *ReplyInfo) bool
- func (p *Portal) SyncParticipants(source *User, metadata *client.GroupInfo, forceAvatarSync bool)
- func (p *Portal) UpdateAvatar(user *User, setBy types.UID, updateInfo bool) bool
- func (p *Portal) UpdateBridgeInfo()
- func (p *Portal) UpdateMatrixRoom(user *User, groupInfo *client.GroupInfo, forceAvatarSync bool) bool
- func (p *Portal) UpdateMetadata(user *User, groupInfo *client.GroupInfo, forceAvatarSync bool) bool
- func (p *Portal) UpdateName(name string, setBy types.UID, updateInfo bool) bool
- func (p *Portal) UpdateRoomNickname(info *client.GroupMemberInfo)
- func (p *Portal) UpdateTopic(topic string, setBy types.UID, updateInfo bool) bool
- type PortalMatrixMessage
- type PortalMessage
- type Puppet
- func (p *Puppet) CustomIntent() *appservice.IntentAPI
- func (p *Puppet) DefaultIntent() *appservice.IntentAPI
- func (p *Puppet) GetAvatarURL() id.ContentURI
- func (p *Puppet) GetDisplayname() string
- func (p *Puppet) GetFilterJSON(_ id.UserID) *mautrix.Filter
- func (p *Puppet) GetMXID() id.UserID
- func (p *Puppet) IntentFor(portal *Portal) *appservice.IntentAPI
- func (p *Puppet) LoadFilterID(_ id.UserID) string
- func (p *Puppet) LoadNextBatch(_ id.UserID) string
- func (p *Puppet) LoadRoom(_ id.RoomID) *mautrix.Room
- func (p *Puppet) OnFailedSync(_ *mautrix.RespSync, err error) (time.Duration, error)
- func (p *Puppet) ProcessResponse(resp *mautrix.RespSync, _ string) error
- func (p *Puppet) SaveFilterID(_ id.UserID, _ string)
- func (p *Puppet) SaveNextBatch(_ id.UserID, nbt string)
- func (p *Puppet) SaveRoom(_ *mautrix.Room)
- func (p *Puppet) StartCustomMXID(reloginOnFail bool) error
- func (p *Puppet) SwitchCustomMXID(accessToken string, mxid id.UserID) error
- func (p *Puppet) Sync(source *User, contact *types.ContactInfo, ...)
- func (p *Puppet) SyncContact(source *User, forceAvatarSync bool, reason string)
- func (p *Puppet) UpdateAvatar(source *User, forceAvatarSync bool, forcePortalSync bool) bool
- func (p *Puppet) UpdateName(contact types.ContactInfo, forcePortalSync bool) bool
- type QQBridge
- func (br *QQBridge) CreatePrivatePortal(roomID id.RoomID, brInviter bridge.User, brGhost bridge.Ghost)
- func (br *QQBridge) FormatPuppetMXID(uid types.UID) id.UserID
- func (br *QQBridge) GetAllIPortals() (iportals []bridge.Portal)
- func (br *QQBridge) GetAllPortals() []*Portal
- func (br *QQBridge) GetAllPortalsByUID(uid types.UID) []*Portal
- func (br *QQBridge) GetAllPuppets() []*Puppet
- func (br *QQBridge) GetAllPuppetsWithCustomMXID() []*Puppet
- func (br *QQBridge) GetAllUsers() []*User
- func (br *QQBridge) GetConfigPtr() interface{}
- func (br *QQBridge) GetExampleConfig() string
- func (br *QQBridge) GetIGhost(id id.UserID) bridge.Ghost
- func (br *QQBridge) GetIPortal(mxid id.RoomID) bridge.Portal
- func (br *QQBridge) GetIUser(userID id.UserID, create bool) bridge.User
- func (br *QQBridge) GetPortalByMXID(mxid id.RoomID) *Portal
- func (br *QQBridge) GetPortalByUID(key database.PortalKey) *Portal
- func (br *QQBridge) GetPuppetByCustomMXID(mxid id.UserID) *Puppet
- func (br *QQBridge) GetPuppetByMXID(mxid id.UserID) *Puppet
- func (br *QQBridge) GetPuppetByUID(uid types.UID) *Puppet
- func (br *QQBridge) GetUserByMXID(userID id.UserID) *User
- func (br *QQBridge) GetUserByMXIDIfExists(userID id.UserID) *User
- func (br *QQBridge) GetUserByUID(uid types.UID) *User
- func (br *QQBridge) GetUserByUin(uin string) *User
- func (br *QQBridge) HandlePresence(evt *event.Event)
- func (br *QQBridge) Init()
- func (br *QQBridge) IsGhost(id id.UserID) bool
- func (br *QQBridge) NewManualPortal(key database.PortalKey) *Portal
- func (br *QQBridge) NewPortal(dbPortal *database.Portal) *Portal
- func (br *QQBridge) NewPuppet(dbPuppet *database.Puppet) *Puppet
- func (br *QQBridge) NewUser(dbUser *database.User) *User
- func (br *QQBridge) ParsePuppetMXID(mxid id.UserID) (types.UID, bool)
- func (br *QQBridge) PingServer() (start, serverTs, end time.Time)
- func (br *QQBridge) RegisterCommands()
- func (br *QQBridge) RequestStartSync()
- func (br *QQBridge) SendBridgeStatus()
- func (br *QQBridge) Start()
- func (br *QQBridge) StartUsers()
- func (br *QQBridge) Stop()
- type ReplyInfo
- type Request
- type StartSyncRequest
- type User
- func (u *User) Connect() bool
- func (u *User) DeleteConnection()
- func (u *User) DeleteSession()
- func (u *User) EnqueuePortalResync(portal *Portal)
- func (u *User) EnqueuePuppetResync(puppet *Puppet)
- func (u *User) GetCommandState() *commands.CommandState
- func (user *User) GetIDoublePuppet() bridge.DoublePuppet
- func (user *User) GetIGhost() bridge.Ghost
- func (u *User) GetMXID() id.UserID
- func (u *User) GetManagementRoom() id.RoomID
- func (u *User) GetManagementRoomID() id.RoomID
- func (u *User) GetPermissionLevel() bridgeconfig.PermissionLevel
- func (u *User) GetPortalByUID(uid types.UID) *Portal
- func (user *User) GetRemoteID() string
- func (user *User) GetRemoteName() string
- func (u *User) GetSpaceRoom() id.RoomID
- func (u *User) IsLoggedIn() bool
- func (u *User) LoginPassword(uin int64, password string) (*client.LoginResponse, error)
- func (u *User) LoginQR() (<-chan *client.QRCodeLoginResponse, error)
- func (u *User) LoginToken(encodedDevice, encodedToken string) error
- func (u *User) MarkLogin()
- func (u *User) ResyncContacts(forceAvatarSync bool) error
- func (u *User) ResyncGroups(createPortals bool) error
- func (u *User) SetCommandState(s *commands.CommandState)
- func (u *User) SetManagementRoom(roomID id.RoomID)
- func (u *User) StartPM(uid types.UID, reason string) (*Portal, *Puppet, bool, error)
- func (u *User) UpdateDirectChats(chats map[id.UserID][]id.RoomID)
- type WebsocketCommandHandler
- type WrappedCommandEvent
Constants ¶
View Source
const ( QQLoggedOut status.BridgeStateErrorCode = "qq-logged-out" QQNotConnected status.BridgeStateErrorCode = "qq-not-connected" QQConnecting status.BridgeStateErrorCode = "qq-connecting" QQConnectionFailed status.BridgeStateErrorCode = "qq-connection-failed" )
View Source
const BridgeStatusConnected = "CONNECTED"
View Source
const DefaultSyncProxyBackoff = 1 * time.Second
View Source
const MaxSyncProxyBackoff = 60 * time.Second
View Source
const (
PrivateChatTopic = "QQ private chat"
)
Variables ¶
View Source
var ( HelpSectionConnectionManagement = commands.HelpSection{Name: "Connection management", Order: 11} HelpSectionCreatingPortals = commands.HelpSection{Name: "Creating portals", Order: 15} HelpSectionPortalManagement = commands.HelpSection{Name: "Portal management", Order: 20} HelpSectionInvites = commands.HelpSection{Name: "Group invites", Order: 25} HelpSectionMiscellaneous = commands.HelpSection{Name: "Miscellaneous", Order: 30} )
View Source
var ( ErrNoCustomMXID = errors.New("no custom mxid set") ErrMismatchingMXID = errors.New("whoami result does not match custom mxid") )
View Source
var ( ErrStatusBroadcastDisabled = errors.New("status bridging is disabled") PortalCreationDummyEvent = event.Type{Type: "me.lxduo.qq.dummy.portal_created", Class: event.MessageEventType} )
View Source
var (
ErrAlreadyLoggedIn = errors.New("already logged in")
)
View Source
var (
UserAgent = "" /* 130-byte string literal not displayed */
)
Functions ¶
func HTTPGetReadCloser ¶
func HTTPGetReadCloser(url string) (io.ReadCloser, error)
func NewGzipReadCloser ¶
func NewGzipReadCloser(reader io.ReadCloser) (io.ReadCloser, error)
func RandomString ¶
func RandomStringRange ¶
Types ¶
type BridgeStatus ¶
type BridgeStatus struct { StateEvent string `json:"state_event"` Timestamp int64 `json:"timestamp"` TTL int `json:"ttl"` Source string `json:"source"` Error string `json:"error,omitempty"` Message string `json:"message,omitempty"` UserID id.UserID `json:"user_id,omitempty"` RemoteID string `json:"remote_id,omitempty"` RemoteName string `json:"remote_name,omitempty"` Info map[string]interface{} `json:"info,omitempty"` }
type ConvertedMessage ¶
type ConvertedMessage struct { Intent *appservice.IntentAPI Type event.Type Content *event.MessageEventContent Extra map[string]interface{} Caption *event.MessageEventContent ReplyTo *ReplyInfo Error database.MessageErrorType MediaKey []byte }
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
func NewFormatter ¶
func (*Formatter) GetMatrixInfoByUID ¶
func (*Formatter) ParseMatrix ¶
func (f *Formatter) ParseMatrix(html string) []message.IMessageElement
type Portal ¶
func (*Portal) ChangeAdminStatus ¶
func (*Portal) CleanupIfEmpty ¶
func (p *Portal) CleanupIfEmpty()
func (*Portal) CreateMatrixRoom ¶
func (*Portal) GetBasePowerLevels ¶
func (p *Portal) GetBasePowerLevels() *event.PowerLevelsEventContent
func (*Portal) GetEncryptionEventContent ¶
func (p *Portal) GetEncryptionEventContent() (evt *event.EncryptionEventContent)
func (*Portal) HandleMatrixInvite ¶
func (*Portal) HandleMatrixKick ¶
func (*Portal) HandleMatrixLeave ¶
func (*Portal) HandleMatrixMessage ¶
func (*Portal) HandleMatrixMeta ¶
func (*Portal) HandleMatrixReaction ¶
func (*Portal) HandleMatrixRedaction ¶
func (*Portal) HandleQQGroupMemberInvite ¶
func (*Portal) HandleQQGroupMemberKick ¶
func (*Portal) HandleQQMessageRevoke ¶
func (*Portal) IsEncrypted ¶
func (*Portal) IsGroupChat ¶
func (*Portal) IsPrivateChat ¶
func (*Portal) MainIntent ¶
func (p *Portal) MainIntent() *appservice.IntentAPI
func (*Portal) MarkEncrypted ¶
func (p *Portal) MarkEncrypted()
func (*Portal) ReceiveMatrixEvent ¶
func (*Portal) RestrictMessageSending ¶
func (*Portal) RestrictMetadataChanges ¶
func (*Portal) SetReply ¶
func (p *Portal) SetReply(content *event.MessageEventContent, replyTo *ReplyInfo) bool
func (*Portal) SyncParticipants ¶
func (*Portal) UpdateAvatar ¶
func (*Portal) UpdateBridgeInfo ¶
func (p *Portal) UpdateBridgeInfo()
func (*Portal) UpdateMatrixRoom ¶
func (*Portal) UpdateMetadata ¶
func (*Portal) UpdateName ¶
func (*Portal) UpdateRoomNickname ¶
func (p *Portal) UpdateRoomNickname(info *client.GroupMemberInfo)
type PortalMatrixMessage ¶
type PortalMatrixMessage struct {
// contains filtered or unexported fields
}
type PortalMessage ¶
type PortalMessage struct {
// contains filtered or unexported fields
}
type Puppet ¶
func (*Puppet) CustomIntent ¶
func (p *Puppet) CustomIntent() *appservice.IntentAPI
func (*Puppet) DefaultIntent ¶
func (p *Puppet) DefaultIntent() *appservice.IntentAPI
func (*Puppet) GetAvatarURL ¶
func (p *Puppet) GetAvatarURL() id.ContentURI
func (*Puppet) GetDisplayname ¶
func (*Puppet) OnFailedSync ¶
func (*Puppet) ProcessResponse ¶
func (*Puppet) StartCustomMXID ¶
func (*Puppet) SwitchCustomMXID ¶
func (*Puppet) Sync ¶
func (p *Puppet) Sync(source *User, contact *types.ContactInfo, forceAvatarSync, forcePortalSync bool)
func (*Puppet) SyncContact ¶
func (*Puppet) UpdateAvatar ¶
func (*Puppet) UpdateName ¶
func (p *Puppet) UpdateName(contact types.ContactInfo, forcePortalSync bool) bool
type QQBridge ¶
type QQBridge struct { bridge.Bridge Config *config.Config DB *database.Database Formatter *Formatter ExampleConfig string WebsocketHandler *WebsocketCommandHandler // contains filtered or unexported fields }
func NewQQBridge ¶
func (*QQBridge) CreatePrivatePortal ¶
func (*QQBridge) GetAllIPortals ¶
func (*QQBridge) GetAllPortals ¶
func (*QQBridge) GetAllPortalsByUID ¶
func (*QQBridge) GetAllPuppets ¶
func (*QQBridge) GetAllPuppetsWithCustomMXID ¶
func (*QQBridge) GetAllUsers ¶
func (*QQBridge) GetConfigPtr ¶
func (br *QQBridge) GetConfigPtr() interface{}
func (*QQBridge) GetExampleConfig ¶
func (*QQBridge) GetPortalByUID ¶
func (*QQBridge) GetPuppetByCustomMXID ¶
func (*QQBridge) GetUserByMXIDIfExists ¶
func (*QQBridge) GetUserByUin ¶
func (*QQBridge) HandlePresence ¶
func (*QQBridge) NewManualPortal ¶
func (*QQBridge) ParsePuppetMXID ¶
func (*QQBridge) PingServer ¶
func (*QQBridge) RegisterCommands ¶
func (br *QQBridge) RegisterCommands()
func (*QQBridge) RequestStartSync ¶
func (br *QQBridge) RequestStartSync()
func (*QQBridge) SendBridgeStatus ¶
func (br *QQBridge) SendBridgeStatus()
func (*QQBridge) StartUsers ¶
func (br *QQBridge) StartUsers()
type Request ¶
type Request struct { Method string URL string Header map[string]string Limit int64 Body io.Reader }
Request is a file download request
type StartSyncRequest ¶
type User ¶
type User struct { *database.User Client *client.QQClient DeviceInfo *client.DeviceInfo Admin bool Whitelisted bool PermissionLevel bridgeconfig.PermissionLevel BridgeState *bridge.BridgeStateQueue // contains filtered or unexported fields }
func (*User) DeleteConnection ¶
func (u *User) DeleteConnection()
func (*User) DeleteSession ¶
func (u *User) DeleteSession()
func (*User) EnqueuePortalResync ¶
func (*User) EnqueuePuppetResync ¶
func (*User) GetCommandState ¶
func (u *User) GetCommandState() *commands.CommandState
func (*User) GetIDoublePuppet ¶
func (user *User) GetIDoublePuppet() bridge.DoublePuppet
func (*User) GetManagementRoom ¶
func (*User) GetManagementRoomID ¶
func (*User) GetPermissionLevel ¶
func (u *User) GetPermissionLevel() bridgeconfig.PermissionLevel
func (*User) GetRemoteID ¶
func (*User) GetRemoteName ¶
func (*User) GetSpaceRoom ¶
func (*User) IsLoggedIn ¶
func (*User) LoginPassword ¶
func (*User) LoginToken ¶
func (*User) ResyncContacts ¶
func (*User) ResyncGroups ¶
func (*User) SetCommandState ¶
func (u *User) SetCommandState(s *commands.CommandState)
func (*User) SetManagementRoom ¶
type WebsocketCommandHandler ¶
type WebsocketCommandHandler struct {
// contains filtered or unexported fields
}
func NewWebsocketCommandHandler ¶
func NewWebsocketCommandHandler(br *QQBridge) *WebsocketCommandHandler
func (*WebsocketCommandHandler) HandleSyncProxyError ¶
func (mx *WebsocketCommandHandler) HandleSyncProxyError(syncErr *mautrix.RespError, startErr error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.