mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-05 03:23:50 +08:00
fix multi msg download for android phone protocol.
This commit is contained in:
parent
74d9a87a54
commit
ad5531c3db
@ -8,7 +8,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
"net"
|
||||||
@ -1029,7 +1028,8 @@ func (c *QQClient) netLoop() {
|
|||||||
}
|
}
|
||||||
rsp, err := decoder(c, pkt.SequenceId, payload)
|
rsp, err := decoder(c, pkt.SequenceId, payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("decode", pkt.CommandName, "error:", err)
|
c.Error("decode pkt %v error: %v", pkt.CommandName, err)
|
||||||
|
//log.Println("decode", pkt.CommandName, "error:", err)
|
||||||
}
|
}
|
||||||
if f, ok := c.handlers.Load(pkt.SequenceId); ok {
|
if f, ok := c.handlers.Load(pkt.SequenceId); ok {
|
||||||
c.handlers.Delete(pkt.SequenceId)
|
c.handlers.Delete(pkt.SequenceId)
|
||||||
|
@ -875,11 +875,19 @@ func decodeMultiApplyDownResponse(c *QQClient, _ uint16, payload []byte) (interf
|
|||||||
return nil, errors.New("not found")
|
return nil, errors.New("not found")
|
||||||
}
|
}
|
||||||
rsp := body.MultimsgApplydownRsp[0]
|
rsp := body.MultimsgApplydownRsp[0]
|
||||||
i := binary.UInt32ToIPV4Address(uint32(rsp.Uint32DownIp[0]))
|
prefix := func() string {
|
||||||
b, err := utils.HttpGetBytes(fmt.Sprintf("http://%s:%d%s", i, body.MultimsgApplydownRsp[0].Uint32DownPort[0], string(rsp.ThumbDownPara)), "")
|
if rsp.MsgExternInfo.ChannelType == 2 {
|
||||||
|
return "https://ssl.htdata.qq.com"
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("http://%s:%d", binary.UInt32ToIPV4Address(uint32(rsp.Uint32DownIp[0])), body.MultimsgApplydownRsp[0].Uint32DownPort[0])
|
||||||
|
}()
|
||||||
|
b, err := utils.HttpGetBytes(fmt.Sprintf("%s%s", prefix, string(rsp.ThumbDownPara)), "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if b[0] != 40 {
|
||||||
|
return nil, errors.New("unexpected body data")
|
||||||
|
}
|
||||||
tea := binary.NewTeaCipher(body.MultimsgApplydownRsp[0].MsgKey)
|
tea := binary.NewTeaCipher(body.MultimsgApplydownRsp[0].MsgKey)
|
||||||
r := binary.NewReader(b[1:])
|
r := binary.NewReader(b[1:])
|
||||||
i1 := r.ReadInt32()
|
i1 := r.ReadInt32()
|
||||||
|
@ -305,10 +305,6 @@ func (c *QQClient) parseGroupMessage(m *msg.Message) *message.GroupMessage {
|
|||||||
}
|
}
|
||||||
// pre parse
|
// pre parse
|
||||||
for _, elem := range m.Body.RichText.Elems {
|
for _, elem := range m.Body.RichText.Elems {
|
||||||
// 为什么小程序会同时通过RichText和long text发送
|
|
||||||
if elem.LightApp != nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
// is rich long msg
|
// is rich long msg
|
||||||
if elem.GeneralFlags != nil && elem.GeneralFlags.LongTextResid != "" {
|
if elem.GeneralFlags != nil && elem.GeneralFlags.LongTextResid != "" {
|
||||||
if f := c.GetForwardMessage(elem.GeneralFlags.LongTextResid); f != nil && len(f.Nodes) == 1 {
|
if f := c.GetForwardMessage(elem.GeneralFlags.LongTextResid); f != nil && len(f.Nodes) == 1 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user