1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

feature friend ptt decode.

This commit is contained in:
Mrs4s 2020-11-20 09:01:32 +08:00
parent 03652b0425
commit 37b3821668
2 changed files with 18 additions and 6 deletions

View File

@ -328,7 +328,7 @@ func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{},
continue
}
c.dispatchTempMessage(c.parseTempMessage(message))
case 166: // 好友消息
case 166, 208: // 好友消息
if message.Head.GetFromUin() == c.Uin {
for {
frdSeq := atomic.LoadInt32(&c.friendSeq)

View File

@ -367,11 +367,23 @@ func (c *QQClient) parsePrivateMessage(msg *msg.Message) *message.PrivateMessage
}
}
ret := &message.PrivateMessage{
Id: msg.Head.GetMsgSeq(),
Target: c.Uin,
Time: msg.Head.GetMsgTime(),
Sender: sender,
Elements: message.ParseMessageElems(msg.Body.RichText.Elems),
Id: msg.Head.GetMsgSeq(),
Target: c.Uin,
Time: msg.Head.GetMsgTime(),
Sender: sender,
Elements: func() []message.IMessageElement {
if msg.Body.RichText.Ptt != nil {
return []message.IMessageElement{
&message.VoiceElement{
Name: msg.Body.RichText.Ptt.GetFileName(),
Md5: msg.Body.RichText.Ptt.FileMd5,
Size: msg.Body.RichText.Ptt.GetFileSize(),
Url: string(msg.Body.RichText.Ptt.DownPara),
},
}
}
return message.ParseMessageElems(msg.Body.RichText.Elems)
}(),
}
if msg.Body.RichText.Attr != nil {
ret.InternalId = msg.Body.RichText.Attr.GetRandom()