chatLib

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgFailedThreshold = time.Minute * 5
	NoRightCodeNo      = -1
)
View Source
const (
	MMTTxt   = 1
	MMTImg   = 2
	MMTVoice = 3
	MMTLcl   = 4
	MMTFile  = 5
)

Variables

View Source
var (
	ErrNick   = fmt.Errorf("too short nick name")
	ErrAvatar = fmt.Errorf("nil avatar")
)
View Source
var (
	ErrWallet = fmt.Errorf("open wallet first please")
)

Functions

func AccountDetail added in v1.2.2

func AccountDetail(addr string) []byte

func AccountNonce added in v1.2.2

func AccountNonce(nonce int64)

func ActiveWallet

func ActiveWallet(cipherTxt, auth string) error

func AddFriend added in v1.2.2

func AddFriend(friAddr, alias, remark string) error

func AddGroupMembers added in v1.2.2

func AddGroupMembers(gid string, data []byte) (string, error)

func AllFriendIDs added in v1.2.2

func AllFriendIDs() []byte

func ChangeGroupName added in v1.2.2

func ChangeGroupName(gid, name string) (string, error)

func CreateGroup

func CreateGroup(name string, data []byte) (string, error)

func DecryptGroupPayload added in v1.2.2

func DecryptGroupPayload(from string, cryptKey, payload []byte) ([]byte, error)

func DecryptPeerPayload added in v1.2.2

func DecryptPeerPayload(peer string, payload []byte) ([]byte, error)

func DeleteFriend added in v1.2.2

func DeleteFriend(friAddr string) error

func DismissGroup added in v1.2.2

func DismissGroup(gid string) (string, error)

func FriendDetail added in v1.2.2

func FriendDetail(fid string) []byte

func GroupMeta added in v1.2.2

func GroupMeta(gid string) []byte

func GroupNonce added in v1.2.2

func GroupNonce(gid string, nonce int64)

func IconIndex

func IconIndex(id string, mod int) int64

func InitAPP

func InitAPP(endIP string,
	infura string,
	call UICallBack,
	devToken string,
	devType int,
	debug bool)

func IsValidNinjaAddr

func IsValidNinjaAddr(addr string) bool

func KickOutMembers added in v1.2.2

func KickOutMembers(gid string, data []byte) (string, error)

func LatestBlock added in v1.2.2

func LatestBlock() []byte

func NewWallet

func NewWallet(auth string) string

func QuitFromGroup added in v1.2.2

func QuitFromGroup(gid string) (string, error)

func Send added in v1.2.2

func Send(msgID int64, to string, data []byte, isGrp bool) ([]byte, error)

func SyncFriendWithDetails added in v1.2.2

func SyncFriendWithDetails() []byte

func SyncGroupIDs added in v1.2.2

func SyncGroupIDs() []byte

func SyncGroupWithDetails added in v1.2.2

func SyncGroupWithDetails() []byte

func TransferLicense

func TransferLicense(toAddr string, aMount int) error

func UnmarshalGoByte

func UnmarshalGoByte(s string) []byte

func UpdateAlias added in v1.2.2

func UpdateAlias(friAddr, alias string) error

func UpdateAvatar added in v1.2.2

func UpdateAvatar(avatar []byte) error

func UpdateNickName added in v1.2.2

func UpdateNickName(nick string) error

func UpdateRemark added in v1.2.2

func UpdateRemark(friAddr, remark string) error

func Version

func Version() string

func WSOffline

func WSOffline()

func WSOnline

func WSOnline() error

func WalletAddress added in v1.2.2

func WalletAddress() string

func WalletIsOpen

func WalletIsOpen() bool

func WrapFile added in v1.2.2

func WrapFile(n, s string, l int, c []byte) []byte

func WrapImg added in v1.2.2

func WrapImg(img []byte) []byte

func WrapLocation added in v1.2.2

func WrapLocation(n string, lo, la float64) []byte

func WrapTxt added in v1.2.2

func WrapTxt(s string) []byte

func WrapVoice added in v1.2.2

func WrapVoice(l int, c []byte) []byte

Types

type CacheItem added in v1.2.2

type CacheItem struct {
	ID int64
	// contains filtered or unexported fields
}

type File added in v1.2.2

type File struct {
	Name    string `json:"name"`
	Len     int    `json:"len"`
	Suffix  string `json:"suffix"`
	Content []byte `json:"content"`
}

type Image added in v1.2.2

type Image []byte

type Location added in v1.2.2

type Location struct {
	Name string  `json:"name"`
	Long float64 `json:"long"`
	Lat  float64 `json:"lat"`
}

type MobileAPP

type MobileAPP struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*MobileAPP) ImmediateMessage

func (a *MobileAPP) ImmediateMessage(msg *pbs.WSCryptoMsg) error

func (*MobileAPP) IsOnline added in v1.2.2

func (a *MobileAPP) IsOnline() bool

func (*MobileAPP) NoRightTips added in v1.2.2

func (a *MobileAPP) NoRightTips(tips *pbs.WSNoRightTips)

func (*MobileAPP) Online added in v1.2.2

func (a *MobileAPP) Online() error

func (*MobileAPP) OnlineSuccess

func (a *MobileAPP) OnlineSuccess()

func (*MobileAPP) WebSocketClosed

func (a *MobileAPP) WebSocketClosed()

type MsgMediaTyp added in v1.2.2

type MsgMediaTyp byte

type PlainTxt added in v1.2.2

type PlainTxt string

type UICallBack

type UICallBack interface {
	PeerIM(from string, decoded, payload []byte, time int64) error
	GrpIM(from, gid string, cryptKey, decoded, payload []byte, time int64) error
	WebSocketClosed()
	WebSocketDidOnline()
	GetMembersOfGroup(string) []byte
	NodeIPChanged(string)
	AccountUpdate([]byte)
	GroupUpdate([]byte)
	MsgResult(int64, string, bool)
}

type Voice added in v1.2.2

type Voice struct {
	Len     int    `json:"len"`
	Content []byte `json:"content"`
}

Jump to

Keyboard shortcuts

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