mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-06-19 05:55:05 +08:00
optimize decoder params.
This commit is contained in:
parent
3f91730dc4
commit
6c17f296a9
@ -121,7 +121,7 @@ type loginSigInfo struct {
|
||||
pt4TokenMap map[string][]byte
|
||||
}
|
||||
|
||||
var decoders = map[string]func(*QQClient, uint16, []byte) (interface{}, error){
|
||||
var decoders = map[string]func(*QQClient, *incomingPacketInfo, []byte) (interface{}, error){
|
||||
"wtlogin.login": decodeLoginResponse,
|
||||
"wtlogin.exchange_emp": decodeExchangeEmpResponse,
|
||||
"StatSvc.register": decodeClientRegisterResponse,
|
||||
@ -916,7 +916,10 @@ func (c *QQClient) netLoop() {
|
||||
|
||||
if decoder, ok := decoders[pkt.CommandName]; ok {
|
||||
// found predefined decoder
|
||||
rsp, err := decoder(c, pkt.SequenceId, payload)
|
||||
rsp, err := decoder(c, &incomingPacketInfo{
|
||||
SequenceId: pkt.SequenceId,
|
||||
CommandName: pkt.CommandName,
|
||||
}, payload)
|
||||
if err != nil {
|
||||
c.Debug("decode pkt %v error: %+v", pkt.CommandName, err)
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ var (
|
||||
)
|
||||
|
||||
// wtlogin.login
|
||||
func decodeLoginResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeLoginResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
reader := binary.NewReader(payload)
|
||||
reader.ReadUInt16() // sub command
|
||||
t := reader.ReadByte()
|
||||
@ -181,7 +181,7 @@ func decodeLoginResponse(c *QQClient, _ uint16, payload []byte) (interface{}, er
|
||||
}
|
||||
|
||||
// StatSvc.register
|
||||
func decodeClientRegisterResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeClientRegisterResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -198,7 +198,7 @@ func decodeClientRegisterResponse(c *QQClient, _ uint16, payload []byte) (interf
|
||||
}
|
||||
|
||||
// wtlogin.exchange_emp
|
||||
func decodeExchangeEmpResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeExchangeEmpResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
reader := binary.NewReader(payload)
|
||||
cmd := reader.ReadUInt16()
|
||||
t := reader.ReadByte()
|
||||
@ -215,7 +215,7 @@ func decodeExchangeEmpResponse(c *QQClient, _ uint16, payload []byte) (interface
|
||||
}
|
||||
|
||||
// ConfigPushSvc.PushReq
|
||||
func decodePushReqPacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodePushReqPacket(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -288,7 +288,7 @@ func decodePushReqPacket(c *QQClient, _ uint16, payload []byte) (interface{}, er
|
||||
}
|
||||
|
||||
// MessageSvc.PbGetMsg
|
||||
func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeMessageSvcPacket(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := msg.GetMessageResponse{}
|
||||
err := proto.Unmarshal(payload, &rsp)
|
||||
if err != nil {
|
||||
@ -299,13 +299,13 @@ func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
}
|
||||
|
||||
// MessageSvc.PushNotify
|
||||
func decodeSvcNotify(c *QQClient, _ uint16, _ []byte) (interface{}, error) {
|
||||
func decodeSvcNotify(c *QQClient, _ *incomingPacketInfo, _ []byte) (interface{}, error) {
|
||||
_, err := c.sendAndWait(c.buildGetMessageRequestPacket(msg.SyncFlag_START, time.Now().Unix()))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// SummaryCard.ReqSummaryCard
|
||||
func decodeSummaryCardResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeSummaryCardResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -354,7 +354,7 @@ func decodeSummaryCardResponse(_ *QQClient, _ uint16, payload []byte) (interface
|
||||
}
|
||||
|
||||
// friendlist.getFriendGroupList
|
||||
func decodeFriendGroupListResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeFriendGroupListResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion3{}
|
||||
@ -380,7 +380,7 @@ func decodeFriendGroupListResponse(_ *QQClient, _ uint16, payload []byte) (inter
|
||||
}
|
||||
|
||||
// friendlist.GetTroopListReqV2
|
||||
func decodeGroupListResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeGroupListResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion3{}
|
||||
@ -414,7 +414,7 @@ func decodeGroupListResponse(c *QQClient, _ uint16, payload []byte) (interface{}
|
||||
}
|
||||
|
||||
// friendlist.GetTroopMemberListReq
|
||||
func decodeGroupMemberListResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeGroupMemberListResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion3{}
|
||||
@ -450,7 +450,7 @@ func decodeGroupMemberListResponse(_ *QQClient, _ uint16, payload []byte) (inter
|
||||
}
|
||||
|
||||
// group_member_card.get_group_member_card_info
|
||||
func decodeGroupMemberInfoResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeGroupMemberInfoResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := pb.GroupMemberRspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -483,7 +483,7 @@ func decodeGroupMemberInfoResponse(c *QQClient, _ uint16, payload []byte) (inter
|
||||
}
|
||||
|
||||
// LongConn.OffPicUp
|
||||
func decodeOffPicUpResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeOffPicUpResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := cmd0x352.RspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -521,7 +521,7 @@ func decodeOffPicUpResponse(_ *QQClient, _ uint16, payload []byte) (interface{},
|
||||
}
|
||||
|
||||
// OnlinePush.ReqPush
|
||||
func decodeOnlinePushReqPacket(c *QQClient, seq uint16, payload []byte) (interface{}, error) {
|
||||
func decodeOnlinePushReqPacket(c *QQClient, info *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -530,7 +530,7 @@ func decodeOnlinePushReqPacket(c *QQClient, seq uint16, payload []byte) (interfa
|
||||
msgInfos := []jce.PushMessageInfo{}
|
||||
uin := jr.ReadInt64(0)
|
||||
jr.ReadSlice(&msgInfos, 2)
|
||||
_ = c.send(c.buildDeleteOnlinePushPacket(uin, seq, msgInfos))
|
||||
_ = c.send(c.buildDeleteOnlinePushPacket(uin, info.SequenceId, msgInfos))
|
||||
for _, m := range msgInfos {
|
||||
k := fmt.Sprintf("%v%v%v", m.MsgSeq, m.MsgTime, m.MsgUid)
|
||||
if _, ok := c.onlinePushCache.Get(k); ok {
|
||||
@ -720,7 +720,7 @@ func decodeOnlinePushReqPacket(c *QQClient, seq uint16, payload []byte) (interfa
|
||||
}
|
||||
|
||||
// OnlinePush.PbPushTransMsg
|
||||
func decodeOnlinePushTransPacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeOnlinePushTransPacket(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
info := msg.TransMsgInfo{}
|
||||
err := proto.Unmarshal(payload, &info)
|
||||
if err != nil {
|
||||
@ -827,7 +827,7 @@ func decodeOnlinePushTransPacket(c *QQClient, _ uint16, payload []byte) (interfa
|
||||
}
|
||||
|
||||
// ProfileService.Pb.ReqSystemMsgNew.Friend
|
||||
func decodeSystemMsgFriendPacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeSystemMsgFriendPacket(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := structmsg.RspSystemMsgNew{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -849,7 +849,7 @@ func decodeSystemMsgFriendPacket(c *QQClient, _ uint16, payload []byte) (interfa
|
||||
}
|
||||
|
||||
// MessageSvc.PushForceOffline
|
||||
func decodeForceOfflinePacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeForceOfflinePacket(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -863,7 +863,7 @@ func decodeForceOfflinePacket(c *QQClient, _ uint16, payload []byte) (interface{
|
||||
}
|
||||
|
||||
// StatSvc.ReqMSFOffline
|
||||
func decodeMSFOfflinePacket(c *QQClient, _ uint16, _ []byte) (interface{}, error) {
|
||||
func decodeMSFOfflinePacket(c *QQClient, _ *incomingPacketInfo, _ []byte) (interface{}, error) {
|
||||
c.lastLostMsg = "服务器端强制下线."
|
||||
c.NetLooping = false
|
||||
c.Online = false
|
||||
@ -871,7 +871,7 @@ func decodeMSFOfflinePacket(c *QQClient, _ uint16, _ []byte) (interface{}, error
|
||||
}
|
||||
|
||||
// OidbSvc.0xd79
|
||||
func decodeWordSegmentation(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeWordSegmentation(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := oidb.OIDBSSOPkg{}
|
||||
rsp := &oidb.D79RspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
@ -887,7 +887,7 @@ func decodeWordSegmentation(_ *QQClient, _ uint16, payload []byte) (interface{},
|
||||
}
|
||||
|
||||
// OidbSvc.0xe07_0
|
||||
func decodeImageOcrResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeImageOcrResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := oidb.OIDBSSOPkg{}
|
||||
rsp := oidb.DE07RspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
@ -924,7 +924,7 @@ func decodeImageOcrResponse(_ *QQClient, _ uint16, payload []byte) (interface{},
|
||||
}
|
||||
|
||||
// LightAppSvc.mini_app_info.GetAppInfoById
|
||||
func decodeAppInfoResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeAppInfoResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := qweb.QWebRsp{}
|
||||
rsp := qweb.GetAppInfoByIdRsp{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
@ -939,6 +939,6 @@ func decodeAppInfoResponse(_ *QQClient, _ uint16, payload []byte) (interface{},
|
||||
return rsp.AppInfo, nil
|
||||
}
|
||||
|
||||
func ignoreDecoder(_ *QQClient, _ uint16, _ []byte) (interface{}, error) {
|
||||
func ignoreDecoder(_ *QQClient, _ *incomingPacketInfo, _ []byte) (interface{}, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
173
client/global.go
173
client/global.go
@ -24,94 +24,101 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type DeviceInfo struct {
|
||||
Display []byte
|
||||
Product []byte
|
||||
Device []byte
|
||||
Board []byte
|
||||
Brand []byte
|
||||
Model []byte
|
||||
Bootloader []byte
|
||||
FingerPrint []byte
|
||||
BootId []byte
|
||||
ProcVersion []byte
|
||||
BaseBand []byte
|
||||
SimInfo []byte
|
||||
OSType []byte
|
||||
MacAddress []byte
|
||||
IpAddress []byte
|
||||
WifiBSSID []byte
|
||||
WifiSSID []byte
|
||||
IMSIMd5 []byte
|
||||
IMEI string
|
||||
AndroidId []byte
|
||||
APN []byte
|
||||
VendorName []byte
|
||||
VendorOSName []byte
|
||||
Guid []byte
|
||||
TgtgtKey []byte
|
||||
Protocol ClientProtocol
|
||||
Version *Version
|
||||
}
|
||||
type (
|
||||
DeviceInfo struct {
|
||||
Display []byte
|
||||
Product []byte
|
||||
Device []byte
|
||||
Board []byte
|
||||
Brand []byte
|
||||
Model []byte
|
||||
Bootloader []byte
|
||||
FingerPrint []byte
|
||||
BootId []byte
|
||||
ProcVersion []byte
|
||||
BaseBand []byte
|
||||
SimInfo []byte
|
||||
OSType []byte
|
||||
MacAddress []byte
|
||||
IpAddress []byte
|
||||
WifiBSSID []byte
|
||||
WifiSSID []byte
|
||||
IMSIMd5 []byte
|
||||
IMEI string
|
||||
AndroidId []byte
|
||||
APN []byte
|
||||
VendorName []byte
|
||||
VendorOSName []byte
|
||||
Guid []byte
|
||||
TgtgtKey []byte
|
||||
Protocol ClientProtocol
|
||||
Version *Version
|
||||
}
|
||||
|
||||
type Version struct {
|
||||
Incremental []byte
|
||||
Release []byte
|
||||
CodeName []byte
|
||||
Sdk uint32
|
||||
}
|
||||
Version struct {
|
||||
Incremental []byte
|
||||
Release []byte
|
||||
CodeName []byte
|
||||
Sdk uint32
|
||||
}
|
||||
|
||||
type DeviceInfoFile struct {
|
||||
Display string `json:"display"`
|
||||
Product string `json:"product"`
|
||||
Device string `json:"device"`
|
||||
Board string `json:"board"`
|
||||
Model string `json:"model"`
|
||||
FingerPrint string `json:"finger_print"`
|
||||
BootId string `json:"boot_id"`
|
||||
ProcVersion string `json:"proc_version"`
|
||||
Protocol int `json:"protocol"` // 0: Pad 1: Phone 2: Watch
|
||||
IMEI string `json:"imei"`
|
||||
Brand string `json:"brand"`
|
||||
Bootloader string `json:"bootloader"`
|
||||
BaseBand string `json:"base_band"`
|
||||
Version *VersionFile `json:"version"`
|
||||
SimInfo string `json:"sim_info"`
|
||||
OsType string `json:"os_type"`
|
||||
MacAddress string `json:"mac_address"`
|
||||
IpAddress []int32 `json:"ip_address"`
|
||||
WifiBSSID string `json:"wifi_bssid"`
|
||||
WifiSSID string `json:"wifi_ssid"`
|
||||
ImsiMd5 string `json:"imsi_md5"`
|
||||
AndroidId string `json:"android_id"`
|
||||
Apn string `json:"apn"`
|
||||
VendorName string `json:"vendor_name"`
|
||||
VendorOSName string `json:"vendor_os_name"`
|
||||
}
|
||||
DeviceInfoFile struct {
|
||||
Display string `json:"display"`
|
||||
Product string `json:"product"`
|
||||
Device string `json:"device"`
|
||||
Board string `json:"board"`
|
||||
Model string `json:"model"`
|
||||
FingerPrint string `json:"finger_print"`
|
||||
BootId string `json:"boot_id"`
|
||||
ProcVersion string `json:"proc_version"`
|
||||
Protocol int `json:"protocol"` // 0: Pad 1: Phone 2: Watch
|
||||
IMEI string `json:"imei"`
|
||||
Brand string `json:"brand"`
|
||||
Bootloader string `json:"bootloader"`
|
||||
BaseBand string `json:"base_band"`
|
||||
Version *VersionFile `json:"version"`
|
||||
SimInfo string `json:"sim_info"`
|
||||
OsType string `json:"os_type"`
|
||||
MacAddress string `json:"mac_address"`
|
||||
IpAddress []int32 `json:"ip_address"`
|
||||
WifiBSSID string `json:"wifi_bssid"`
|
||||
WifiSSID string `json:"wifi_ssid"`
|
||||
ImsiMd5 string `json:"imsi_md5"`
|
||||
AndroidId string `json:"android_id"`
|
||||
Apn string `json:"apn"`
|
||||
VendorName string `json:"vendor_name"`
|
||||
VendorOSName string `json:"vendor_os_name"`
|
||||
}
|
||||
|
||||
type VersionFile struct {
|
||||
Incremental string `json:"incremental"`
|
||||
Release string `json:"release"`
|
||||
Codename string `json:"codename"`
|
||||
Sdk uint32 `json:"sdk"`
|
||||
}
|
||||
VersionFile struct {
|
||||
Incremental string `json:"incremental"`
|
||||
Release string `json:"release"`
|
||||
Codename string `json:"codename"`
|
||||
Sdk uint32 `json:"sdk"`
|
||||
}
|
||||
|
||||
type groupMessageBuilder struct {
|
||||
MessageSlices []*msg.Message
|
||||
}
|
||||
groupMessageBuilder struct {
|
||||
MessageSlices []*msg.Message
|
||||
}
|
||||
|
||||
type versionInfo struct {
|
||||
ApkSign []byte
|
||||
ApkId string
|
||||
SortVersionName string
|
||||
SdkVersion string
|
||||
AppId uint32
|
||||
BuildTime uint32
|
||||
SSOVersion uint32
|
||||
MiscBitmap uint32
|
||||
SubSigmap uint32
|
||||
MainSigMap uint32
|
||||
}
|
||||
versionInfo struct {
|
||||
ApkSign []byte
|
||||
ApkId string
|
||||
SortVersionName string
|
||||
SdkVersion string
|
||||
AppId uint32
|
||||
BuildTime uint32
|
||||
SSOVersion uint32
|
||||
MiscBitmap uint32
|
||||
SubSigmap uint32
|
||||
MainSigMap uint32
|
||||
}
|
||||
|
||||
incomingPacketInfo struct {
|
||||
CommandName string
|
||||
SequenceId uint16
|
||||
}
|
||||
)
|
||||
|
||||
// default
|
||||
var SystemDeviceInfo = &DeviceInfo{
|
||||
|
@ -174,7 +174,7 @@ func (fs *GroupFileSystem) UploadFile(p, name, folderId string) error {
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "open file error")
|
||||
}
|
||||
defer file.Close()
|
||||
defer func() { _ = file.Close() }()
|
||||
md5Hash, size := utils.ComputeMd5AndLength(file)
|
||||
_, _ = file.Seek(0, io.SeekStart)
|
||||
sha1H := sha1.New()
|
||||
@ -401,7 +401,7 @@ func (c *QQClient) buildGroupFileDeleteReqPacket(groupCode int64, parentFolderId
|
||||
return seq, packet
|
||||
}
|
||||
|
||||
func decodeOIDB6d81Response(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeOIDB6d81Response(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := oidb.OIDBSSOPkg{}
|
||||
rsp := oidb.D6D8RspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
@ -414,7 +414,7 @@ func decodeOIDB6d81Response(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
}
|
||||
|
||||
// OidbSvc.0x6d6_2
|
||||
func decodeOIDB6d62Response(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeOIDB6d62Response(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := oidb.OIDBSSOPkg{}
|
||||
rsp := oidb.D6D6RspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
@ -431,7 +431,7 @@ func decodeOIDB6d62Response(_ *QQClient, _ uint16, payload []byte) (interface{},
|
||||
return fmt.Sprintf("http://%s/ftn_handler/%s/", ip, url), nil
|
||||
}
|
||||
|
||||
func decodeOIDB6d63Response(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeOIDB6d63Response(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := oidb.OIDBSSOPkg{}
|
||||
rsp := oidb.D6D6RspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
@ -446,7 +446,7 @@ func decodeOIDB6d63Response(_ *QQClient, _ uint16, payload []byte) (interface{},
|
||||
return rsp.DeleteFileRsp.ClientWording, nil
|
||||
}
|
||||
|
||||
func decodeOIDB6d60Response(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeOIDB6d60Response(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := oidb.OIDBSSOPkg{}
|
||||
rsp := oidb.D6D6RspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
|
@ -183,7 +183,7 @@ func (c *QQClient) buildGroupSearchPacket(keyword string) (uint16, []byte) {
|
||||
}
|
||||
|
||||
// SummaryCard.ReqSearch
|
||||
func decodeGroupSearchResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeGroupSearchResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -219,7 +219,7 @@ func decodeGroupSearchResponse(_ *QQClient, _ uint16, payload []byte) (interface
|
||||
}
|
||||
|
||||
// OidbSvc.0x88d_0
|
||||
func decodeGroupInfoResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeGroupInfoResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := oidb.OIDBSSOPkg{}
|
||||
rsp := oidb.D88DRspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
|
@ -304,7 +304,7 @@ func (c *QQClient) buildAtAllRemainRequestPacket(groupCode int64) (uint16, []byt
|
||||
}
|
||||
|
||||
// OnlinePush.PbPushGroupMsg
|
||||
func decodeGroupMessagePacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeGroupMessagePacket(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkt := msg.PushMessagePacket{}
|
||||
err := proto.Unmarshal(payload, &pkt)
|
||||
if err != nil {
|
||||
@ -345,7 +345,7 @@ func decodeGroupMessagePacket(c *QQClient, _ uint16, payload []byte) (interface{
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func decodeMsgSendResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeMsgSendResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := msg.SendMessageResponse{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -356,7 +356,7 @@ func decodeMsgSendResponse(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func decodeGetGroupMsgResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeGetGroupMsgResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := msg.GetGroupMsgResp{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -377,7 +377,7 @@ func decodeGetGroupMsgResponse(c *QQClient, _ uint16, payload []byte) (interface
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func decodeAtAllRemainResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeAtAllRemainResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := oidb.OIDBSSOPkg{}
|
||||
rsp := oidb.D8A7RspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
@ -573,7 +573,7 @@ func (c *QQClient) buildEssenceMsgOperatePacket(groupCode int64, msgSeq, msgRand
|
||||
}
|
||||
|
||||
// OidbSvc.0xeac_1/2
|
||||
func decodeEssenceMsgResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeEssenceMsgResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := oidb.OIDBSSOPkg{}
|
||||
rsp := &oidb.EACRspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
|
@ -65,7 +65,7 @@ func (c *QQClient) UploadGroupImageByFile(groupCode int64, path string) (*messag
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer img.Close()
|
||||
defer func() { _ = img.Close() }()
|
||||
fh, length := utils.ComputeMd5AndLength(img)
|
||||
seq, pkt := c.buildGroupImageStorePacket(groupCode, fh[:], int32(length))
|
||||
r, err := c.sendAndWait(seq, pkt)
|
||||
@ -213,7 +213,7 @@ func (c *QQClient) buildGroupImageStorePacket(groupCode int64, md5 []byte, size
|
||||
}
|
||||
|
||||
// ImgStore.GroupPicUp
|
||||
func decodeGroupImageStoreResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeGroupImageStoreResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkt := pb.D388RespBody{}
|
||||
err := proto.Unmarshal(payload, &pkt)
|
||||
if err != nil {
|
||||
|
@ -43,7 +43,7 @@ func (c *QQClient) buildMultiApplyUpPacket(data, hash []byte, buType int32, grou
|
||||
}
|
||||
|
||||
// MultiMsg.ApplyUp
|
||||
func decodeMultiApplyUpResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeMultiApplyUpResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
body := multimsg.MultiRspBody{}
|
||||
if err := proto.Unmarshal(payload, &body); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -85,7 +85,7 @@ func (c *QQClient) buildMultiApplyDownPacket(resId string) (uint16, []byte) {
|
||||
}
|
||||
|
||||
// MultiMsg.ApplyDown
|
||||
func decodeMultiApplyDownResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeMultiApplyDownResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
body := multimsg.MultiRspBody{}
|
||||
if err := proto.Unmarshal(payload, &body); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
|
@ -32,7 +32,7 @@ func (c *QQClient) buildOfflineFileDownloadRequestPacket(uuid []byte) (uint16, [
|
||||
return seq, packet
|
||||
}
|
||||
|
||||
func decodeOfflineFileDownloadResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeOfflineFileDownloadResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := cmd0x346.C346RspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
c.Error("unmarshal cmd0x346 rsp body error: %v", err)
|
||||
|
@ -260,7 +260,7 @@ func (c *QQClient) buildPttGroupShortVideoUploadReqPacket(videoHash, thumbHash [
|
||||
}
|
||||
|
||||
// PttStore.GroupPttUp
|
||||
func decodeGroupPttStoreResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeGroupPttStoreResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkt := pb.D388RespBody{}
|
||||
err := proto.Unmarshal(payload, &pkt)
|
||||
if err != nil {
|
||||
@ -318,7 +318,7 @@ func (c *QQClient) buildC2CPttStoreBDHExt(target int64, md5 []byte, size, voiceL
|
||||
}
|
||||
|
||||
// PttCenterSvr.ShortVideoDownReq
|
||||
func decodePttShortVideoDownResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodePttShortVideoDownResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := pttcenter.ShortVideoRspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -330,7 +330,7 @@ func decodePttShortVideoDownResponse(_ *QQClient, _ uint16, payload []byte) (int
|
||||
}
|
||||
|
||||
// PttCenterSvr.GroupShortVideoUpReq
|
||||
func decodeGroupShortVideoUploadResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeGroupShortVideoUploadResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := pttcenter.ShortVideoRspBody{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
|
@ -89,7 +89,7 @@ func (c *QQClient) buildPrivateRecallPacket(uin, ts int64, msgSeq, random int32)
|
||||
return seq, packet
|
||||
}
|
||||
|
||||
func decodeMsgWithDrawResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeMsgWithDrawResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := msg.MsgWithDrawResp{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
|
@ -49,7 +49,7 @@ func (c *QQClient) buildUrlCheckRequest(url string) (uint16, []byte) {
|
||||
return seq, packet
|
||||
}
|
||||
|
||||
func decodeUrlCheckResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeUrlCheckResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := &oidb.OIDBSSOPkg{}
|
||||
rsp := &oidb.DBCBRspBody{}
|
||||
if err := proto.Unmarshal(payload, pkg); err != nil {
|
||||
|
@ -274,7 +274,7 @@ func (c *QQClient) buildGroupMsgReadedPacket(groupCode, msgSeq int64) (uint16, [
|
||||
}
|
||||
|
||||
// StatSvc.GetDevLoginInfo
|
||||
func decodeDevListResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeDevListResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -297,7 +297,7 @@ func decodeDevListResponse(_ *QQClient, _ uint16, payload []byte) (interface{},
|
||||
}
|
||||
|
||||
// RegPrxySvc.PushParam
|
||||
func decodePushParamPacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodePushParamPacket(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
@ -342,7 +342,7 @@ func decodePushParamPacket(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
}
|
||||
|
||||
// RegPrxySvc.PbSyncMsg
|
||||
func decodeMsgSyncResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeMsgSyncResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := &msf.SvcRegisterProxyMsgResp{}
|
||||
if err := proto.Unmarshal(payload, rsp); err != nil {
|
||||
return nil, err
|
||||
@ -382,7 +382,7 @@ func decodeMsgSyncResponse(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func decodeMsgReadedResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeMsgReadedResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := msg.PbMsgReadedReportResp{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
@ -396,7 +396,7 @@ func decodeMsgReadedResponse(c *QQClient, _ uint16, payload []byte) (interface{}
|
||||
var loginNotifyLock sync.Mutex
|
||||
|
||||
// StatSvc.SvcReqMSFLoginNotify
|
||||
func decodeLoginNotifyPacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeLoginNotifyPacket(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
request.ReadFrom(jce.NewJceReader(payload))
|
||||
data := &jce.RequestDataVersion2{}
|
||||
|
@ -200,7 +200,7 @@ func (c *QQClient) buildSystemMsgFriendActionPacket(reqId, requester int64, acce
|
||||
}
|
||||
|
||||
// ProfileService.Pb.ReqSystemMsgNew.Group
|
||||
func decodeSystemMsgGroupPacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeSystemMsgGroupPacket(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
rsp := structmsg.RspSystemMsgNew{}
|
||||
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||
return nil, err
|
||||
|
@ -42,7 +42,7 @@ func (c *QQClient) Translate(src, dst, text string) (string, error) {
|
||||
}
|
||||
|
||||
// OidbSvc.0x990
|
||||
func decodeTranslateResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
func decodeTranslateResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := oidb.OIDBSSOPkg{}
|
||||
rsp := oidb.TranslateRspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user