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 ReplaceEmotion(content string) string
- type ConvertedMessage
- type Formatter
- 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 *wechat.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) 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 *wechat.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 *wechat.GroupInfo, forceAvatarSync bool) bool
- func (p *Portal) UpdateMetadata(user *User, groupInfo *wechat.GroupInfo, forceAvatarSync bool) bool
- func (p *Portal) UpdateName(name string, setBy types.UID, updateInfo bool) bool
- func (p *Portal) UpdateRoomNickname(source *User, wxid string)
- func (p *Portal) UpdateTopic(topic string, setBy types.UID, updateInfo bool) bool
- type PortalMatrixMessage
- type PortalMessage
- type Puppet
- func (p *Puppet) ClearCustomMXID()
- 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) GetMXID() id.UserID
- func (p *Puppet) IntentFor(portal *Portal) *appservice.IntentAPI
- 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 ReplyInfo
- type User
- func (u *User) Connect() error
- func (u *User) DeleteConnection()
- func (u *User) DeleteSession()
- func (u *User) EnqueuePortalResync(portal *Portal)
- func (u *User) EnqueuePuppetResync(puppet *Puppet)
- func (u *User) GetCommandState() map[string]interface{}
- 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) LoginWtihQRCode() []byte
- func (u *User) MarkLogin()
- func (u *User) ResyncContacts(forceAvatarSync bool) error
- func (u *User) ResyncGroups(createPortals bool) error
- 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 WechatBridge
- func (br *WechatBridge) CreatePrivatePortal(roomID id.RoomID, brInviter bridge.User, brGhost bridge.Ghost)
- func (br *WechatBridge) FormatPuppetMXID(uid types.UID) id.UserID
- func (br *WechatBridge) GetAllIPortals() (iportals []bridge.Portal)
- func (br *WechatBridge) GetAllPortals() []*Portal
- func (br *WechatBridge) GetAllPortalsByUID(uid types.UID) []*Portal
- func (br *WechatBridge) GetAllPuppets() []*Puppet
- func (br *WechatBridge) GetAllPuppetsWithCustomMXID() []*Puppet
- func (br *WechatBridge) GetAllUsers() []*User
- func (br *WechatBridge) GetConfigPtr() interface{}
- func (br *WechatBridge) GetExampleConfig() string
- func (br *WechatBridge) GetIGhost(id id.UserID) bridge.Ghost
- func (br *WechatBridge) GetIPortal(mxid id.RoomID) bridge.Portal
- func (br *WechatBridge) GetIUser(userID id.UserID, create bool) bridge.User
- func (br *WechatBridge) GetPortalByMXID(mxid id.RoomID) *Portal
- func (br *WechatBridge) GetPortalByUID(key database.PortalKey) *Portal
- func (br *WechatBridge) GetPuppetByCustomMXID(mxid id.UserID) *Puppet
- func (br *WechatBridge) GetPuppetByMXID(mxid id.UserID) *Puppet
- func (br *WechatBridge) GetPuppetByUID(uid types.UID) *Puppet
- func (br *WechatBridge) GetUserByMXID(userID id.UserID) *User
- func (br *WechatBridge) GetUserByMXIDIfExists(userID id.UserID) *User
- func (br *WechatBridge) GetUserByUID(uid types.UID) *User
- func (br *WechatBridge) HandlePresence(evt *event.Event)
- func (br *WechatBridge) Init()
- func (br *WechatBridge) IsGhost(id id.UserID) bool
- func (br *WechatBridge) NewManualPortal(key database.PortalKey) *Portal
- func (br *WechatBridge) NewPortal(dbPortal *database.Portal) *Portal
- func (br *WechatBridge) NewPuppet(dbPuppet *database.Puppet) *Puppet
- func (br *WechatBridge) NewUser(dbUser *database.User) *User
- func (br *WechatBridge) ParsePuppetMXID(mxid id.UserID) (uid types.UID, ok bool)
- func (br *WechatBridge) RegisterCommands()
- func (br *WechatBridge) Start()
- func (br *WechatBridge) StartUsers()
- func (br *WechatBridge) Stop()
- type WrappedCommandEvent
Constants ¶
View Source
const ( WechatLoggedOut status.BridgeStateErrorCode = "wechat-logged-out" WechatNotConnected status.BridgeStateErrorCode = "wechat-not-connected" WechatConnecting status.BridgeStateErrorCode = "wechat-connecting" WechatConnectionFailed status.BridgeStateErrorCode = "wechat-connection-failed" )
View Source
const (
PrivateChatTopic = "WeChat 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 ( ErrStatusBroadcastDisabled = errors.New("status bridging is disabled") PortalCreationDummyEvent = event.Type{Type: "me.lxduo.wechat.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 ReplaceEmotion ¶
Types ¶
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 NewFormatter(br *WechatBridge) *Formatter
func (*Formatter) GetMatrixInfoByUID ¶
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) 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 ¶
type PortalMatrixMessage ¶
type PortalMatrixMessage struct {
// contains filtered or unexported fields
}
type PortalMessage ¶
type PortalMessage struct {
// contains filtered or unexported fields
}
type Puppet ¶
func (*Puppet) ClearCustomMXID ¶
func (p *Puppet) ClearCustomMXID()
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) 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 User ¶
type User struct { *database.User Client *wechat.WechatClient 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 (*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) LoginWtihQRCode ¶
func (*User) ResyncContacts ¶
func (*User) ResyncGroups ¶
func (*User) SetManagementRoom ¶
type WechatBridge ¶
type WechatBridge struct { bridge.Bridge Config *config.Config DB *database.Database Formatter *Formatter WechatService *wechat.WechatService ExampleConfig string // contains filtered or unexported fields }
func NewWechatBridge ¶
func NewWechatBridge(exampleConfig string) *WechatBridge
func (*WechatBridge) CreatePrivatePortal ¶
func (*WechatBridge) FormatPuppetMXID ¶
func (br *WechatBridge) FormatPuppetMXID(uid types.UID) id.UserID
func (*WechatBridge) GetAllIPortals ¶
func (br *WechatBridge) GetAllIPortals() (iportals []bridge.Portal)
func (*WechatBridge) GetAllPortals ¶
func (br *WechatBridge) GetAllPortals() []*Portal
func (*WechatBridge) GetAllPortalsByUID ¶
func (br *WechatBridge) GetAllPortalsByUID(uid types.UID) []*Portal
func (*WechatBridge) GetAllPuppets ¶
func (br *WechatBridge) GetAllPuppets() []*Puppet
func (*WechatBridge) GetAllPuppetsWithCustomMXID ¶
func (br *WechatBridge) GetAllPuppetsWithCustomMXID() []*Puppet
func (*WechatBridge) GetAllUsers ¶
func (br *WechatBridge) GetAllUsers() []*User
func (*WechatBridge) GetConfigPtr ¶
func (br *WechatBridge) GetConfigPtr() interface{}
func (*WechatBridge) GetExampleConfig ¶
func (br *WechatBridge) GetExampleConfig() string
func (*WechatBridge) GetIPortal ¶
func (br *WechatBridge) GetIPortal(mxid id.RoomID) bridge.Portal
func (*WechatBridge) GetPortalByMXID ¶
func (br *WechatBridge) GetPortalByMXID(mxid id.RoomID) *Portal
func (*WechatBridge) GetPortalByUID ¶
func (br *WechatBridge) GetPortalByUID(key database.PortalKey) *Portal
func (*WechatBridge) GetPuppetByCustomMXID ¶
func (br *WechatBridge) GetPuppetByCustomMXID(mxid id.UserID) *Puppet
func (*WechatBridge) GetPuppetByMXID ¶
func (br *WechatBridge) GetPuppetByMXID(mxid id.UserID) *Puppet
func (*WechatBridge) GetPuppetByUID ¶
func (br *WechatBridge) GetPuppetByUID(uid types.UID) *Puppet
func (*WechatBridge) GetUserByMXID ¶
func (br *WechatBridge) GetUserByMXID(userID id.UserID) *User
func (*WechatBridge) GetUserByMXIDIfExists ¶
func (br *WechatBridge) GetUserByMXIDIfExists(userID id.UserID) *User
func (*WechatBridge) GetUserByUID ¶
func (br *WechatBridge) GetUserByUID(uid types.UID) *User
func (*WechatBridge) HandlePresence ¶
func (br *WechatBridge) HandlePresence(evt *event.Event)
func (*WechatBridge) Init ¶
func (br *WechatBridge) Init()
func (*WechatBridge) NewManualPortal ¶
func (br *WechatBridge) NewManualPortal(key database.PortalKey) *Portal
func (*WechatBridge) NewPortal ¶
func (br *WechatBridge) NewPortal(dbPortal *database.Portal) *Portal
func (*WechatBridge) NewPuppet ¶
func (br *WechatBridge) NewPuppet(dbPuppet *database.Puppet) *Puppet
func (*WechatBridge) ParsePuppetMXID ¶
func (*WechatBridge) RegisterCommands ¶
func (br *WechatBridge) RegisterCommands()
func (*WechatBridge) Start ¶
func (br *WechatBridge) Start()
func (*WechatBridge) StartUsers ¶
func (br *WechatBridge) StartUsers()
func (*WechatBridge) Stop ¶
func (br *WechatBridge) Stop()
type WrappedCommandEvent ¶
type WrappedCommandEvent struct { *commands.Event Bridge *WechatBridge User *User Portal *Portal }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.