mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 02:57:40 +08:00
all: rewrite interface{} to any
generated by `gofmt -w -r 'interface{} -> any' .`
This commit is contained in:
parent
ea0237538a
commit
4a007cfcf9
@ -99,7 +99,7 @@ func TestJceReader_ReadBytes(t *testing.T) {
|
||||
assert.Equal(t, b, rb)
|
||||
}
|
||||
|
||||
func (w *JceWriter) WriteObject(i interface{}, tag byte) {
|
||||
func (w *JceWriter) WriteObject(i any, tag byte) {
|
||||
t := reflect.TypeOf(i)
|
||||
if t.Kind() == reflect.Map {
|
||||
w.WriteMap(i, tag)
|
||||
@ -192,7 +192,7 @@ type decoder struct {
|
||||
var decoderCache = sync.Map{}
|
||||
|
||||
// WriteJceStructRaw 写入 Jce 结构体
|
||||
func (w *JceWriter) WriteJceStructRaw(s interface{}) {
|
||||
func (w *JceWriter) WriteJceStructRaw(s any) {
|
||||
t := reflect.TypeOf(s)
|
||||
if t.Kind() != reflect.Ptr {
|
||||
return
|
||||
@ -234,7 +234,7 @@ func (w *JceWriter) WriteJceStruct(s IJceStruct, tag byte) {
|
||||
w.writeHead(11, 0)
|
||||
}
|
||||
|
||||
func (w *JceWriter) WriteSlice(i interface{}, tag byte) {
|
||||
func (w *JceWriter) WriteSlice(i any, tag byte) {
|
||||
va := reflect.ValueOf(i)
|
||||
if va.Kind() != reflect.Slice {
|
||||
panic("JceWriter.WriteSlice: not a slice")
|
||||
@ -270,7 +270,7 @@ func (w *JceWriter) WriteJceStructSlice(l []IJceStruct, tag byte) {
|
||||
}
|
||||
}
|
||||
|
||||
func (w *JceWriter) WriteMap(m interface{}, tag byte) {
|
||||
func (w *JceWriter) WriteMap(m any, tag byte) {
|
||||
va := reflect.ValueOf(m)
|
||||
if va.Kind() != reflect.Map {
|
||||
panic("JceWriter.WriteMap: not a map")
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
var bufferPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
New: func() any {
|
||||
return new(Writer)
|
||||
},
|
||||
}
|
||||
@ -32,7 +32,7 @@ func PutWriter(w *Writer) {
|
||||
}
|
||||
|
||||
var gzipPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
New: func() any {
|
||||
buf := new(bytes.Buffer)
|
||||
w := gzip.NewWriter(buf)
|
||||
return &GzipWriter{
|
||||
@ -64,7 +64,7 @@ type zlibWriter struct {
|
||||
}
|
||||
|
||||
var zlibPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
New: func() any {
|
||||
buf := new(bytes.Buffer)
|
||||
w := zlib.NewWriter(buf)
|
||||
return &zlibWriter{
|
||||
|
@ -118,7 +118,7 @@ func ToChunkedBytesF(b []byte, size int, f func([]byte)) {
|
||||
}
|
||||
}
|
||||
|
||||
func ToBytes(i interface{}) []byte {
|
||||
func ToBytes(i any) []byte {
|
||||
return NewWriterF(func(w *Writer) {
|
||||
// TODO: more types
|
||||
switch t := i.(type) {
|
||||
|
@ -132,7 +132,7 @@ type QiDianAccountInfo struct {
|
||||
}
|
||||
|
||||
type handlerInfo struct {
|
||||
fun func(i interface{}, err error)
|
||||
fun func(i any, err error)
|
||||
dynamic bool
|
||||
params network.RequestParams
|
||||
}
|
||||
@ -144,7 +144,7 @@ func (h *handlerInfo) getParams() network.RequestParams {
|
||||
return h.params
|
||||
}
|
||||
|
||||
var decoders = map[string]func(*QQClient, *network.IncomingPacketInfo, []byte) (interface{}, error){
|
||||
var decoders = map[string]func(*QQClient, *network.IncomingPacketInfo, []byte) (any, error){
|
||||
"wtlogin.login": decodeLoginResponse,
|
||||
"wtlogin.exchange_emp": decodeExchangeEmpResponse,
|
||||
"wtlogin.trans_emp": decodeTransEmpResponse,
|
||||
@ -435,10 +435,10 @@ func (c *QQClient) init(tokenLogin bool) error {
|
||||
}
|
||||
if tokenLogin {
|
||||
notify := make(chan struct{})
|
||||
d := c.waitPacket("StatSvc.ReqMSFOffline", func(i interface{}, err error) {
|
||||
d := c.waitPacket("StatSvc.ReqMSFOffline", func(i any, err error) {
|
||||
notify <- struct{}{}
|
||||
})
|
||||
d2 := c.waitPacket("MessageSvc.PushForceOffline", func(i interface{}, err error) {
|
||||
d2 := c.waitPacket("MessageSvc.PushForceOffline", func(i any, err error) {
|
||||
notify <- struct{}{}
|
||||
})
|
||||
select {
|
||||
@ -673,7 +673,7 @@ func (c *QQClient) FindGroup(code int64) *GroupInfo {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *QQClient) SolveGroupJoinRequest(i interface{}, accept, block bool, reason string) {
|
||||
func (c *QQClient) SolveGroupJoinRequest(i any, accept, block bool, reason string) {
|
||||
if accept {
|
||||
block = false
|
||||
reason = ""
|
||||
|
@ -31,7 +31,7 @@ var (
|
||||
)
|
||||
|
||||
// wtlogin.login
|
||||
func decodeLoginResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeLoginResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
reader := binary.NewReader(payload)
|
||||
reader.ReadUInt16() // sub command
|
||||
t := reader.ReadByte()
|
||||
@ -179,7 +179,7 @@ func decodeLoginResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []b
|
||||
}
|
||||
|
||||
// StatSvc.register
|
||||
func decodeClientRegisterResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeClientRegisterResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -196,7 +196,7 @@ func decodeClientRegisterResponse(c *QQClient, _ *network.IncomingPacketInfo, pa
|
||||
}
|
||||
|
||||
// wtlogin.exchange_emp
|
||||
func decodeExchangeEmpResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeExchangeEmpResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
reader := binary.NewReader(payload)
|
||||
cmd := reader.ReadUInt16()
|
||||
t := reader.ReadByte()
|
||||
@ -216,7 +216,7 @@ func decodeExchangeEmpResponse(c *QQClient, _ *network.IncomingPacketInfo, paylo
|
||||
}
|
||||
|
||||
// wtlogin.trans_emp
|
||||
func decodeTransEmpResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeTransEmpResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
if len(payload) < 48 {
|
||||
return nil, errors.New("missing payload length")
|
||||
}
|
||||
@ -299,7 +299,7 @@ func decodeTransEmpResponse(c *QQClient, _ *network.IncomingPacketInfo, payload
|
||||
}
|
||||
|
||||
// ConfigPushSvc.PushReq
|
||||
func decodePushReqPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodePushReqPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -372,7 +372,7 @@ func decodePushReqPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []b
|
||||
}
|
||||
|
||||
// MessageSvc.PbGetMsg
|
||||
func decodeMessageSvcPacket(c *QQClient, info *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeMessageSvcPacket(c *QQClient, info *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := msg.GetMessageResponse{}
|
||||
err := proto.Unmarshal(payload, &rsp)
|
||||
if err != nil {
|
||||
@ -383,7 +383,7 @@ func decodeMessageSvcPacket(c *QQClient, info *network.IncomingPacketInfo, paylo
|
||||
}
|
||||
|
||||
// MessageSvc.PushNotify
|
||||
func decodeSvcNotify(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeSvcNotify(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload[4:]))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -410,7 +410,7 @@ func decodeSvcNotify(c *QQClient, _ *network.IncomingPacketInfo, payload []byte)
|
||||
}
|
||||
|
||||
// SummaryCard.ReqSummaryCard
|
||||
func decodeSummaryCardResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeSummaryCardResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -458,7 +458,7 @@ func decodeSummaryCardResponse(_ *QQClient, _ *network.IncomingPacketInfo, paylo
|
||||
}
|
||||
|
||||
// friendlist.getFriendGroupList
|
||||
func decodeFriendGroupListResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeFriendGroupListResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion3{}
|
||||
@ -483,7 +483,7 @@ func decodeFriendGroupListResponse(_ *QQClient, _ *network.IncomingPacketInfo, p
|
||||
}
|
||||
|
||||
// friendlist.delFriend
|
||||
func decodeFriendDeleteResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeFriendDeleteResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion3{}
|
||||
@ -496,7 +496,7 @@ func decodeFriendDeleteResponse(_ *QQClient, _ *network.IncomingPacketInfo, payl
|
||||
}
|
||||
|
||||
// friendlist.GetTroopListReqV2
|
||||
func decodeGroupListResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGroupListResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion3{}
|
||||
@ -528,7 +528,7 @@ func decodeGroupListResponse(c *QQClient, _ *network.IncomingPacketInfo, payload
|
||||
}
|
||||
|
||||
// friendlist.GetTroopMemberListReq
|
||||
func decodeGroupMemberListResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGroupMemberListResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion3{}
|
||||
@ -564,7 +564,7 @@ func decodeGroupMemberListResponse(_ *QQClient, _ *network.IncomingPacketInfo, p
|
||||
}
|
||||
|
||||
// group_member_card.get_group_member_card_info
|
||||
func decodeGroupMemberInfoResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGroupMemberInfoResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := pb.GroupMemberRspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -597,7 +597,7 @@ func decodeGroupMemberInfoResponse(c *QQClient, _ *network.IncomingPacketInfo, p
|
||||
}
|
||||
|
||||
// LongConn.OffPicUp
|
||||
func decodeOffPicUpResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeOffPicUpResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := cmd0x352.RspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -635,7 +635,7 @@ func decodeOffPicUpResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload
|
||||
}
|
||||
|
||||
// OnlinePush.PbPushTransMsg
|
||||
func decodeOnlinePushTransPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeOnlinePushTransPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
info := msg.TransMsgInfo{}
|
||||
err := proto.Unmarshal(payload, &info)
|
||||
if err != nil {
|
||||
@ -738,7 +738,7 @@ func decodeOnlinePushTransPacket(c *QQClient, _ *network.IncomingPacketInfo, pay
|
||||
}
|
||||
|
||||
// ProfileService.Pb.ReqSystemMsgNew.Friend
|
||||
func decodeSystemMsgFriendPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeSystemMsgFriendPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := structmsg.RspSystemMsgNew{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -760,7 +760,7 @@ func decodeSystemMsgFriendPacket(c *QQClient, _ *network.IncomingPacketInfo, pay
|
||||
}
|
||||
|
||||
// MessageSvc.PushForceOffline
|
||||
func decodeForceOfflinePacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeForceOfflinePacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -773,7 +773,7 @@ func decodeForceOfflinePacket(c *QQClient, _ *network.IncomingPacketInfo, payloa
|
||||
}
|
||||
|
||||
// StatSvc.ReqMSFOffline
|
||||
func decodeMSFOfflinePacket(c *QQClient, _ *network.IncomingPacketInfo, _ []byte) (interface{}, error) {
|
||||
func decodeMSFOfflinePacket(c *QQClient, _ *network.IncomingPacketInfo, _ []byte) (any, error) {
|
||||
// c.lastLostMsg = "服务器端强制下线."
|
||||
c.Disconnect()
|
||||
// 这个decoder不能消耗太多时间, event另起线程处理
|
||||
@ -782,7 +782,7 @@ func decodeMSFOfflinePacket(c *QQClient, _ *network.IncomingPacketInfo, _ []byte
|
||||
}
|
||||
|
||||
// OidbSvc.0xd79
|
||||
func decodeWordSegmentation(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeWordSegmentation(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := &oidb.D79RspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
@ -794,7 +794,7 @@ func decodeWordSegmentation(_ *QQClient, _ *network.IncomingPacketInfo, payload
|
||||
return nil, errors.New("no word received")
|
||||
}
|
||||
|
||||
func decodeSidExpiredPacket(c *QQClient, i *network.IncomingPacketInfo, _ []byte) (interface{}, error) {
|
||||
func decodeSidExpiredPacket(c *QQClient, i *network.IncomingPacketInfo, _ []byte) (any, error) {
|
||||
_, err := c.sendAndWait(c.buildRequestChangeSigPacket(3554528))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "resign client error")
|
||||
@ -824,6 +824,6 @@ func decodeAppInfoResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (
|
||||
}
|
||||
*/
|
||||
|
||||
func ignoreDecoder(_ *QQClient, _ *network.IncomingPacketInfo, _ []byte) (interface{}, error) {
|
||||
func ignoreDecoder(_ *QQClient, _ *network.IncomingPacketInfo, _ []byte) (any, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ func (c *QQClient) dispatchMemberJoinedGuildEvent(e *MemberJoinGuildEvent) {
|
||||
}
|
||||
|
||||
func (c *QQClient) dispatchGroupMessageReceiptEvent(e *groupMessageReceiptEvent) {
|
||||
c.eventHandlers.groupMessageReceiptHandlers.Range(func(_, f interface{}) bool {
|
||||
c.eventHandlers.groupMessageReceiptHandlers.Range(func(_, f any) bool {
|
||||
go f.(func(*QQClient, *groupMessageReceiptEvent))(c, e)
|
||||
return true
|
||||
})
|
||||
|
@ -41,7 +41,7 @@ func (c *QQClient) buildFaceroamRequestPacket() (uint16, []byte) {
|
||||
return c.uniPacket("Faceroam.OpReq", payload)
|
||||
}
|
||||
|
||||
func decodeFaceroamResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeFaceroamResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := faceroam.FaceroamRspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
|
@ -402,7 +402,7 @@ func (c *QQClient) buildGroupFileDeleteReqPacket(groupCode int64, parentFolderId
|
||||
return c.uniPacket("OidbSvc.0x6d6_3", payload)
|
||||
}
|
||||
|
||||
func decodeOIDB6d81Response(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeOIDB6d81Response(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := oidb.D6D8RspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
@ -412,7 +412,7 @@ func decodeOIDB6d81Response(_ *QQClient, _ *network.IncomingPacketInfo, payload
|
||||
}
|
||||
|
||||
// OidbSvc.0x6d6_2
|
||||
func decodeOIDB6d62Response(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeOIDB6d62Response(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := oidb.D6D6RspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
@ -426,7 +426,7 @@ func decodeOIDB6d62Response(_ *QQClient, _ *network.IncomingPacketInfo, payload
|
||||
return fmt.Sprintf("http://%s/ftn_handler/%s/", ip, url), nil
|
||||
}
|
||||
|
||||
func decodeOIDB6d63Response(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeOIDB6d63Response(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := oidb.D6D6RspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
@ -435,7 +435,7 @@ func decodeOIDB6d63Response(_ *QQClient, _ *network.IncomingPacketInfo, payload
|
||||
return rsp.DeleteFileRsp.GetClientWording(), nil
|
||||
}
|
||||
|
||||
func decodeOIDB6d60Response(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeOIDB6d60Response(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := oidb.D6D6RspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
@ -444,7 +444,7 @@ func decodeOIDB6d60Response(_ *QQClient, _ *network.IncomingPacketInfo, payload
|
||||
return rsp.UploadFileRsp, nil
|
||||
}
|
||||
|
||||
func decodeOIDB6d7Response(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeOIDB6d7Response(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := oidb.D6D7RspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
|
@ -183,7 +183,7 @@ func (c *QQClient) buildGroupSearchPacket(keyword string) (uint16, []byte) {
|
||||
}
|
||||
|
||||
// SummaryCard.ReqSearch
|
||||
func decodeGroupSearchResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGroupSearchResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -221,7 +221,7 @@ func decodeGroupSearchResponse(_ *QQClient, _ *network.IncomingPacketInfo, paylo
|
||||
}
|
||||
|
||||
// OidbSvc.0x88d_0
|
||||
func decodeGroupInfoResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGroupInfoResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := oidb.D88DRspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
@ -328,7 +328,7 @@ func (g *GroupInfo) AdministratorOrOwner() bool {
|
||||
}
|
||||
|
||||
func (g *GroupInfo) FindMember(uin int64) *GroupMemberInfo {
|
||||
r := g.Read(func(info *GroupInfo) interface{} {
|
||||
r := g.Read(func(info *GroupInfo) any {
|
||||
return info.FindMemberWithoutLock(uin)
|
||||
})
|
||||
if r == nil {
|
||||
@ -360,7 +360,7 @@ func (g *GroupInfo) Update(f func(*GroupInfo)) {
|
||||
f(g)
|
||||
}
|
||||
|
||||
func (g *GroupInfo) Read(f func(*GroupInfo) interface{}) interface{} {
|
||||
func (g *GroupInfo) Read(f func(*GroupInfo) any) any {
|
||||
g.lock.RLock()
|
||||
defer g.lock.RUnlock()
|
||||
return f(g)
|
||||
|
@ -297,7 +297,7 @@ func (c *QQClient) buildAtAllRemainRequestPacket(groupCode int64) (uint16, []byt
|
||||
}
|
||||
|
||||
// OnlinePush.PbPushGroupMsg
|
||||
func decodeGroupMessagePacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGroupMessagePacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
pkt := msg.PushMessagePacket{}
|
||||
err := proto.Unmarshal(payload, &pkt)
|
||||
if err != nil {
|
||||
@ -332,7 +332,7 @@ func decodeGroupMessagePacket(c *QQClient, _ *network.IncomingPacketInfo, payloa
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func decodeMsgSendResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeMsgSendResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := msg.SendMessageResponse{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -347,7 +347,7 @@ func decodeMsgSendResponse(c *QQClient, _ *network.IncomingPacketInfo, payload [
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func decodeGetGroupMsgResponse(c *QQClient, info *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGetGroupMsgResponse(c *QQClient, info *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := msg.GetGroupMsgResp{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -396,7 +396,7 @@ func decodeGetGroupMsgResponse(c *QQClient, info *network.IncomingPacketInfo, pa
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func decodeAtAllRemainResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeAtAllRemainResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := oidb.D8A7RspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
@ -589,7 +589,7 @@ func (c *QQClient) buildEssenceMsgOperatePacket(groupCode int64, msgSeq, msgRand
|
||||
}
|
||||
|
||||
// OidbSvc.0xeac_1/2
|
||||
func decodeEssenceMsgResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeEssenceMsgResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := &oidb.EACRspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
|
@ -737,7 +737,7 @@ func (c *QQClient) buildSyncChannelFirstViewPacket() (uint16, []byte) {
|
||||
return c.uniPacket("trpc.group_pro.synclogic.SyncLogic.SyncFirstView", payload)
|
||||
}
|
||||
|
||||
func decodeGuildPushFirstView(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGuildPushFirstView(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
firstViewMsg := new(channel.FirstViewMsg)
|
||||
if err := proto.Unmarshal(payload, firstViewMsg); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
|
@ -27,7 +27,7 @@ type tipsPushInfo struct {
|
||||
ChannelId uint64
|
||||
}
|
||||
|
||||
func decodeGuildEventFlowPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGuildEventFlowPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
push := new(channel.MsgOnlinePush)
|
||||
if err := proto.Unmarshal(payload, push); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -223,7 +223,7 @@ func (c *QQClient) processGuildEventBody(m *channel.ChannelMsgContent, eventBody
|
||||
MessageId: t[0].Head.ContentHead.GetSeq(),
|
||||
CurrentReactions: decodeGuildMessageEmojiReactions(t[0]),
|
||||
}
|
||||
tipsInfo, err := c.waitPacketTimeoutSyncF("MsgPush.PushGroupProMsg", time.Second, func(i interface{}) bool {
|
||||
tipsInfo, err := c.waitPacketTimeoutSyncF("MsgPush.PushGroupProMsg", time.Second, func(i any) bool {
|
||||
if i == nil {
|
||||
return false
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ func decodeGuildMessageEmojiReactions(content *channel.ChannelMsgContent) (r []*
|
||||
return
|
||||
}
|
||||
|
||||
func decodeGuildImageStoreResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGuildImageStoreResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
body := new(cmd0x388.D388RspBody)
|
||||
if err := proto.Unmarshal(payload, body); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
|
@ -90,7 +90,7 @@ func (c *QQClient) uploadGroupOrGuildImage(target message.Source, img io.ReadSee
|
||||
}.Encode()
|
||||
}
|
||||
|
||||
var r interface{}
|
||||
var r any
|
||||
var err error
|
||||
var input highway.BdhInput
|
||||
switch target.SourceType {
|
||||
@ -203,7 +203,7 @@ func (c *QQClient) uploadPrivateImage(target int64, img io.ReadSeeker, count int
|
||||
return e, nil
|
||||
}
|
||||
|
||||
func (c *QQClient) ImageOcr(img interface{}) (*OcrResponse, error) {
|
||||
func (c *QQClient) ImageOcr(img any) (*OcrResponse, error) {
|
||||
url := ""
|
||||
switch e := img.(type) {
|
||||
case *message.GroupImageElement:
|
||||
@ -362,7 +362,7 @@ func (c *QQClient) buildImageOcrRequestPacket(url, md5 string, size, weight, hei
|
||||
}
|
||||
|
||||
// ImgStore.GroupPicUp
|
||||
func decodeGroupImageStoreResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGroupImageStoreResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
pkt := cmd0x388.D388RspBody{}
|
||||
err := proto.Unmarshal(payload, &pkt)
|
||||
if err != nil {
|
||||
@ -389,7 +389,7 @@ func decodeGroupImageStoreResponse(_ *QQClient, _ *network.IncomingPacketInfo, p
|
||||
}, nil
|
||||
}
|
||||
|
||||
func decodeGroupImageDownloadResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGroupImageDownloadResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
pkt := cmd0x388.D388RspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkt); err != nil {
|
||||
return nil, errors.Wrap(err, "unmarshal protobuf message error")
|
||||
@ -404,7 +404,7 @@ func decodeGroupImageDownloadResponse(_ *QQClient, _ *network.IncomingPacketInfo
|
||||
}
|
||||
|
||||
// OidbSvc.0xe07_0
|
||||
func decodeImageOcrResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeImageOcrResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := oidb.DE07RspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
|
@ -6,7 +6,7 @@ type IncomingPacketInfo struct {
|
||||
Params RequestParams
|
||||
}
|
||||
|
||||
type RequestParams map[string]interface{}
|
||||
type RequestParams map[string]any
|
||||
|
||||
func (p RequestParams) Bool(k string) bool {
|
||||
if p == nil {
|
||||
|
@ -47,7 +47,7 @@ func (c *QQClient) buildMultiApplyUpPacket(data, hash []byte, buType int32, grou
|
||||
}
|
||||
|
||||
// MultiMsg.ApplyUp
|
||||
func decodeMultiApplyUpResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeMultiApplyUpResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
body := multimsg.MultiRspBody{}
|
||||
if err := proto.Unmarshal(payload, &body); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -87,7 +87,7 @@ func (c *QQClient) buildMultiApplyDownPacket(resID string) (uint16, []byte) {
|
||||
}
|
||||
|
||||
// MultiMsg.ApplyDown
|
||||
func decodeMultiApplyDownResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeMultiApplyDownResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
body := multimsg.MultiRspBody{}
|
||||
if err := proto.Unmarshal(payload, &body); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
|
@ -148,9 +148,9 @@ func (c *QQClient) Disconnect() {
|
||||
}
|
||||
|
||||
// sendAndWait 向服务器发送一个数据包, 并等待返回
|
||||
func (c *QQClient) sendAndWait(seq uint16, pkt []byte, params ...network.RequestParams) (interface{}, error) {
|
||||
func (c *QQClient) sendAndWait(seq uint16, pkt []byte, params ...network.RequestParams) (any, error) {
|
||||
type T struct {
|
||||
Response interface{}
|
||||
Response any
|
||||
Error error
|
||||
}
|
||||
ch := make(chan T, 1)
|
||||
@ -160,7 +160,7 @@ func (c *QQClient) sendAndWait(seq uint16, pkt []byte, params ...network.Request
|
||||
p = params[0]
|
||||
}
|
||||
|
||||
c.handlers.Store(seq, &handlerInfo{fun: func(i interface{}, err error) {
|
||||
c.handlers.Store(seq, &handlerInfo{fun: func(i any, err error) {
|
||||
ch <- T{
|
||||
Response: i,
|
||||
Error: err,
|
||||
@ -204,7 +204,7 @@ func (c *QQClient) sendPacket(pkt []byte) error {
|
||||
// waitPacket
|
||||
// 等待一个或多个数据包解析, 优先级低于 sendAndWait
|
||||
// 返回终止解析函数
|
||||
func (c *QQClient) waitPacket(cmd string, f func(interface{}, error)) func() {
|
||||
func (c *QQClient) waitPacket(cmd string, f func(any, error)) func() {
|
||||
c.waiters.Store(cmd, f)
|
||||
return func() {
|
||||
c.waiters.Delete(cmd)
|
||||
@ -213,9 +213,9 @@ func (c *QQClient) waitPacket(cmd string, f func(interface{}, error)) func() {
|
||||
|
||||
// waitPacketTimeoutSyncF
|
||||
// 等待一个数据包解析, 优先级低于 sendAndWait
|
||||
func (c *QQClient) waitPacketTimeoutSyncF(cmd string, timeout time.Duration, filter func(interface{}) bool) (r interface{}, e error) {
|
||||
func (c *QQClient) waitPacketTimeoutSyncF(cmd string, timeout time.Duration, filter func(any) bool) (r any, e error) {
|
||||
notifyChan := make(chan bool)
|
||||
defer c.waitPacket(cmd, func(i interface{}, err error) {
|
||||
defer c.waitPacket(cmd, func(i any, err error) {
|
||||
if filter(i) {
|
||||
r = i
|
||||
e = err
|
||||
@ -234,7 +234,7 @@ func (c *QQClient) waitPacketTimeoutSyncF(cmd string, timeout time.Duration, fil
|
||||
// 发送数据包并返回需要解析的 response
|
||||
func (c *QQClient) sendAndWaitDynamic(seq uint16, pkt []byte) ([]byte, error) {
|
||||
ch := make(chan []byte, 1)
|
||||
c.handlers.Store(seq, &handlerInfo{fun: func(i interface{}, err error) { ch <- i.([]byte) }, dynamic: true})
|
||||
c.handlers.Store(seq, &handlerInfo{fun: func(i any, err error) { ch <- i.([]byte) }, dynamic: true})
|
||||
err := c.sendPacket(pkt)
|
||||
if err != nil {
|
||||
c.handlers.Delete(seq)
|
||||
@ -337,7 +337,7 @@ func (c *QQClient) netLoop() {
|
||||
if decoder, ok := decoders[pkt.CommandName]; ok {
|
||||
// found predefined decoder
|
||||
info, ok := c.handlers.LoadAndDelete(pkt.SequenceId)
|
||||
var decoded interface{}
|
||||
var decoded any
|
||||
decoded = pkt.Payload
|
||||
if info == nil || !info.dynamic {
|
||||
decoded, err = decoder(c, &network.IncomingPacketInfo{
|
||||
@ -352,7 +352,7 @@ func (c *QQClient) netLoop() {
|
||||
if ok {
|
||||
info.fun(decoded, err)
|
||||
} else if f, ok := c.waiters.Load(pkt.CommandName); ok { // 在不存在handler的情况下触发wait
|
||||
f.(func(interface{}, error))(decoded, err)
|
||||
f.(func(any, error))(decoded, err)
|
||||
}
|
||||
} else if f, ok := c.handlers.LoadAndDelete(pkt.SequenceId); ok {
|
||||
// does not need decoder
|
||||
|
@ -33,7 +33,7 @@ func (c *QQClient) buildOfflineFileDownloadRequestPacket(uuid []byte) (uint16, [
|
||||
return seq, packet
|
||||
}
|
||||
|
||||
func decodeOfflineFileDownloadResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeOfflineFileDownloadResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := cmd0x346.C346RspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
c.error("unmarshal cmd0x346 rsp body error: %v", err)
|
||||
|
@ -23,7 +23,7 @@ var msg0x210Decoders = map[int64]func(*QQClient, []byte) error{
|
||||
}
|
||||
|
||||
// OnlinePush.ReqPush
|
||||
func decodeOnlinePushReqPacket(c *QQClient, info *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeOnlinePushReqPacket(c *QQClient, info *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
|
@ -324,7 +324,7 @@ func (c *QQClient) buildC2CPttStoreBDHExt(target int64, md5 []byte, size, voiceL
|
||||
}
|
||||
|
||||
// PttCenterSvr.ShortVideoDownReq
|
||||
func decodePttShortVideoDownResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodePttShortVideoDownResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := pttcenter.ShortVideoRspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -336,7 +336,7 @@ func decodePttShortVideoDownResponse(_ *QQClient, _ *network.IncomingPacketInfo,
|
||||
}
|
||||
|
||||
// PttCenterSvr.GroupShortVideoUpReq
|
||||
func decodeGroupShortVideoUploadResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeGroupShortVideoUploadResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := pttcenter.ShortVideoRspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
|
@ -152,7 +152,7 @@ func (c *QQClient) bigDataRequest(subCmd uint32, req proto.Message) ([]byte, err
|
||||
return tea.Decrypt(payload), nil
|
||||
}
|
||||
|
||||
func decodeLoginExtraResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeLoginExtraResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := cmd0x3f6.C3F6RspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -168,7 +168,7 @@ func decodeLoginExtraResponse(c *QQClient, _ *network.IncomingPacketInfo, payloa
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func decodeConnKeyResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeConnKeyResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := cmd0x6ff.C501RspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
|
@ -92,7 +92,7 @@ func (c *QQClient) buildPrivateRecallPacket(uin, ts int64, msgSeq, random int32)
|
||||
return c.uniPacket("PbMessageSvc.PbMsgWithDraw", payload)
|
||||
}
|
||||
|
||||
func decodeMsgWithDrawResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeMsgWithDrawResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := msg.MsgWithDrawResp{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
|
@ -48,7 +48,7 @@ func (c *QQClient) buildUrlCheckRequest(url string) (uint16, []byte) {
|
||||
return c.uniPacket("OidbSvc.0xbcb_0", payload)
|
||||
}
|
||||
|
||||
func decodeUrlCheckResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeUrlCheckResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := &oidb.DBCBRspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
|
@ -79,7 +79,7 @@ func (c *QQClient) SyncSessions() (*SessionSyncResponse, error) {
|
||||
ret := &SessionSyncResponse{}
|
||||
notifyChan := make(chan bool)
|
||||
var groupNum int32 = -1
|
||||
stop := c.waitPacket("RegPrxySvc.PbSyncMsg", func(i interface{}, err error) {
|
||||
stop := c.waitPacket("RegPrxySvc.PbSyncMsg", func(i any, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -285,7 +285,7 @@ func (c *QQClient) buildPrivateMsgReadedPacket(uin, time int64) (uint16, []byte)
|
||||
}
|
||||
|
||||
// StatSvc.GetDevLoginInfo
|
||||
func decodeDevListResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeDevListResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -307,7 +307,7 @@ func decodeDevListResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload [
|
||||
}
|
||||
|
||||
// RegPrxySvc.PushParam
|
||||
func decodePushParamPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodePushParamPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -352,7 +352,7 @@ func decodePushParamPacket(c *QQClient, _ *network.IncomingPacketInfo, payload [
|
||||
}
|
||||
|
||||
// RegPrxySvc.PbSyncMsg
|
||||
func decodeMsgSyncResponse(c *QQClient, info *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeMsgSyncResponse(c *QQClient, info *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := &msf.SvcRegisterProxyMsgResp{}
|
||||
if err := proto.Unmarshal(payload, rsp); err != nil {
|
||||
return nil, err
|
||||
@ -396,7 +396,7 @@ func decodeMsgSyncResponse(c *QQClient, info *network.IncomingPacketInfo, payloa
|
||||
}
|
||||
|
||||
// OnlinePush.PbC2CMsgSync
|
||||
func decodeC2CSyncPacket(c *QQClient, info *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeC2CSyncPacket(c *QQClient, info *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
m := msg.PbPushMsg{}
|
||||
if err := proto.Unmarshal(payload, &m); err != nil {
|
||||
return nil, err
|
||||
@ -406,7 +406,7 @@ func decodeC2CSyncPacket(c *QQClient, info *network.IncomingPacketInfo, payload
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func decodeMsgReadedResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeMsgReadedResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := msg.PbMsgReadedReportResp{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -420,7 +420,7 @@ func decodeMsgReadedResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload
|
||||
var loginNotifyLock sync.Mutex
|
||||
|
||||
// StatSvc.SvcReqMSFLoginNotify
|
||||
func decodeLoginNotifyPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeLoginNotifyPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
|
@ -190,7 +190,7 @@ func (c *QQClient) buildSystemMsgFriendActionPacket(reqID, requester int64, acce
|
||||
}
|
||||
|
||||
// ProfileService.Pb.ReqSystemMsgNew.Group
|
||||
func decodeSystemMsgGroupPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeSystemMsgGroupPacket(c *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := structmsg.RspSystemMsgNew{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, err
|
||||
|
@ -34,7 +34,7 @@ func (c *QQClient) Translate(src, dst, text string) (string, error) {
|
||||
}
|
||||
|
||||
// OidbSvc.0x990
|
||||
func decodeTranslateResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
func decodeTranslateResponse(_ *QQClient, _ *network.IncomingPacketInfo, payload []byte) (any, error) {
|
||||
rsp := oidb.TranslateRspBody{}
|
||||
err := unpackOIDBPackage(payload, &rsp)
|
||||
if err != nil {
|
||||
|
@ -173,7 +173,7 @@ func (g Generator) Generate(w io.Writer) {
|
||||
}
|
||||
}
|
||||
|
||||
func assert(cond bool, val interface{}) {
|
||||
func assert(cond bool, val any) {
|
||||
if !cond {
|
||||
panic("assertion failed: " + fmt.Sprint(val))
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"math"
|
||||
)
|
||||
|
||||
type DynamicMessage map[uint64]interface{}
|
||||
type DynamicMessage map[uint64]any
|
||||
|
||||
type encoder struct {
|
||||
bytes.Buffer
|
||||
|
@ -2,7 +2,7 @@ package proto
|
||||
|
||||
import "github.com/RomiChan/protobuf/proto"
|
||||
|
||||
type Message = interface{}
|
||||
type Message = any
|
||||
|
||||
func Marshal(m Message) ([]byte, error) {
|
||||
return proto.Marshal(m)
|
||||
|
@ -55,7 +55,7 @@ type (
|
||||
pack(patternId string, isPatternData bool) content
|
||||
}
|
||||
|
||||
content map[string]interface{}
|
||||
content map[string]any
|
||||
)
|
||||
|
||||
var globalBlockId int64 = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user